blob: 6291b45bcd9824467910dfd023d11b6b34eb7ef6 [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
William M. Brackf13f77f2004-11-12 16:03:48 +0000190/*
191 We manually define xmlErrMemory because it's normal declaration
192 is "hidden" by #ifdef IN_LIBXML
193*/
194void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
195
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000196#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000197
Daniel Veillard3d97e662004-11-04 10:49:00 +0000198static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000199 return(NULL);
200}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000201static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000202}
203
Daniel Veillardce244ad2004-11-05 10:03:46 +0000204#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000205#define gen_nb_const_void_ptr 2
206
207static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
208 if (no == 0) return((const void *) "immutable string");
209 return(NULL);
210}
211static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
212}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000213#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000214
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000215#define gen_nb_userdata 3
216
Daniel Veillard3d97e662004-11-04 10:49:00 +0000217static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000218 if (no == 0) return((void *) &call_tests);
219 if (no == 1) return((void *) -1);
220 return(NULL);
221}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000222static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223}
224
225
Daniel Veillardd93f6252004-11-02 15:53:51 +0000226#define gen_nb_int 4
227
Daniel Veillard3d97e662004-11-04 10:49:00 +0000228static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
229 if (no == 0) return(0);
230 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000231 if (no == 2) return(-1);
232 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000233 return(-1);
234}
235
236static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
237}
238
Daniel Veillard6128c012004-11-08 17:16:15 +0000239#define gen_nb_parseroptions 5
240
241static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
242 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
243 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
244 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
245 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
246 return(XML_PARSE_SAX1);
247}
248
249static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
250}
251
Daniel Veillardce244ad2004-11-05 10:03:46 +0000252#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000253#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000254
255static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
256 if (no == 0) return(0);
257 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000258 if (no == 2) return(-1);
259 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000260 return(-1);
261}
262
263static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
264}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000265#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000266
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000267#define gen_nb_xmlChar 4
268
269static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
270 if (no == 0) return('a');
271 if (no == 1) return(' ');
272 if (no == 2) return('ø');
273 return(0);
274}
275
276static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
277}
278
Daniel Veillard3d97e662004-11-04 10:49:00 +0000279#define gen_nb_unsigned_int 3
280
281static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000282 if (no == 0) return(0);
283 if (no == 1) return(1);
284 if (no == 2) return(122);
285 return(-1);
286}
287
Daniel Veillard3d97e662004-11-04 10:49:00 +0000288static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000289}
290
Daniel Veillard3d95c732004-11-06 22:25:14 +0000291#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000292
293static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
294 if (no == 0) return(0);
295 if (no == 1) return(1);
296 if (no == 2) return(122);
297 return(-1);
298}
299
300static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
301}
302
Daniel Veillard3d95c732004-11-06 22:25:14 +0000303#define gen_nb_double 4
304
305static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
306 if (no == 0) return(0);
307 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000308#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000309 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000310#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311 return(-1);
312}
313
314static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
315}
316
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000317#define gen_nb_unsigned_long_ptr 2
318
319static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
320 if (no == 0) return(&longtab[nr]);
321 return(NULL);
322}
323
324static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
325}
326
327#define gen_nb_int_ptr 2
328
329static int *gen_int_ptr(int no, int nr) {
330 if (no == 0) return(&inttab[nr]);
331 return(NULL);
332}
333
334static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
335}
336
Daniel Veillardd93f6252004-11-02 15:53:51 +0000337#define gen_nb_const_char_ptr 4
338
Daniel Veillardce682bc2004-11-05 17:22:25 +0000339static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
340 if (no == 0) return((char *) "foo");
341 if (no == 1) return((char *) "<foo/>");
342 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000343 return(NULL);
344}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000345static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000346}
347
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000348#define gen_nb_xmlChar_ptr 2
349
Daniel Veillard3d97e662004-11-04 10:49:00 +0000350static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000351 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000352 return(NULL);
353}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000354static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000355}
356
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000357#define gen_nb_FILE_ptr 2
358
359static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
360 if (no == 0) return(fopen("test.out", "a+"));
361 return(NULL);
362}
363static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
364 if (val != NULL) fclose(val);
365}
366
Daniel Veillarda82b1822004-11-08 16:24:57 +0000367#define gen_nb_debug_FILE_ptr 2
368static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
369 return(fopen("test.out", "a+"));
370}
371static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillardd93f6252004-11-02 15:53:51 +0000375#define gen_nb_const_xmlChar_ptr 5
376
Daniel Veillardce682bc2004-11-05 17:22:25 +0000377static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
378 if (no == 0) return((xmlChar *) "foo");
379 if (no == 1) return((xmlChar *) "<foo/>");
380 if (no == 2) return((xmlChar *) "nøne");
381 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000382 return(NULL);
383}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000384static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000385}
386
387#define gen_nb_filepath 8
388
Daniel Veillard3d97e662004-11-04 10:49:00 +0000389static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 if (no == 0) return("missing.xml");
391 if (no == 1) return("<foo/>");
392 if (no == 2) return("test/ent2");
393 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000394 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000395 if (no == 5) return("http://missing.example.org/");
396 if (no == 6) return("http://missing. example.org/");
397 return(NULL);
398}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000399static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000400}
401
Daniel Veillard27f20102004-11-05 11:50:11 +0000402#define gen_nb_eaten_name 2
403
404static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000405 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000406 return(NULL);
407}
408static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
409}
410
Daniel Veillardd93f6252004-11-02 15:53:51 +0000411#define gen_nb_fileoutput 6
412
Daniel Veillard3d97e662004-11-04 10:49:00 +0000413static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000414 if (no == 0) return("/missing.xml");
415 if (no == 1) return("<foo/>");
416 if (no == 2) return("ftp://missing.example.org/foo");
417 if (no == 3) return("http://missing.example.org/");
418 if (no == 4) return("http://missing. example.org/");
419 return(NULL);
420}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422}
423
Daniel Veillarda521d282004-11-09 14:59:59 +0000424#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000425static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000426 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000427 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000428 return(NULL);
429}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000430static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000431 if (val != NULL)
432 xmlFreeParserCtxt(val);
433}
434
Daniel Veillard34099b42004-11-04 17:34:35 +0000435#define gen_nb_xmlSAXHandlerPtr 2
436static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000437#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000438 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000439#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000440 return(NULL);
441}
442static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
443}
444
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000445#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000446static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000448 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000449#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000450 return(NULL);
451}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000452static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000453#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000454 if (val != NULL)
455 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000456#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000457}
458
Daniel Veillard34099b42004-11-04 17:34:35 +0000459#define gen_nb_xmlParserInputBufferPtr 8
460
461static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
462 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
463 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
464 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
465 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
466 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
467 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
468 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
469 return(NULL);
470}
471static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
472 xmlFreeParserInputBuffer(val);
473}
474
Daniel Veillardd93f6252004-11-02 15:53:51 +0000475#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000476static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000477 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
478 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
479 return(NULL);
480}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000481static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000482 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483 xmlFreeDoc(val);
484}
485
Daniel Veillardce244ad2004-11-05 10:03:46 +0000486#define gen_nb_xmlAttrPtr 2
487static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
488 if (no == 0) return(get_api_attr());
489 return(NULL);
490}
491static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
492 if (no == 0) free_api_doc();
493}
494
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000495#define gen_nb_xmlDictPtr 2
496static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
497 if (no == 0) return(xmlDictCreate());
498 return(NULL);
499}
500static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
501 if (val != NULL)
502 xmlDictFree(val);
503}
504
Daniel Veillardce244ad2004-11-05 10:03:46 +0000505#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000506static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000507 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000508 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000509 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000510/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000511}
Daniel Veillard27f20102004-11-05 11:50:11 +0000512static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513 if (no == 1) free_api_doc();
514 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 xmlUnlinkNode(val);
516 xmlFreeNode(val);
517 }
518}
519
Daniel Veillard27f20102004-11-05 11:50:11 +0000520#define gen_nb_xmlDtdPtr 3
521static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000522 if (no == 0)
523 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000524 if (no == 1) return(get_api_dtd());
525 return(NULL);
526}
527static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
528 if (no == 1) free_api_doc();
529 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 xmlUnlinkNode((xmlNodePtr) val);
531 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 }
533}
534
535#define gen_nb_xmlNsPtr 2
536static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
537 if (no == 0) return(get_api_ns());
538 return(NULL);
539}
540static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
541 if (no == 0) free_api_doc();
542}
543
Daniel Veillardd93f6252004-11-02 15:53:51 +0000544#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000545static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000546 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
547 if (no == 0) return(xmlNewText(BAD_CAST "text"));
548 return(NULL);
549}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000550static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000551}
552
Daniel Veillardc8311492004-11-08 16:51:13 +0000553#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000554#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000555static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000556 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
557 return(NULL);
558}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000559static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000560 if (val != NULL) xmlFreeTextWriter(val);
561}
Daniel Veillardc8311492004-11-08 16:51:13 +0000562#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000563
Daniel Veillardc8311492004-11-08 16:51:13 +0000564#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000565#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000567 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
568 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
569 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
570 return(NULL);
571}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000572static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573 if (val != NULL) xmlFreeTextReader(val);
574}
Daniel Veillardc8311492004-11-08 16:51:13 +0000575#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000576
Daniel Veillard34099b42004-11-04 17:34:35 +0000577#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000578static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000579 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000580 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000581 return(NULL);
582}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000583static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000584 if (val != NULL) {
585 xmlBufferFree(val);
586 }
587}
588
589#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000590static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000591 if (no == 0) return(xmlListCreate(NULL, NULL));
592 return(NULL);
593}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000594static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000595 if (val != NULL) {
596 xmlListDelete(val);
597 }
598}
599
600#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000601static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000602 if (no == 0) return(xmlHashCreate(10));
603 return(NULL);
604}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000605static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000606 if (val != NULL) {
607 xmlHashFree(val, NULL);
608 }
609}
610
611#include <libxml/xpathInternals.h>
612
Daniel Veillardc8311492004-11-08 16:51:13 +0000613#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000615static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000616 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
617 if (no == 1) return(xmlXPathNewFloat(1.1));
618 if (no == 2) return(xmlXPathNewBoolean(1));
619 if (no == 3) return(xmlXPathNewNodeSet(NULL));
620 return(NULL);
621}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000622static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000623 if (val != NULL) {
624 xmlXPathFreeObject(val);
625 }
626}
Daniel Veillardc8311492004-11-08 16:51:13 +0000627#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000628
Daniel Veillardc8311492004-11-08 16:51:13 +0000629#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630#define gen_nb_xmlOutputBufferPtr 2
631static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
632 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
633 return(NULL);
634}
635static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
636 if (val != NULL) {
637 xmlOutputBufferClose(val);
638 }
639}
Daniel Veillardc8311492004-11-08 16:51:13 +0000640#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000641
Daniel Veillardc8311492004-11-08 16:51:13 +0000642#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000643#define gen_nb_xmlNanoFTPCtxtPtr 4
644static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
645 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
646 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
647 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
648 return(NULL);
649}
650static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
651 if (val != NULL) {
652 xmlNanoFTPFreeCtxt(val);
653 }
654}
Daniel Veillardc8311492004-11-08 16:51:13 +0000655#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000656
Daniel Veillardc8311492004-11-08 16:51:13 +0000657#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000658#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000659static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000660 return(NULL);
661}
662static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
663}
Daniel Veillardc8311492004-11-08 16:51:13 +0000664#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000665
Daniel Veillard3d97e662004-11-04 10:49:00 +0000666#define gen_nb_xmlCharEncoding 4
667static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
669 if (no == 1) return(XML_CHAR_ENCODING_NONE);
670 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
671 return(XML_CHAR_ENCODING_ERROR);
672}
673static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
674}
675
Daniel Veillard42595322004-11-08 10:52:06 +0000676#define gen_nb_xmlHashDeallocator 2
677static void
678test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
679}
680
681static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(test_xmlHashDeallocator);
683 return(NULL);
684}
685static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
686}
687
Daniel Veillardd93f6252004-11-02 15:53:51 +0000688
689static void desret_int(int val ATTRIBUTE_UNUSED) {
690}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000691static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
692}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000693static void desret_long(long val ATTRIBUTE_UNUSED) {
694}
William M. Brack094dd862004-11-14 14:28:34 +0000695static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
696}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000697static void desret_double(double val ATTRIBUTE_UNUSED) {
698}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000699static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
700}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000701#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000702static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
703}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000704#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000705static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
706}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000707static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
708}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000709static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000711static void desret_xmlChar_ptr(xmlChar *val) {
712 if (val != NULL)
713 xmlFree(val);
714}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000715static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000716 if (val != api_doc)
717 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000718}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000719static void desret_xmlDictPtr(xmlDictPtr val) {
720 xmlDictFree(val);
721}
Daniel Veillardc8311492004-11-08 16:51:13 +0000722#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000723static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
724 xmlOutputBufferClose(val);
725}
Daniel Veillardc8311492004-11-08 16:51:13 +0000726#endif
727#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000728static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
729 xmlFreeTextReader(val);
730}
Daniel Veillardc8311492004-11-08 16:51:13 +0000731#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000733 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
734 xmlUnlinkNode(val);
735 xmlFreeNode(val);
736 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000737}
Daniel Veillard57b25162004-11-06 14:50:18 +0000738static void desret_xmlAttrPtr(xmlAttrPtr val) {
739 if (val != NULL) {
740 xmlUnlinkNode((xmlNodePtr) val);
741 xmlFreeNode((xmlNodePtr) val);
742 }
743}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000744static void desret_xmlEntityPtr(xmlEntityPtr val) {
745 if (val != NULL) {
746 xmlUnlinkNode((xmlNodePtr) val);
747 xmlFreeNode((xmlNodePtr) val);
748 }
749}
Daniel Veillard42595322004-11-08 10:52:06 +0000750static void desret_xmlElementPtr(xmlElementPtr val) {
751 if (val != NULL) {
752 xmlUnlinkNode((xmlNodePtr) val);
753 }
754}
755static void desret_xmlAttributePtr(xmlAttributePtr val) {
756 if (val != NULL) {
757 xmlUnlinkNode((xmlNodePtr) val);
758 }
759}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000760static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
761}
Daniel Veillard34099b42004-11-04 17:34:35 +0000762static void desret_xmlDtdPtr(xmlDtdPtr val) {
763 desret_xmlNodePtr((xmlNodePtr)val);
764}
Daniel Veillardc8311492004-11-08 16:51:13 +0000765#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000766static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000767 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000768}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000769static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
770 xmlXPathFreeNodeSet(val);
771}
Daniel Veillardc8311492004-11-08 16:51:13 +0000772#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000773static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
774 xmlFreeParserCtxt(val);
775}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000776static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
777 xmlFreeParserInputBuffer(val);
778}
Daniel Veillard42595322004-11-08 10:52:06 +0000779static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
780 xmlFreeInputStream(val);
781}
Daniel Veillardc8311492004-11-08 16:51:13 +0000782#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000783static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
784 xmlFreeTextWriter(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000787static void desret_xmlBufferPtr(xmlBufferPtr val) {
788 xmlBufferFree(val);
789}
Daniel Veillardc8311492004-11-08 16:51:13 +0000790#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000791static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
792 xmlSchemaFreeParserCtxt(val);
793}
794static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
795}
796static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
797 xmlRelaxNGFreeParserCtxt(val);
798}
Daniel Veillardc8311492004-11-08 16:51:13 +0000799#endif
800#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000801static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000802}
Daniel Veillardc8311492004-11-08 16:51:13 +0000803#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000804
Daniel Veillarda521d282004-11-09 14:59:59 +0000805/* cut and pasted from autogenerated to avoid troubles */
806#define gen_nb_const_xmlChar_ptr_ptr 1
807static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
808 return(NULL);
809}
810static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
811}
812
813#define gen_nb_unsigned_char_ptr 1
814static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
815 return(NULL);
816}
817static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
818}
819
820#define gen_nb_const_unsigned_char_ptr 1
821static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
822 return(NULL);
823}
824static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
825}
826
827#ifdef LIBXML_HTML_ENABLED
828#define gen_nb_const_htmlNodePtr 1
829static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
830 return(NULL);
831}
832static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
833}
834#endif
835
836#ifdef LIBXML_HTML_ENABLED
837#define gen_nb_htmlDocPtr 3
838static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839 if (no == 0) return(htmlNewDoc(NULL, NULL));
840 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
841 return(NULL);
842}
843static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
844 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
845 xmlFreeDoc(val);
846}
847static void desret_htmlDocPtr(htmlDocPtr val) {
848 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
849 xmlFreeDoc(val);
850}
851#define gen_nb_htmlParserCtxtPtr 3
852static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
853 if (no == 0) return(xmlNewParserCtxt());
854 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
855 return(NULL);
856}
857static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
858 if (val != NULL)
859 htmlFreeParserCtxt(val);
860}
861static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
862 if (val != NULL)
863 htmlFreeParserCtxt(val);
864}
865#endif
866
867#ifdef LIBXML_XPATH_ENABLED
868#define gen_nb_xmlNodeSetPtr 1
869static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
870 return(NULL);
871}
872static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
873}
874#endif
875
876#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000877#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000878#define gen_nb_xmlShellCtxtPtr 1
879static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
880 return(NULL);
881}
882static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
883}
884#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000885#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000886
887#ifdef LIBXML_PATTERN_ENABLED
888#define gen_nb_xmlPatternPtr 1
889static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
890 return(NULL);
891}
892static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
893}
894#endif
895
William M. Brack094dd862004-11-14 14:28:34 +0000896#define gen_nb_xmlElementContentPtr 1
897static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
898 return(NULL);
899}
900static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
901 if (val != NULL)
902 xmlFreeElementContent(val);
903}
904static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
905 if (val != NULL)
906 xmlFreeElementContent(val);
907}
908
909#define gen_nb_xmlParserNodeInfoSeqPtr 1
910static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915
916static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
917}
918
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000919/************************************************************************
920 * *
921 * WARNING: end of the manually maintained part of the test code *
922 * do not remove or alter the CUT HERE line *
923 * *
924 ************************************************************************/
925
Daniel Veillard34099b42004-11-04 17:34:35 +0000926/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000927#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000928static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
929}
930
Daniel Veillarda521d282004-11-09 14:59:59 +0000931#endif
932
Daniel Veillard57b25162004-11-06 14:50:18 +0000933#define gen_nb_xmlAttributeDefault 4
934static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
935 if (no == 1) return(XML_ATTRIBUTE_FIXED);
936 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
937 if (no == 3) return(XML_ATTRIBUTE_NONE);
938 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
939 return(0);
940}
William M. Brack094dd862004-11-14 14:28:34 +0000941
Daniel Veillard57b25162004-11-06 14:50:18 +0000942static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
943}
Daniel Veillard57b25162004-11-06 14:50:18 +0000944
945#define gen_nb_xmlAttributeType 4
946static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
947 if (no == 1) return(XML_ATTRIBUTE_CDATA);
948 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
949 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
950 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
951 return(0);
952}
William M. Brack094dd862004-11-14 14:28:34 +0000953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
955}
Daniel Veillard57b25162004-11-06 14:50:18 +0000956
957#define gen_nb_xmlBufferAllocationScheme 3
958static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
959 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
960 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
961 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
962 return(0);
963}
William M. Brack094dd862004-11-14 14:28:34 +0000964
Daniel Veillard57b25162004-11-06 14:50:18 +0000965static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
966}
William M. Brack094dd862004-11-14 14:28:34 +0000967
Daniel Veillard57b25162004-11-06 14:50:18 +0000968static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
969}
970
Daniel Veillarda521d282004-11-09 14:59:59 +0000971#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000972#define gen_nb_xmlCatalogAllow 4
973static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
974 if (no == 1) return(XML_CATA_ALLOW_ALL);
975 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
976 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
977 if (no == 4) return(XML_CATA_ALLOW_NONE);
978 return(0);
979}
William M. Brack094dd862004-11-14 14:28:34 +0000980
Daniel Veillard57b25162004-11-06 14:50:18 +0000981static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
982}
William M. Brack094dd862004-11-14 14:28:34 +0000983
Daniel Veillard57b25162004-11-06 14:50:18 +0000984static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
985}
986
Daniel Veillarda521d282004-11-09 14:59:59 +0000987#endif
988
989#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000990#define gen_nb_xmlCatalogPrefer 3
991static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
992 if (no == 1) return(XML_CATA_PREFER_NONE);
993 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
994 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
995 return(0);
996}
William M. Brack094dd862004-11-14 14:28:34 +0000997
Daniel Veillard57b25162004-11-06 14:50:18 +0000998static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
999}
William M. Brack094dd862004-11-14 14:28:34 +00001000
Daniel Veillard57b25162004-11-06 14:50:18 +00001001static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1002}
1003
Daniel Veillarda521d282004-11-09 14:59:59 +00001004#endif
1005
Daniel Veillard57b25162004-11-06 14:50:18 +00001006#define gen_nb_xmlElementContentType 4
1007static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1008 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1009 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1010 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1011 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1012 return(0);
1013}
Daniel Veillard57b25162004-11-06 14:50:18 +00001014
William M. Brack094dd862004-11-14 14:28:34 +00001015static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001016}
1017
1018#define gen_nb_xmlElementTypeVal 4
1019static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1020 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1021 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1022 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1023 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1024 return(0);
1025}
William M. Brack094dd862004-11-14 14:28:34 +00001026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1028}
Daniel Veillard57b25162004-11-06 14:50:18 +00001029
Daniel Veillard57b25162004-11-06 14:50:18 +00001030static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1031}
1032
Daniel Veillarda521d282004-11-09 14:59:59 +00001033#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001034#define gen_nb_xmlSchemaValType 4
1035static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1036 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1037 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1038 if (no == 3) return(XML_SCHEMAS_ANYURI);
1039 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1040 return(0);
1041}
William M. Brack094dd862004-11-14 14:28:34 +00001042
Daniel Veillard57b25162004-11-06 14:50:18 +00001043static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1044}
Daniel Veillard57b25162004-11-06 14:50:18 +00001045
Daniel Veillarda521d282004-11-09 14:59:59 +00001046#endif
1047
Daniel Veillard34099b42004-11-04 17:34:35 +00001048#include <libxml/HTMLparser.h>
1049#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001050#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001051#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001052#include <libxml/catalog.h>
1053#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001054#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001055#include <libxml/dict.h>
1056#include <libxml/encoding.h>
1057#include <libxml/entities.h>
1058#include <libxml/hash.h>
1059#include <libxml/list.h>
1060#include <libxml/nanoftp.h>
1061#include <libxml/nanohttp.h>
1062#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001063#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001064#include <libxml/pattern.h>
1065#include <libxml/relaxng.h>
1066#include <libxml/schemasInternals.h>
1067#include <libxml/tree.h>
1068#include <libxml/uri.h>
1069#include <libxml/valid.h>
1070#include <libxml/xinclude.h>
1071#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001072#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001073#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001074#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001075#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001076#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001077#include <libxml/xmlsave.h>
1078#include <libxml/xmlschemas.h>
1079#include <libxml/xmlschemastypes.h>
1080#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001081#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001082#include <libxml/xmlwriter.h>
1083#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001084#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001085#include <libxml/xpointer.h>
1086static int test_HTMLparser(void);
1087static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001088static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001089static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001090static int test_catalog(void);
1091static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001092static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001093static int test_dict(void);
1094static int test_encoding(void);
1095static int test_entities(void);
1096static int test_hash(void);
1097static int test_list(void);
1098static int test_nanoftp(void);
1099static int test_nanohttp(void);
1100static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001101static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001102static int test_pattern(void);
1103static int test_relaxng(void);
1104static int test_schemasInternals(void);
1105static int test_tree(void);
1106static int test_uri(void);
1107static int test_valid(void);
1108static int test_xinclude(void);
1109static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001110static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001111static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001112static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001113static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001114static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001115static int test_xmlsave(void);
1116static int test_xmlschemas(void);
1117static int test_xmlschemastypes(void);
1118static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001119static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001120static int test_xmlwriter(void);
1121static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001122static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001123static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001124
1125/**
1126 * testlibxml2:
1127 *
1128 * Main entry point of the tester for the full libxml2 module,
1129 * it calls all the tester entry point for each module.
1130 *
1131 * Returns the number of error found
1132 */
1133static int
1134testlibxml2(void)
1135{
Daniel Veillard42595322004-11-08 10:52:06 +00001136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001137
Daniel Veillard42595322004-11-08 10:52:06 +00001138 test_ret += test_HTMLparser();
1139 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001140 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001141 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001142 test_ret += test_catalog();
1143 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001144 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001145 test_ret += test_dict();
1146 test_ret += test_encoding();
1147 test_ret += test_entities();
1148 test_ret += test_hash();
1149 test_ret += test_list();
1150 test_ret += test_nanoftp();
1151 test_ret += test_nanohttp();
1152 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001153 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001154 test_ret += test_pattern();
1155 test_ret += test_relaxng();
1156 test_ret += test_schemasInternals();
1157 test_ret += test_tree();
1158 test_ret += test_uri();
1159 test_ret += test_valid();
1160 test_ret += test_xinclude();
1161 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001162 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001163 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001164 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001165 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001166 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001167 test_ret += test_xmlsave();
1168 test_ret += test_xmlschemas();
1169 test_ret += test_xmlschemastypes();
1170 test_ret += test_xmlstring();
1171 test_ret += test_xmlunicode();
1172 test_ret += test_xmlwriter();
1173 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001174 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001175 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001176
Daniel Veillard3d97e662004-11-04 10:49:00 +00001177 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001178 function_tests, call_tests, test_ret);
1179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001180}
1181
1182
1183static int
1184test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001186
William M. Brack21e4ef22005-01-02 09:53:13 +00001187#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001188 int mem_base;
1189 int ret_val;
1190 unsigned char * out; /* a pointer to an array of bytes to store the result */
1191 int n_out;
1192 int * outlen; /* the length of @out */
1193 int n_outlen;
1194 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1195 int n_in;
1196 int * inlen; /* the length of @in */
1197 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001198
Daniel Veillardce682bc2004-11-05 17:22:25 +00001199 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1200 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1201 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1202 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1203 mem_base = xmlMemBlocks();
1204 out = gen_unsigned_char_ptr(n_out, 0);
1205 outlen = gen_int_ptr(n_outlen, 1);
1206 in = gen_const_unsigned_char_ptr(n_in, 2);
1207 inlen = gen_int_ptr(n_inlen, 3);
1208
William M. Brackf13f77f2004-11-12 16:03:48 +00001209 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001210 desret_int(ret_val);
1211 call_tests++;
1212 des_unsigned_char_ptr(n_out, out, 0);
1213 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001214 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001215 des_int_ptr(n_inlen, inlen, 3);
1216 xmlResetLastError();
1217 if (mem_base != xmlMemBlocks()) {
1218 printf("Leak of %d blocks found in UTF8ToHtml",
1219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001220 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001221 printf(" %d", n_out);
1222 printf(" %d", n_outlen);
1223 printf(" %d", n_in);
1224 printf(" %d", n_inlen);
1225 printf("\n");
1226 }
1227 }
1228 }
1229 }
1230 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001231 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001232#endif
1233
Daniel Veillard42595322004-11-08 10:52:06 +00001234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001235}
1236
Daniel Veillarda521d282004-11-09 14:59:59 +00001237#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001238
Daniel Veillardce682bc2004-11-05 17:22:25 +00001239#define gen_nb_const_htmlElemDesc_ptr 1
1240static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1241 return(NULL);
1242}
1243static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1244}
Daniel Veillarda521d282004-11-09 14:59:59 +00001245#endif
1246
Daniel Veillardce682bc2004-11-05 17:22:25 +00001247
Daniel Veillardd93f6252004-11-02 15:53:51 +00001248static int
1249test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001251
William M. Brack21e4ef22005-01-02 09:53:13 +00001252#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001253 int mem_base;
1254 htmlStatus ret_val;
1255 htmlElemDesc * elt; /* HTML element */
1256 int n_elt;
1257 xmlChar * attr; /* HTML attribute */
1258 int n_attr;
1259 int legacy; /* whether to allow deprecated attributes */
1260 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001261
Daniel Veillard57b25162004-11-06 14:50:18 +00001262 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1263 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1264 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1265 mem_base = xmlMemBlocks();
1266 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1267 attr = gen_const_xmlChar_ptr(n_attr, 1);
1268 legacy = gen_int(n_legacy, 2);
1269
William M. Brackf13f77f2004-11-12 16:03:48 +00001270 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001271 desret_htmlStatus(ret_val);
1272 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001273 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1274 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001275 des_int(n_legacy, legacy, 2);
1276 xmlResetLastError();
1277 if (mem_base != xmlMemBlocks()) {
1278 printf("Leak of %d blocks found in htmlAttrAllowed",
1279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001280 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001281 printf(" %d", n_elt);
1282 printf(" %d", n_attr);
1283 printf(" %d", n_legacy);
1284 printf("\n");
1285 }
1286 }
1287 }
1288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001289 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001290#endif
1291
Daniel Veillard42595322004-11-08 10:52:06 +00001292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001293}
1294
Daniel Veillarda521d282004-11-09 14:59:59 +00001295#ifdef LIBXML_HTML_ENABLED
1296
1297#define gen_nb_htmlNodePtr 1
1298static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1299 return(NULL);
1300}
1301static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1302}
1303#endif
1304
Daniel Veillardd93f6252004-11-02 15:53:51 +00001305
1306static int
1307test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001309
William M. Brack21e4ef22005-01-02 09:53:13 +00001310#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001311 int mem_base;
1312 int ret_val;
1313 htmlDocPtr doc; /* the HTML document */
1314 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001315 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001316 int n_name;
1317 htmlNodePtr elem; /* the HTML element */
1318 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001319
Daniel Veillarda521d282004-11-09 14:59:59 +00001320 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001321 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001322 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001323 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001324 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001325 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001326 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001327
William M. Brackf13f77f2004-11-12 16:03:48 +00001328 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001329 desret_int(ret_val);
1330 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001331 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001332 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001333 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001334 xmlResetLastError();
1335 if (mem_base != xmlMemBlocks()) {
1336 printf("Leak of %d blocks found in htmlAutoCloseTag",
1337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001338 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001339 printf(" %d", n_doc);
1340 printf(" %d", n_name);
1341 printf(" %d", n_elem);
1342 printf("\n");
1343 }
1344 }
1345 }
1346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001347 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001348#endif
1349
Daniel Veillard42595322004-11-08 10:52:06 +00001350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001351}
1352
1353
1354static int
1355test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001357
William M. Brack21e4ef22005-01-02 09:53:13 +00001358#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001359 int mem_base;
1360 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001361 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001362 int n_buffer;
1363 int size; /* the size of the array */
1364 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001365
Daniel Veillard34099b42004-11-04 17:34:35 +00001366 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1367 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1368 mem_base = xmlMemBlocks();
1369 buffer = gen_const_char_ptr(n_buffer, 0);
1370 size = gen_int(n_size, 1);
1371
William M. Brackf13f77f2004-11-12 16:03:48 +00001372 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001373 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001374 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001375 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001376 des_int(n_size, size, 1);
1377 xmlResetLastError();
1378 if (mem_base != xmlMemBlocks()) {
1379 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001381 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001382 printf(" %d", n_buffer);
1383 printf(" %d", n_size);
1384 printf("\n");
1385 }
1386 }
1387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001388 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001389#endif
1390
Daniel Veillard42595322004-11-08 10:52:06 +00001391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001392}
1393
Daniel Veillarda521d282004-11-09 14:59:59 +00001394#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001395
Daniel Veillardce682bc2004-11-05 17:22:25 +00001396#define gen_nb_htmlSAXHandlerPtr 1
1397static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1398 return(NULL);
1399}
1400static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1401}
Daniel Veillarda521d282004-11-09 14:59:59 +00001402#endif
1403
Daniel Veillardce682bc2004-11-05 17:22:25 +00001404
Daniel Veillardd93f6252004-11-02 15:53:51 +00001405static int
1406test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001408
William M. Brack21e4ef22005-01-02 09:53:13 +00001409#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001410 int mem_base;
1411 htmlParserCtxtPtr ret_val;
1412 htmlSAXHandlerPtr sax; /* a SAX handler */
1413 int n_sax;
1414 void * user_data; /* The user data returned on SAX callbacks */
1415 int n_user_data;
1416 char * chunk; /* a pointer to an array of chars */
1417 int n_chunk;
1418 int size; /* number of chars in the array */
1419 int n_size;
1420 const char * filename; /* an optional file name or URI */
1421 int n_filename;
1422 xmlCharEncoding enc; /* an optional encoding */
1423 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001424
Daniel Veillardce682bc2004-11-05 17:22:25 +00001425 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1426 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1427 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1428 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001429 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001430 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1431 mem_base = xmlMemBlocks();
1432 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1433 user_data = gen_userdata(n_user_data, 1);
1434 chunk = gen_const_char_ptr(n_chunk, 2);
1435 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001436 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001437 enc = gen_xmlCharEncoding(n_enc, 5);
1438
William M. Brackf13f77f2004-11-12 16:03:48 +00001439 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001440 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001441 call_tests++;
1442 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1443 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001444 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001445 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001446 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001447 des_xmlCharEncoding(n_enc, enc, 5);
1448 xmlResetLastError();
1449 if (mem_base != xmlMemBlocks()) {
1450 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001452 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001453 printf(" %d", n_sax);
1454 printf(" %d", n_user_data);
1455 printf(" %d", n_chunk);
1456 printf(" %d", n_size);
1457 printf(" %d", n_filename);
1458 printf(" %d", n_enc);
1459 printf("\n");
1460 }
1461 }
1462 }
1463 }
1464 }
1465 }
1466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001467 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001468#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001469
Daniel Veillard42595322004-11-08 10:52:06 +00001470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001471}
1472
1473
1474static int
1475test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001477
William M. Brack21e4ef22005-01-02 09:53:13 +00001478#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001479 int mem_base;
1480 htmlDocPtr ret_val;
1481 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1482 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001483 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001484 int n_cur;
1485 const char * URL; /* the base URL to use for the document */
1486 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001487 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001488 int n_encoding;
1489 int options; /* a combination of htmlParserOption(s) */
1490 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001491
Daniel Veillarda521d282004-11-09 14:59:59 +00001492 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001493 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1494 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1495 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1496 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1497 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001498 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001499 cur = gen_const_xmlChar_ptr(n_cur, 1);
1500 URL = gen_filepath(n_URL, 2);
1501 encoding = gen_const_char_ptr(n_encoding, 3);
1502 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001503
William M. Brackf13f77f2004-11-12 16:03:48 +00001504 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001505 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001506 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001507 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001508 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001509 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001510 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001511 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001512 xmlResetLastError();
1513 if (mem_base != xmlMemBlocks()) {
1514 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001517 printf(" %d", n_ctxt);
1518 printf(" %d", n_cur);
1519 printf(" %d", n_URL);
1520 printf(" %d", n_encoding);
1521 printf(" %d", n_options);
1522 printf("\n");
1523 }
1524 }
1525 }
1526 }
1527 }
1528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001529 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001530#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001531
Daniel Veillard42595322004-11-08 10:52:06 +00001532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001533}
1534
1535
1536static int
1537test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001539
William M. Brack21e4ef22005-01-02 09:53:13 +00001540#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001541 htmlDocPtr ret_val;
1542 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1543 int n_ctxt;
1544 const char * filename; /* a file or URL */
1545 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001546 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001547 int n_encoding;
1548 int options; /* a combination of htmlParserOption(s) */
1549 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001550
Daniel Veillarda521d282004-11-09 14:59:59 +00001551 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001552 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1553 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1554 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001555 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001556 filename = gen_filepath(n_filename, 1);
1557 encoding = gen_const_char_ptr(n_encoding, 2);
1558 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001559
William M. Brackf13f77f2004-11-12 16:03:48 +00001560 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001561 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001562 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001563 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001564 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001565 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001566 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001567 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001568 }
1569 }
1570 }
1571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001572 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001573#endif
1574
Daniel Veillard42595322004-11-08 10:52:06 +00001575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001576}
1577
1578
1579static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001580test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001582
William M. Brack21e4ef22005-01-02 09:53:13 +00001583#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001584 int mem_base;
1585 htmlDocPtr ret_val;
1586 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1587 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001588 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001589 int n_buffer;
1590 int size; /* the size of the array */
1591 int n_size;
1592 const char * URL; /* the base URL to use for the document */
1593 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001594 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001595 int n_encoding;
1596 int options; /* a combination of htmlParserOption(s) */
1597 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001598
Daniel Veillarda521d282004-11-09 14:59:59 +00001599 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001600 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1601 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1602 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1603 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1604 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1605 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001606 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001607 buffer = gen_const_char_ptr(n_buffer, 1);
1608 size = gen_int(n_size, 2);
1609 URL = gen_filepath(n_URL, 3);
1610 encoding = gen_const_char_ptr(n_encoding, 4);
1611 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001612
William M. Brackf13f77f2004-11-12 16:03:48 +00001613 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001614 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001615 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001616 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001617 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001618 des_int(n_size, size, 2);
1619 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001620 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001621 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001622 xmlResetLastError();
1623 if (mem_base != xmlMemBlocks()) {
1624 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001626 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001627 printf(" %d", n_ctxt);
1628 printf(" %d", n_buffer);
1629 printf(" %d", n_size);
1630 printf(" %d", n_URL);
1631 printf(" %d", n_encoding);
1632 printf(" %d", n_options);
1633 printf("\n");
1634 }
1635 }
1636 }
1637 }
1638 }
1639 }
1640 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001641 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001642#endif
1643
Daniel Veillard42595322004-11-08 10:52:06 +00001644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001645}
1646
1647
1648static int
1649test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001651
William M. Brack21e4ef22005-01-02 09:53:13 +00001652#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001653 int mem_base;
1654 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1655 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001656
Daniel Veillarda521d282004-11-09 14:59:59 +00001657 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001658 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001659 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001660
1661 htmlCtxtReset(ctxt);
1662 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001663 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001664 xmlResetLastError();
1665 if (mem_base != xmlMemBlocks()) {
1666 printf("Leak of %d blocks found in htmlCtxtReset",
1667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001668 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001669 printf(" %d", n_ctxt);
1670 printf("\n");
1671 }
1672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001673 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001674#endif
1675
Daniel Veillard42595322004-11-08 10:52:06 +00001676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001677}
1678
1679
1680static int
1681test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001683
William M. Brack21e4ef22005-01-02 09:53:13 +00001684#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001685 int mem_base;
1686 int ret_val;
1687 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1688 int n_ctxt;
1689 int options; /* a combination of htmlParserOption(s) */
1690 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001691
Daniel Veillarda521d282004-11-09 14:59:59 +00001692 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001693 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1694 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001695 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001696 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001697
1698 ret_val = htmlCtxtUseOptions(ctxt, options);
1699 desret_int(ret_val);
1700 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001701 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001702 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001703 xmlResetLastError();
1704 if (mem_base != xmlMemBlocks()) {
1705 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001707 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001708 printf(" %d", n_ctxt);
1709 printf(" %d", n_options);
1710 printf("\n");
1711 }
1712 }
1713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001714 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001715#endif
1716
Daniel Veillard42595322004-11-08 10:52:06 +00001717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001718}
1719
1720
1721static int
1722test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001724
William M. Brack21e4ef22005-01-02 09:53:13 +00001725#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001726 int mem_base;
1727 int ret_val;
1728 htmlElemDesc * parent; /* HTML parent element */
1729 int n_parent;
1730 xmlChar * elt; /* HTML element */
1731 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001732
Daniel Veillardce682bc2004-11-05 17:22:25 +00001733 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1734 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1735 mem_base = xmlMemBlocks();
1736 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1737 elt = gen_const_xmlChar_ptr(n_elt, 1);
1738
William M. Brackf13f77f2004-11-12 16:03:48 +00001739 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001740 desret_int(ret_val);
1741 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001742 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1743 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001744 xmlResetLastError();
1745 if (mem_base != xmlMemBlocks()) {
1746 printf("Leak of %d blocks found in htmlElementAllowedHere",
1747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001748 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001749 printf(" %d", n_parent);
1750 printf(" %d", n_elt);
1751 printf("\n");
1752 }
1753 }
1754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001755 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001756#endif
1757
Daniel Veillard42595322004-11-08 10:52:06 +00001758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001759}
1760
1761
1762static int
1763test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001765
William M. Brack21e4ef22005-01-02 09:53:13 +00001766#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001767 int mem_base;
1768 htmlStatus ret_val;
1769 htmlElemDesc * parent; /* HTML parent element */
1770 int n_parent;
1771 htmlElemDesc * elt; /* HTML element */
1772 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001773
Daniel Veillard57b25162004-11-06 14:50:18 +00001774 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1775 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1776 mem_base = xmlMemBlocks();
1777 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1778 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1779
William M. Brackf13f77f2004-11-12 16:03:48 +00001780 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001781 desret_htmlStatus(ret_val);
1782 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001783 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1784 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001785 xmlResetLastError();
1786 if (mem_base != xmlMemBlocks()) {
1787 printf("Leak of %d blocks found in htmlElementStatusHere",
1788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001789 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001790 printf(" %d", n_parent);
1791 printf(" %d", n_elt);
1792 printf("\n");
1793 }
1794 }
1795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001796 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001797#endif
1798
Daniel Veillard42595322004-11-08 10:52:06 +00001799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001800}
1801
1802
1803static int
1804test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001806
William M. Brack21e4ef22005-01-02 09:53:13 +00001807#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001808 int mem_base;
1809 int ret_val;
1810 unsigned char * out; /* a pointer to an array of bytes to store the result */
1811 int n_out;
1812 int * outlen; /* the length of @out */
1813 int n_outlen;
1814 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1815 int n_in;
1816 int * inlen; /* the length of @in */
1817 int n_inlen;
1818 int quoteChar; /* the quote character to escape (' or ") or zero. */
1819 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001820
Daniel Veillardce682bc2004-11-05 17:22:25 +00001821 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1822 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1823 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1824 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1825 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1826 mem_base = xmlMemBlocks();
1827 out = gen_unsigned_char_ptr(n_out, 0);
1828 outlen = gen_int_ptr(n_outlen, 1);
1829 in = gen_const_unsigned_char_ptr(n_in, 2);
1830 inlen = gen_int_ptr(n_inlen, 3);
1831 quoteChar = gen_int(n_quoteChar, 4);
1832
William M. Brackf13f77f2004-11-12 16:03:48 +00001833 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001834 desret_int(ret_val);
1835 call_tests++;
1836 des_unsigned_char_ptr(n_out, out, 0);
1837 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001838 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001839 des_int_ptr(n_inlen, inlen, 3);
1840 des_int(n_quoteChar, quoteChar, 4);
1841 xmlResetLastError();
1842 if (mem_base != xmlMemBlocks()) {
1843 printf("Leak of %d blocks found in htmlEncodeEntities",
1844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001845 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001846 printf(" %d", n_out);
1847 printf(" %d", n_outlen);
1848 printf(" %d", n_in);
1849 printf(" %d", n_inlen);
1850 printf(" %d", n_quoteChar);
1851 printf("\n");
1852 }
1853 }
1854 }
1855 }
1856 }
1857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001858 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001859#endif
1860
Daniel Veillard42595322004-11-08 10:52:06 +00001861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001862}
1863
1864
1865static int
1866test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001868
William M. Brack21e4ef22005-01-02 09:53:13 +00001869#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001870 int mem_base;
1871 const htmlEntityDesc * ret_val;
1872 xmlChar * name; /* the entity name */
1873 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001874
Daniel Veillard42595322004-11-08 10:52:06 +00001875 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1876 mem_base = xmlMemBlocks();
1877 name = gen_const_xmlChar_ptr(n_name, 0);
1878
William M. Brackf13f77f2004-11-12 16:03:48 +00001879 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001880 desret_const_htmlEntityDesc_ptr(ret_val);
1881 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001882 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001883 xmlResetLastError();
1884 if (mem_base != xmlMemBlocks()) {
1885 printf("Leak of %d blocks found in htmlEntityLookup",
1886 xmlMemBlocks() - mem_base);
1887 test_ret++;
1888 printf(" %d", n_name);
1889 printf("\n");
1890 }
1891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001892 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001893#endif
1894
Daniel Veillard42595322004-11-08 10:52:06 +00001895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001896}
1897
1898
1899static int
1900test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001902
William M. Brack21e4ef22005-01-02 09:53:13 +00001903#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001904 int mem_base;
1905 const htmlEntityDesc * ret_val;
1906 unsigned int value; /* the entity's unicode value */
1907 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001908
Daniel Veillard42595322004-11-08 10:52:06 +00001909 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1910 mem_base = xmlMemBlocks();
1911 value = gen_unsigned_int(n_value, 0);
1912
1913 ret_val = htmlEntityValueLookup(value);
1914 desret_const_htmlEntityDesc_ptr(ret_val);
1915 call_tests++;
1916 des_unsigned_int(n_value, value, 0);
1917 xmlResetLastError();
1918 if (mem_base != xmlMemBlocks()) {
1919 printf("Leak of %d blocks found in htmlEntityValueLookup",
1920 xmlMemBlocks() - mem_base);
1921 test_ret++;
1922 printf(" %d", n_value);
1923 printf("\n");
1924 }
1925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001926 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001927#endif
1928
Daniel Veillard42595322004-11-08 10:52:06 +00001929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001930}
1931
1932
1933static int
1934test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001936
William M. Brack21e4ef22005-01-02 09:53:13 +00001937#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001938 int mem_base;
1939 int ret_val;
1940 int val; /* int 0 or 1 */
1941 int n_val;
1942
1943 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001945 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001946
1947 ret_val = htmlHandleOmittedElem(val);
1948 desret_int(ret_val);
1949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001950 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001951 xmlResetLastError();
1952 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001953 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001955 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001956 printf(" %d", n_val);
1957 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001958 }
1959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001960 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001961#endif
1962
Daniel Veillard42595322004-11-08 10:52:06 +00001963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001964}
1965
1966
1967static int
1968test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001970
William M. Brack21e4ef22005-01-02 09:53:13 +00001971#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001972 int mem_base;
1973 int ret_val;
1974 htmlDocPtr doc; /* the HTML document */
1975 int n_doc;
1976 htmlNodePtr elem; /* the HTML element */
1977 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001978
Daniel Veillarda521d282004-11-09 14:59:59 +00001979 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
1980 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001981 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001982 doc = gen_htmlDocPtr(n_doc, 0);
1983 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001984
1985 ret_val = htmlIsAutoClosed(doc, elem);
1986 desret_int(ret_val);
1987 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001988 des_htmlDocPtr(n_doc, doc, 0);
1989 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001990 xmlResetLastError();
1991 if (mem_base != xmlMemBlocks()) {
1992 printf("Leak of %d blocks found in htmlIsAutoClosed",
1993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001994 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001995 printf(" %d", n_doc);
1996 printf(" %d", n_elem);
1997 printf("\n");
1998 }
1999 }
2000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002001 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002002#endif
2003
Daniel Veillard42595322004-11-08 10:52:06 +00002004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002005}
2006
2007
2008static int
2009test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002011
William M. Brack21e4ef22005-01-02 09:53:13 +00002012#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002013 int mem_base;
2014 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002015 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002016 int n_name;
2017
2018 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002020 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002021
William M. Brackf13f77f2004-11-12 16:03:48 +00002022 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002023 desret_int(ret_val);
2024 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002025 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002026 xmlResetLastError();
2027 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002028 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002031 printf(" %d", n_name);
2032 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002033 }
2034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002035 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002036#endif
2037
Daniel Veillard42595322004-11-08 10:52:06 +00002038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002039}
2040
2041
2042static int
2043test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002045
William M. Brack21e4ef22005-01-02 09:53:13 +00002046#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002047 int mem_base;
2048 htmlStatus ret_val;
2049 htmlNodePtr node; /* an htmlNodePtr in a tree */
2050 int n_node;
2051 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2052 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002053
Daniel Veillarda521d282004-11-09 14:59:59 +00002054 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002055 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2056 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002057 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002058 legacy = gen_int(n_legacy, 1);
2059
William M. Brackf13f77f2004-11-12 16:03:48 +00002060 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002061 desret_htmlStatus(ret_val);
2062 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002063 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002064 des_int(n_legacy, legacy, 1);
2065 xmlResetLastError();
2066 if (mem_base != xmlMemBlocks()) {
2067 printf("Leak of %d blocks found in htmlNodeStatus",
2068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002069 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002070 printf(" %d", n_node);
2071 printf(" %d", n_legacy);
2072 printf("\n");
2073 }
2074 }
2075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002076 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002077#endif
2078
Daniel Veillard42595322004-11-08 10:52:06 +00002079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002080}
2081
2082
2083static int
2084test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002086
William M. Brack21e4ef22005-01-02 09:53:13 +00002087#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002088 int mem_base;
2089 int ret_val;
2090 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2091 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002092
Daniel Veillarda521d282004-11-09 14:59:59 +00002093 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002094 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002095 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002096
2097 ret_val = htmlParseCharRef(ctxt);
2098 desret_int(ret_val);
2099 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002100 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002101 xmlResetLastError();
2102 if (mem_base != xmlMemBlocks()) {
2103 printf("Leak of %d blocks found in htmlParseCharRef",
2104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002105 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002106 printf(" %d", n_ctxt);
2107 printf("\n");
2108 }
2109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002110 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002111#endif
2112
Daniel Veillard42595322004-11-08 10:52:06 +00002113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002114}
2115
2116
2117static int
2118test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002120
William M. Brack21e4ef22005-01-02 09:53:13 +00002121#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002122 int mem_base;
2123 int ret_val;
2124 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2125 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002126 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002127 int n_chunk;
2128 int size; /* the size in byte of the chunk */
2129 int n_size;
2130 int terminate; /* last chunk indicator */
2131 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002132
Daniel Veillarda521d282004-11-09 14:59:59 +00002133 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002134 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2135 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2136 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2137 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002138 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002139 chunk = gen_const_char_ptr(n_chunk, 1);
2140 size = gen_int(n_size, 2);
2141 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142
William M. Brackf13f77f2004-11-12 16:03:48 +00002143 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002144 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002145 desret_int(ret_val);
2146 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002147 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002148 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002149 des_int(n_size, size, 2);
2150 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002151 xmlResetLastError();
2152 if (mem_base != xmlMemBlocks()) {
2153 printf("Leak of %d blocks found in htmlParseChunk",
2154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002156 printf(" %d", n_ctxt);
2157 printf(" %d", n_chunk);
2158 printf(" %d", n_size);
2159 printf(" %d", n_terminate);
2160 printf("\n");
2161 }
2162 }
2163 }
2164 }
2165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002166 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002167#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002168
Daniel Veillard42595322004-11-08 10:52:06 +00002169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002170}
2171
2172
2173static int
2174test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002176
William M. Brack21e4ef22005-01-02 09:53:13 +00002177#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002178 int mem_base;
2179 htmlDocPtr ret_val;
2180 xmlChar * cur; /* a pointer to an array of xmlChar */
2181 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002182 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002183 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002184
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002185 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2186 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002188 cur = gen_xmlChar_ptr(n_cur, 0);
2189 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002190
William M. Brackf13f77f2004-11-12 16:03:48 +00002191 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002192 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002193 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002194 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002195 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002196 xmlResetLastError();
2197 if (mem_base != xmlMemBlocks()) {
2198 printf("Leak of %d blocks found in htmlParseDoc",
2199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002200 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002201 printf(" %d", n_cur);
2202 printf(" %d", n_encoding);
2203 printf("\n");
2204 }
2205 }
2206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002207 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002208#endif
2209
Daniel Veillard42595322004-11-08 10:52:06 +00002210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002211}
2212
2213
2214static int
2215test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002217
William M. Brack21e4ef22005-01-02 09:53:13 +00002218#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002219 int mem_base;
2220 int ret_val;
2221 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2222 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002223
Daniel Veillarda521d282004-11-09 14:59:59 +00002224 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002225 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002226 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002227
2228 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002229 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002230 desret_int(ret_val);
2231 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002232 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002233 xmlResetLastError();
2234 if (mem_base != xmlMemBlocks()) {
2235 printf("Leak of %d blocks found in htmlParseDocument",
2236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002237 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002238 printf(" %d", n_ctxt);
2239 printf("\n");
2240 }
2241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002242 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002243#endif
2244
Daniel Veillard42595322004-11-08 10:52:06 +00002245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002246}
2247
2248
2249static int
2250test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002252
William M. Brack21e4ef22005-01-02 09:53:13 +00002253#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002254 int mem_base;
2255 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2256 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002257
Daniel Veillarda521d282004-11-09 14:59:59 +00002258 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002259 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002260 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002261
2262 htmlParseElement(ctxt);
2263 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002264 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002265 xmlResetLastError();
2266 if (mem_base != xmlMemBlocks()) {
2267 printf("Leak of %d blocks found in htmlParseElement",
2268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002269 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002270 printf(" %d", n_ctxt);
2271 printf("\n");
2272 }
2273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002274 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002275#endif
2276
Daniel Veillard42595322004-11-08 10:52:06 +00002277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002278}
2279
2280
2281static int
2282test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002284
William M. Brack21e4ef22005-01-02 09:53:13 +00002285#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002286 int mem_base;
2287 const htmlEntityDesc * ret_val;
2288 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2289 int n_ctxt;
2290 xmlChar ** str; /* location to store the entity name */
2291 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002292
Daniel Veillarda521d282004-11-09 14:59:59 +00002293 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002294 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2295 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002296 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002297 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2298
William M. Brackf13f77f2004-11-12 16:03:48 +00002299 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002300 desret_const_htmlEntityDesc_ptr(ret_val);
2301 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002302 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002303 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002304 xmlResetLastError();
2305 if (mem_base != xmlMemBlocks()) {
2306 printf("Leak of %d blocks found in htmlParseEntityRef",
2307 xmlMemBlocks() - mem_base);
2308 test_ret++;
2309 printf(" %d", n_ctxt);
2310 printf(" %d", n_str);
2311 printf("\n");
2312 }
2313 }
2314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002315 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002316#endif
2317
Daniel Veillard42595322004-11-08 10:52:06 +00002318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002319}
2320
2321
2322static int
2323test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002325
William M. Brack21e4ef22005-01-02 09:53:13 +00002326#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002327 htmlDocPtr ret_val;
2328 const char * filename; /* the filename */
2329 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002330 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002331 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002332
Daniel Veillarda03e3652004-11-02 18:45:30 +00002333 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2334 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002335 filename = gen_filepath(n_filename, 0);
2336 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002337
William M. Brackf13f77f2004-11-12 16:03:48 +00002338 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002339 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002341 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002342 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002343 xmlResetLastError();
2344 }
2345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002346 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002347#endif
2348
Daniel Veillard42595322004-11-08 10:52:06 +00002349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002350}
2351
2352
2353static int
2354test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002356
William M. Brack21e4ef22005-01-02 09:53:13 +00002357#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002358 int mem_base;
2359 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002360 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002361 int n_cur;
2362 const char * URL; /* the base URL to use for the document */
2363 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002364 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002365 int n_encoding;
2366 int options; /* a combination of htmlParserOption(s) */
2367 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368
Daniel Veillarda03e3652004-11-02 18:45:30 +00002369 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2370 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2371 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2372 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002374 cur = gen_const_xmlChar_ptr(n_cur, 0);
2375 URL = gen_filepath(n_URL, 1);
2376 encoding = gen_const_char_ptr(n_encoding, 2);
2377 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002378
William M. Brackf13f77f2004-11-12 16:03:48 +00002379 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002380 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002381 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002382 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002383 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002384 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002385 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002386 xmlResetLastError();
2387 if (mem_base != xmlMemBlocks()) {
2388 printf("Leak of %d blocks found in htmlReadDoc",
2389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002390 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002391 printf(" %d", n_cur);
2392 printf(" %d", n_URL);
2393 printf(" %d", n_encoding);
2394 printf(" %d", n_options);
2395 printf("\n");
2396 }
2397 }
2398 }
2399 }
2400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002401 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002402#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002403
Daniel Veillard42595322004-11-08 10:52:06 +00002404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002405}
2406
2407
2408static int
2409test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002411
William M. Brack21e4ef22005-01-02 09:53:13 +00002412#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002413 int mem_base;
2414 htmlDocPtr ret_val;
2415 const char * filename; /* a file or URL */
2416 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002417 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002418 int n_encoding;
2419 int options; /* a combination of htmlParserOption(s) */
2420 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002421
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2423 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2424 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002426 filename = gen_filepath(n_filename, 0);
2427 encoding = gen_const_char_ptr(n_encoding, 1);
2428 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002429
William M. Brackf13f77f2004-11-12 16:03:48 +00002430 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002431 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002433 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002434 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002435 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002436 xmlResetLastError();
2437 if (mem_base != xmlMemBlocks()) {
2438 printf("Leak of %d blocks found in htmlReadFile",
2439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002440 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002441 printf(" %d", n_filename);
2442 printf(" %d", n_encoding);
2443 printf(" %d", n_options);
2444 printf("\n");
2445 }
2446 }
2447 }
2448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002449 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002450#endif
2451
Daniel Veillard42595322004-11-08 10:52:06 +00002452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002453}
2454
2455
2456static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002457test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002459
William M. Brack21e4ef22005-01-02 09:53:13 +00002460#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002461 int mem_base;
2462 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002463 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002464 int n_buffer;
2465 int size; /* the size of the array */
2466 int n_size;
2467 const char * URL; /* the base URL to use for the document */
2468 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002469 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002470 int n_encoding;
2471 int options; /* a combination of htmlParserOption(s) */
2472 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002473
Daniel Veillarda03e3652004-11-02 18:45:30 +00002474 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2475 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2476 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2477 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2478 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2479 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002480 buffer = gen_const_char_ptr(n_buffer, 0);
2481 size = gen_int(n_size, 1);
2482 URL = gen_filepath(n_URL, 2);
2483 encoding = gen_const_char_ptr(n_encoding, 3);
2484 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002485
William M. Brackf13f77f2004-11-12 16:03:48 +00002486 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002487 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002488 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002489 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002490 des_int(n_size, size, 1);
2491 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002492 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002493 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002494 xmlResetLastError();
2495 if (mem_base != xmlMemBlocks()) {
2496 printf("Leak of %d blocks found in htmlReadMemory",
2497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002498 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002499 printf(" %d", n_buffer);
2500 printf(" %d", n_size);
2501 printf(" %d", n_URL);
2502 printf(" %d", n_encoding);
2503 printf(" %d", n_options);
2504 printf("\n");
2505 }
2506 }
2507 }
2508 }
2509 }
2510 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002511 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002512#endif
2513
Daniel Veillard42595322004-11-08 10:52:06 +00002514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002515}
2516
2517
2518static int
2519test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002521
William M. Brack21e4ef22005-01-02 09:53:13 +00002522#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002523 int mem_base;
2524 htmlDocPtr ret_val;
2525 xmlChar * cur; /* a pointer to an array of xmlChar */
2526 int n_cur;
2527 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2528 int n_encoding;
2529 htmlSAXHandlerPtr sax; /* the SAX handler block */
2530 int n_sax;
2531 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2532 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002533
Daniel Veillardce682bc2004-11-05 17:22:25 +00002534 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2535 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2536 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2537 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2538 mem_base = xmlMemBlocks();
2539 cur = gen_xmlChar_ptr(n_cur, 0);
2540 encoding = gen_const_char_ptr(n_encoding, 1);
2541 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2542 userData = gen_userdata(n_userData, 3);
2543
William M. Brackf13f77f2004-11-12 16:03:48 +00002544 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002545 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002546 call_tests++;
2547 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002548 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002549 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2550 des_userdata(n_userData, userData, 3);
2551 xmlResetLastError();
2552 if (mem_base != xmlMemBlocks()) {
2553 printf("Leak of %d blocks found in htmlSAXParseDoc",
2554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002555 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002556 printf(" %d", n_cur);
2557 printf(" %d", n_encoding);
2558 printf(" %d", n_sax);
2559 printf(" %d", n_userData);
2560 printf("\n");
2561 }
2562 }
2563 }
2564 }
2565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002566 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002567#endif
2568
Daniel Veillard42595322004-11-08 10:52:06 +00002569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002570}
2571
2572
2573static int
2574test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002576
William M. Brack21e4ef22005-01-02 09:53:13 +00002577#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002578 int mem_base;
2579 htmlDocPtr ret_val;
2580 const char * filename; /* the filename */
2581 int n_filename;
2582 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2583 int n_encoding;
2584 htmlSAXHandlerPtr sax; /* the SAX handler block */
2585 int n_sax;
2586 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2587 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002588
Daniel Veillardce682bc2004-11-05 17:22:25 +00002589 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2590 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2591 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2592 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2593 mem_base = xmlMemBlocks();
2594 filename = gen_filepath(n_filename, 0);
2595 encoding = gen_const_char_ptr(n_encoding, 1);
2596 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2597 userData = gen_userdata(n_userData, 3);
2598
William M. Brackf13f77f2004-11-12 16:03:48 +00002599 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002600 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002601 call_tests++;
2602 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002603 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002604 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2605 des_userdata(n_userData, userData, 3);
2606 xmlResetLastError();
2607 if (mem_base != xmlMemBlocks()) {
2608 printf("Leak of %d blocks found in htmlSAXParseFile",
2609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002610 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002611 printf(" %d", n_filename);
2612 printf(" %d", n_encoding);
2613 printf(" %d", n_sax);
2614 printf(" %d", n_userData);
2615 printf("\n");
2616 }
2617 }
2618 }
2619 }
2620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002621 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002622#endif
2623
Daniel Veillard42595322004-11-08 10:52:06 +00002624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002625}
2626
2627
2628static int
2629test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002631
2632
2633 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002635}
2636
2637static int
2638test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002640
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002641 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002642 test_ret += test_UTF8ToHtml();
2643 test_ret += test_htmlAttrAllowed();
2644 test_ret += test_htmlAutoCloseTag();
2645 test_ret += test_htmlCreateMemoryParserCtxt();
2646 test_ret += test_htmlCreatePushParserCtxt();
2647 test_ret += test_htmlCtxtReadDoc();
2648 test_ret += test_htmlCtxtReadFile();
2649 test_ret += test_htmlCtxtReadMemory();
2650 test_ret += test_htmlCtxtReset();
2651 test_ret += test_htmlCtxtUseOptions();
2652 test_ret += test_htmlElementAllowedHere();
2653 test_ret += test_htmlElementStatusHere();
2654 test_ret += test_htmlEncodeEntities();
2655 test_ret += test_htmlEntityLookup();
2656 test_ret += test_htmlEntityValueLookup();
2657 test_ret += test_htmlHandleOmittedElem();
2658 test_ret += test_htmlIsAutoClosed();
2659 test_ret += test_htmlIsScriptAttribute();
2660 test_ret += test_htmlNodeStatus();
2661 test_ret += test_htmlParseCharRef();
2662 test_ret += test_htmlParseChunk();
2663 test_ret += test_htmlParseDoc();
2664 test_ret += test_htmlParseDocument();
2665 test_ret += test_htmlParseElement();
2666 test_ret += test_htmlParseEntityRef();
2667 test_ret += test_htmlParseFile();
2668 test_ret += test_htmlReadDoc();
2669 test_ret += test_htmlReadFile();
2670 test_ret += test_htmlReadMemory();
2671 test_ret += test_htmlSAXParseDoc();
2672 test_ret += test_htmlSAXParseFile();
2673 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002674
Daniel Veillard42595322004-11-08 10:52:06 +00002675 if (test_ret != 0)
2676 printf("Module HTMLparser: %d errors\n", test_ret);
2677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002678}
2679
2680static int
2681test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002683
William M. Brack21e4ef22005-01-02 09:53:13 +00002684#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002685 int mem_base;
2686 xmlOutputBufferPtr buf; /* the HTML buffer output */
2687 int n_buf;
2688 xmlDocPtr cur; /* the document */
2689 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002690 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002691 int n_encoding;
2692 int format; /* should formatting spaces been added */
2693 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002694
Daniel Veillard3d97e662004-11-04 10:49:00 +00002695 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2696 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2697 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2698 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2699 mem_base = xmlMemBlocks();
2700 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2701 cur = gen_xmlDocPtr(n_cur, 1);
2702 encoding = gen_const_char_ptr(n_encoding, 2);
2703 format = gen_int(n_format, 3);
2704
William M. Brackf13f77f2004-11-12 16:03:48 +00002705 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002706 call_tests++;
2707 des_xmlOutputBufferPtr(n_buf, buf, 0);
2708 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002709 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002710 des_int(n_format, format, 3);
2711 xmlResetLastError();
2712 if (mem_base != xmlMemBlocks()) {
2713 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002715 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002716 printf(" %d", n_buf);
2717 printf(" %d", n_cur);
2718 printf(" %d", n_encoding);
2719 printf(" %d", n_format);
2720 printf("\n");
2721 }
2722 }
2723 }
2724 }
2725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002726 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002727#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002728
Daniel Veillard42595322004-11-08 10:52:06 +00002729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002730}
2731
2732
2733static int
2734test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002736
William M. Brack21e4ef22005-01-02 09:53:13 +00002737#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002738 int mem_base;
2739 xmlOutputBufferPtr buf; /* the HTML buffer output */
2740 int n_buf;
2741 xmlDocPtr cur; /* the document */
2742 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002743 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002744 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002745
Daniel Veillard3d97e662004-11-04 10:49:00 +00002746 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2747 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2748 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2749 mem_base = xmlMemBlocks();
2750 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2751 cur = gen_xmlDocPtr(n_cur, 1);
2752 encoding = gen_const_char_ptr(n_encoding, 2);
2753
William M. Brackf13f77f2004-11-12 16:03:48 +00002754 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002755 call_tests++;
2756 des_xmlOutputBufferPtr(n_buf, buf, 0);
2757 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002758 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002759 xmlResetLastError();
2760 if (mem_base != xmlMemBlocks()) {
2761 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002763 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002764 printf(" %d", n_buf);
2765 printf(" %d", n_cur);
2766 printf(" %d", n_encoding);
2767 printf("\n");
2768 }
2769 }
2770 }
2771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002772 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002773#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002774
Daniel Veillard42595322004-11-08 10:52:06 +00002775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002776}
2777
2778
2779static int
2780test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002782
William M. Brack21e4ef22005-01-02 09:53:13 +00002783#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002784 int mem_base;
2785 int ret_val;
2786 FILE * f; /* the FILE* */
2787 int n_f;
2788 xmlDocPtr cur; /* the document */
2789 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002790
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002791 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2792 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2793 mem_base = xmlMemBlocks();
2794 f = gen_FILE_ptr(n_f, 0);
2795 cur = gen_xmlDocPtr(n_cur, 1);
2796
2797 ret_val = htmlDocDump(f, cur);
2798 desret_int(ret_val);
2799 call_tests++;
2800 des_FILE_ptr(n_f, f, 0);
2801 des_xmlDocPtr(n_cur, cur, 1);
2802 xmlResetLastError();
2803 if (mem_base != xmlMemBlocks()) {
2804 printf("Leak of %d blocks found in htmlDocDump",
2805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002806 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002807 printf(" %d", n_f);
2808 printf(" %d", n_cur);
2809 printf("\n");
2810 }
2811 }
2812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002813 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002814#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002815
Daniel Veillard42595322004-11-08 10:52:06 +00002816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002817}
2818
2819
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002820#define gen_nb_xmlChar_ptr_ptr 1
2821static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2822 return(NULL);
2823}
2824static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2825}
2826
Daniel Veillardd93f6252004-11-02 15:53:51 +00002827static int
2828test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002830
William M. Brack21e4ef22005-01-02 09:53:13 +00002831#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002832 int mem_base;
2833 xmlDocPtr cur; /* the document */
2834 int n_cur;
2835 xmlChar ** mem; /* OUT: the memory pointer */
2836 int n_mem;
2837 int * size; /* OUT: the memory length */
2838 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002839
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002840 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2841 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2842 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2843 mem_base = xmlMemBlocks();
2844 cur = gen_xmlDocPtr(n_cur, 0);
2845 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2846 size = gen_int_ptr(n_size, 2);
2847
2848 htmlDocDumpMemory(cur, mem, size);
2849 call_tests++;
2850 des_xmlDocPtr(n_cur, cur, 0);
2851 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2852 des_int_ptr(n_size, size, 2);
2853 xmlResetLastError();
2854 if (mem_base != xmlMemBlocks()) {
2855 printf("Leak of %d blocks found in htmlDocDumpMemory",
2856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002857 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002858 printf(" %d", n_cur);
2859 printf(" %d", n_mem);
2860 printf(" %d", n_size);
2861 printf("\n");
2862 }
2863 }
2864 }
2865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002866 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002867#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002868
Daniel Veillard42595322004-11-08 10:52:06 +00002869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002870}
2871
2872
2873static int
2874test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002876
William M. Brack21e4ef22005-01-02 09:53:13 +00002877#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002878 int mem_base;
2879 const xmlChar * ret_val;
2880 htmlDocPtr doc; /* the document */
2881 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002882
Daniel Veillarda521d282004-11-09 14:59:59 +00002883 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002884 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002885 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002886
2887 ret_val = htmlGetMetaEncoding(doc);
2888 desret_const_xmlChar_ptr(ret_val);
2889 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002890 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002891 xmlResetLastError();
2892 if (mem_base != xmlMemBlocks()) {
2893 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002895 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002896 printf(" %d", n_doc);
2897 printf("\n");
2898 }
2899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002900 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002901#endif
2902
Daniel Veillard42595322004-11-08 10:52:06 +00002903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002904}
2905
2906
2907static int
2908test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002910
William M. Brack21e4ef22005-01-02 09:53:13 +00002911#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912 int mem_base;
2913 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002914 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002915 int n_name;
2916
2917 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002919 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002920
William M. Brackf13f77f2004-11-12 16:03:48 +00002921 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002922 desret_int(ret_val);
2923 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002924 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002925 xmlResetLastError();
2926 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002927 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002929 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002930 printf(" %d", n_name);
2931 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002932 }
2933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002934 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002935#endif
2936
Daniel Veillard42595322004-11-08 10:52:06 +00002937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002938}
2939
2940
2941static int
2942test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002944
William M. Brack21e4ef22005-01-02 09:53:13 +00002945#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002946 int mem_base;
2947 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002948 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002949 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002950 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002951 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002952
Daniel Veillarda03e3652004-11-02 18:45:30 +00002953 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2954 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002956 URI = gen_const_xmlChar_ptr(n_URI, 0);
2957 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002958
William M. Brackf13f77f2004-11-12 16:03:48 +00002959 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002960 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002961 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002962 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2963 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002964 xmlResetLastError();
2965 if (mem_base != xmlMemBlocks()) {
2966 printf("Leak of %d blocks found in htmlNewDoc",
2967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002968 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002969 printf(" %d", n_URI);
2970 printf(" %d", n_ExternalID);
2971 printf("\n");
2972 }
2973 }
2974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002975 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002976#endif
2977
Daniel Veillard42595322004-11-08 10:52:06 +00002978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002979}
2980
2981
2982static int
2983test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002985
William M. Brack21e4ef22005-01-02 09:53:13 +00002986#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 int mem_base;
2988 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002989 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002990 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002991 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002992 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002993
Daniel Veillarda03e3652004-11-02 18:45:30 +00002994 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2995 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002997 URI = gen_const_xmlChar_ptr(n_URI, 0);
2998 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002999
William M. Brackf13f77f2004-11-12 16:03:48 +00003000 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003001 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003002 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003003 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3004 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003005 xmlResetLastError();
3006 if (mem_base != xmlMemBlocks()) {
3007 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003009 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003010 printf(" %d", n_URI);
3011 printf(" %d", n_ExternalID);
3012 printf("\n");
3013 }
3014 }
3015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003016 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003017#endif
3018
Daniel Veillard42595322004-11-08 10:52:06 +00003019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003020}
3021
3022
3023static int
3024test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003026
William M. Brack21e4ef22005-01-02 09:53:13 +00003027#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003028 int mem_base;
3029 int ret_val;
3030 xmlBufferPtr buf; /* the HTML buffer output */
3031 int n_buf;
3032 xmlDocPtr doc; /* the document */
3033 int n_doc;
3034 xmlNodePtr cur; /* the current node */
3035 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003036
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003037 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3038 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3039 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3040 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003041 buf = gen_xmlBufferPtr(n_buf, 0);
3042 doc = gen_xmlDocPtr(n_doc, 1);
3043 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003044
3045 ret_val = htmlNodeDump(buf, doc, cur);
3046 desret_int(ret_val);
3047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003048 des_xmlBufferPtr(n_buf, buf, 0);
3049 des_xmlDocPtr(n_doc, doc, 1);
3050 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003051 xmlResetLastError();
3052 if (mem_base != xmlMemBlocks()) {
3053 printf("Leak of %d blocks found in htmlNodeDump",
3054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003055 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003056 printf(" %d", n_buf);
3057 printf(" %d", n_doc);
3058 printf(" %d", n_cur);
3059 printf("\n");
3060 }
3061 }
3062 }
3063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003064 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003065#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003066
Daniel Veillard42595322004-11-08 10:52:06 +00003067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003068}
3069
3070
3071static int
3072test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003074
William M. Brack21e4ef22005-01-02 09:53:13 +00003075#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003076 int mem_base;
3077 FILE * out; /* the FILE pointer */
3078 int n_out;
3079 xmlDocPtr doc; /* the document */
3080 int n_doc;
3081 xmlNodePtr cur; /* the current node */
3082 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003083
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003084 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3085 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3086 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3087 mem_base = xmlMemBlocks();
3088 out = gen_FILE_ptr(n_out, 0);
3089 doc = gen_xmlDocPtr(n_doc, 1);
3090 cur = gen_xmlNodePtr(n_cur, 2);
3091
3092 htmlNodeDumpFile(out, doc, cur);
3093 call_tests++;
3094 des_FILE_ptr(n_out, out, 0);
3095 des_xmlDocPtr(n_doc, doc, 1);
3096 des_xmlNodePtr(n_cur, cur, 2);
3097 xmlResetLastError();
3098 if (mem_base != xmlMemBlocks()) {
3099 printf("Leak of %d blocks found in htmlNodeDumpFile",
3100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003101 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003102 printf(" %d", n_out);
3103 printf(" %d", n_doc);
3104 printf(" %d", n_cur);
3105 printf("\n");
3106 }
3107 }
3108 }
3109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003110 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003111#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003112
Daniel Veillard42595322004-11-08 10:52:06 +00003113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003114}
3115
3116
3117static int
3118test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003120
William M. Brack21e4ef22005-01-02 09:53:13 +00003121#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003122 int mem_base;
3123 int ret_val;
3124 FILE * out; /* the FILE pointer */
3125 int n_out;
3126 xmlDocPtr doc; /* the document */
3127 int n_doc;
3128 xmlNodePtr cur; /* the current node */
3129 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003130 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003131 int n_encoding;
3132 int format; /* should formatting spaces been added */
3133 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003134
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003135 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3136 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3137 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3138 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3139 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3140 mem_base = xmlMemBlocks();
3141 out = gen_FILE_ptr(n_out, 0);
3142 doc = gen_xmlDocPtr(n_doc, 1);
3143 cur = gen_xmlNodePtr(n_cur, 2);
3144 encoding = gen_const_char_ptr(n_encoding, 3);
3145 format = gen_int(n_format, 4);
3146
William M. Brackf13f77f2004-11-12 16:03:48 +00003147 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003148 desret_int(ret_val);
3149 call_tests++;
3150 des_FILE_ptr(n_out, out, 0);
3151 des_xmlDocPtr(n_doc, doc, 1);
3152 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003153 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003154 des_int(n_format, format, 4);
3155 xmlResetLastError();
3156 if (mem_base != xmlMemBlocks()) {
3157 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003159 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003160 printf(" %d", n_out);
3161 printf(" %d", n_doc);
3162 printf(" %d", n_cur);
3163 printf(" %d", n_encoding);
3164 printf(" %d", n_format);
3165 printf("\n");
3166 }
3167 }
3168 }
3169 }
3170 }
3171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003172 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003173#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003174
Daniel Veillard42595322004-11-08 10:52:06 +00003175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003176}
3177
3178
3179static int
3180test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003182
William M. Brack21e4ef22005-01-02 09:53:13 +00003183#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003184 int mem_base;
3185 xmlOutputBufferPtr buf; /* the HTML buffer output */
3186 int n_buf;
3187 xmlDocPtr doc; /* the document */
3188 int n_doc;
3189 xmlNodePtr cur; /* the current node */
3190 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003191 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003192 int n_encoding;
3193 int format; /* should formatting spaces been added */
3194 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003195
Daniel Veillard3d97e662004-11-04 10:49:00 +00003196 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3197 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3198 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3199 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3200 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3201 mem_base = xmlMemBlocks();
3202 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3203 doc = gen_xmlDocPtr(n_doc, 1);
3204 cur = gen_xmlNodePtr(n_cur, 2);
3205 encoding = gen_const_char_ptr(n_encoding, 3);
3206 format = gen_int(n_format, 4);
3207
William M. Brackf13f77f2004-11-12 16:03:48 +00003208 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003209 call_tests++;
3210 des_xmlOutputBufferPtr(n_buf, buf, 0);
3211 des_xmlDocPtr(n_doc, doc, 1);
3212 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003213 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003214 des_int(n_format, format, 4);
3215 xmlResetLastError();
3216 if (mem_base != xmlMemBlocks()) {
3217 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003219 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003220 printf(" %d", n_buf);
3221 printf(" %d", n_doc);
3222 printf(" %d", n_cur);
3223 printf(" %d", n_encoding);
3224 printf(" %d", n_format);
3225 printf("\n");
3226 }
3227 }
3228 }
3229 }
3230 }
3231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003232 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003233#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003234
Daniel Veillard42595322004-11-08 10:52:06 +00003235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003236}
3237
3238
3239static int
3240test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003242
William M. Brack21e4ef22005-01-02 09:53:13 +00003243#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003244 int mem_base;
3245 xmlOutputBufferPtr buf; /* the HTML buffer output */
3246 int n_buf;
3247 xmlDocPtr doc; /* the document */
3248 int n_doc;
3249 xmlNodePtr cur; /* the current node */
3250 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003251 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003252 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003253
Daniel Veillard3d97e662004-11-04 10:49:00 +00003254 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3255 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3256 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3257 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3258 mem_base = xmlMemBlocks();
3259 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3260 doc = gen_xmlDocPtr(n_doc, 1);
3261 cur = gen_xmlNodePtr(n_cur, 2);
3262 encoding = gen_const_char_ptr(n_encoding, 3);
3263
William M. Brackf13f77f2004-11-12 16:03:48 +00003264 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003265 call_tests++;
3266 des_xmlOutputBufferPtr(n_buf, buf, 0);
3267 des_xmlDocPtr(n_doc, doc, 1);
3268 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003269 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270 xmlResetLastError();
3271 if (mem_base != xmlMemBlocks()) {
3272 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003274 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003275 printf(" %d", n_buf);
3276 printf(" %d", n_doc);
3277 printf(" %d", n_cur);
3278 printf(" %d", n_encoding);
3279 printf("\n");
3280 }
3281 }
3282 }
3283 }
3284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003285 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003286#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003287
Daniel Veillard42595322004-11-08 10:52:06 +00003288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003289}
3290
3291
3292static int
3293test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003295
William M. Brack21e4ef22005-01-02 09:53:13 +00003296#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003297 int mem_base;
3298 int ret_val;
3299 const char * filename; /* the filename (or URL) */
3300 int n_filename;
3301 xmlDocPtr cur; /* the document */
3302 int n_cur;
3303
3304 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3305 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003307 filename = gen_fileoutput(n_filename, 0);
3308 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003309
3310 ret_val = htmlSaveFile(filename, cur);
3311 desret_int(ret_val);
3312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003313 des_fileoutput(n_filename, filename, 0);
3314 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003315 xmlResetLastError();
3316 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003317 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003319 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003320 printf(" %d", n_filename);
3321 printf(" %d", n_cur);
3322 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003323 }
3324 }
3325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003326 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003327#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003328
Daniel Veillard42595322004-11-08 10:52:06 +00003329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003330}
3331
3332
3333static int
3334test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003336
William M. Brack21e4ef22005-01-02 09:53:13 +00003337#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003338 int mem_base;
3339 int ret_val;
3340 const char * filename; /* the filename */
3341 int n_filename;
3342 xmlDocPtr cur; /* the document */
3343 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003344 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345 int n_encoding;
3346
3347 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3348 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3349 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3350 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003351 filename = gen_fileoutput(n_filename, 0);
3352 cur = gen_xmlDocPtr(n_cur, 1);
3353 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003354
William M. Brackf13f77f2004-11-12 16:03:48 +00003355 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003356 desret_int(ret_val);
3357 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003358 des_fileoutput(n_filename, filename, 0);
3359 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003360 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003361 xmlResetLastError();
3362 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003363 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003365 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003366 printf(" %d", n_filename);
3367 printf(" %d", n_cur);
3368 printf(" %d", n_encoding);
3369 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003370 }
3371 }
3372 }
3373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003374 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003375#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003376
Daniel Veillard42595322004-11-08 10:52:06 +00003377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003378}
3379
3380
3381static int
3382test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003384
William M. Brack21e4ef22005-01-02 09:53:13 +00003385#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003386 int mem_base;
3387 int ret_val;
3388 const char * filename; /* the filename */
3389 int n_filename;
3390 xmlDocPtr cur; /* the document */
3391 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003392 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003393 int n_encoding;
3394 int format; /* should formatting spaces been added */
3395 int n_format;
3396
3397 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3398 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3399 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3400 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003402 filename = gen_fileoutput(n_filename, 0);
3403 cur = gen_xmlDocPtr(n_cur, 1);
3404 encoding = gen_const_char_ptr(n_encoding, 2);
3405 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003406
William M. Brackf13f77f2004-11-12 16:03:48 +00003407 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003408 desret_int(ret_val);
3409 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003410 des_fileoutput(n_filename, filename, 0);
3411 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003412 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003413 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414 xmlResetLastError();
3415 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003416 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003418 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003419 printf(" %d", n_filename);
3420 printf(" %d", n_cur);
3421 printf(" %d", n_encoding);
3422 printf(" %d", n_format);
3423 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003424 }
3425 }
3426 }
3427 }
3428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003429 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003430#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003431
Daniel Veillard42595322004-11-08 10:52:06 +00003432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003433}
3434
3435
3436static int
3437test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003439
William M. Brack21e4ef22005-01-02 09:53:13 +00003440#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003441 int mem_base;
3442 int ret_val;
3443 htmlDocPtr doc; /* the document */
3444 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003445 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003446 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003447
Daniel Veillarda521d282004-11-09 14:59:59 +00003448 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003449 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3450 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003451 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003452 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003453
William M. Brackf13f77f2004-11-12 16:03:48 +00003454 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003455 desret_int(ret_val);
3456 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003457 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003458 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003459 xmlResetLastError();
3460 if (mem_base != xmlMemBlocks()) {
3461 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003463 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003464 printf(" %d", n_doc);
3465 printf(" %d", n_encoding);
3466 printf("\n");
3467 }
3468 }
3469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003470 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003471#endif
3472
Daniel Veillard42595322004-11-08 10:52:06 +00003473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003474}
3475
3476static int
3477test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003479
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003480 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003481 test_ret += test_htmlDocContentDumpFormatOutput();
3482 test_ret += test_htmlDocContentDumpOutput();
3483 test_ret += test_htmlDocDump();
3484 test_ret += test_htmlDocDumpMemory();
3485 test_ret += test_htmlGetMetaEncoding();
3486 test_ret += test_htmlIsBooleanAttr();
3487 test_ret += test_htmlNewDoc();
3488 test_ret += test_htmlNewDocNoDtD();
3489 test_ret += test_htmlNodeDump();
3490 test_ret += test_htmlNodeDumpFile();
3491 test_ret += test_htmlNodeDumpFileFormat();
3492 test_ret += test_htmlNodeDumpFormatOutput();
3493 test_ret += test_htmlNodeDumpOutput();
3494 test_ret += test_htmlSaveFile();
3495 test_ret += test_htmlSaveFileEnc();
3496 test_ret += test_htmlSaveFileFormat();
3497 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003498
Daniel Veillard42595322004-11-08 10:52:06 +00003499 if (test_ret != 0)
3500 printf("Module HTMLtree: %d errors\n", test_ret);
3501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003502}
3503
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003504static int
3505test_docbDefaultSAXHandlerInit(void) {
3506 int test_ret = 0;
3507
William M. Brack21e4ef22005-01-02 09:53:13 +00003508#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003509#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003510 int mem_base;
3511
3512 mem_base = xmlMemBlocks();
3513
3514 docbDefaultSAXHandlerInit();
3515 call_tests++;
3516 xmlResetLastError();
3517 if (mem_base != xmlMemBlocks()) {
3518 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3519 xmlMemBlocks() - mem_base);
3520 test_ret++;
3521 printf("\n");
3522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003523 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003524#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003525#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003526
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003527 return(test_ret);
3528}
3529
3530
3531static int
3532test_htmlDefaultSAXHandlerInit(void) {
3533 int test_ret = 0;
3534
William M. Brack21e4ef22005-01-02 09:53:13 +00003535#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003536#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003537 int mem_base;
3538
3539 mem_base = xmlMemBlocks();
3540
3541 htmlDefaultSAXHandlerInit();
3542 call_tests++;
3543 xmlResetLastError();
3544 if (mem_base != xmlMemBlocks()) {
3545 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3546 xmlMemBlocks() - mem_base);
3547 test_ret++;
3548 printf("\n");
3549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003550 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003551#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003552#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003553
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003554 return(test_ret);
3555}
3556
3557
3558static int
3559test_xmlDefaultSAXHandlerInit(void) {
3560 int test_ret = 0;
3561
3562 int mem_base;
3563
3564 mem_base = xmlMemBlocks();
3565
3566 xmlDefaultSAXHandlerInit();
3567 call_tests++;
3568 xmlResetLastError();
3569 if (mem_base != xmlMemBlocks()) {
3570 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3571 xmlMemBlocks() - mem_base);
3572 test_ret++;
3573 printf("\n");
3574 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003575 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003576
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003577 return(test_ret);
3578}
3579
3580
3581#define gen_nb_xmlEnumerationPtr 1
3582static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3583 return(NULL);
3584}
3585static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3586}
3587
3588static int
3589test_xmlSAX2AttributeDecl(void) {
3590 int test_ret = 0;
3591
3592 int mem_base;
3593 void * ctx; /* the user data (XML parser context) */
3594 int n_ctx;
3595 xmlChar * elem; /* the name of the element */
3596 int n_elem;
3597 xmlChar * fullname; /* the attribute name */
3598 int n_fullname;
3599 int type; /* the attribute type */
3600 int n_type;
3601 int def; /* the type of default value */
3602 int n_def;
3603 xmlChar * defaultValue; /* the attribute default value */
3604 int n_defaultValue;
3605 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3606 int n_tree;
3607
3608 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3609 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3610 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3611 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3612 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3613 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3614 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3615 mem_base = xmlMemBlocks();
3616 ctx = gen_void_ptr(n_ctx, 0);
3617 elem = gen_const_xmlChar_ptr(n_elem, 1);
3618 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3619 type = gen_int(n_type, 3);
3620 def = gen_int(n_def, 4);
3621 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3622 tree = gen_xmlEnumerationPtr(n_tree, 6);
3623
William M. Brackf13f77f2004-11-12 16:03:48 +00003624 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003625 call_tests++;
3626 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003627 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3628 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003629 des_int(n_type, type, 3);
3630 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003631 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003632 des_xmlEnumerationPtr(n_tree, tree, 6);
3633 xmlResetLastError();
3634 if (mem_base != xmlMemBlocks()) {
3635 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3636 xmlMemBlocks() - mem_base);
3637 test_ret++;
3638 printf(" %d", n_ctx);
3639 printf(" %d", n_elem);
3640 printf(" %d", n_fullname);
3641 printf(" %d", n_type);
3642 printf(" %d", n_def);
3643 printf(" %d", n_defaultValue);
3644 printf(" %d", n_tree);
3645 printf("\n");
3646 }
3647 }
3648 }
3649 }
3650 }
3651 }
3652 }
3653 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003655
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003656 return(test_ret);
3657}
3658
3659
3660static int
3661test_xmlSAX2CDataBlock(void) {
3662 int test_ret = 0;
3663
3664 int mem_base;
3665 void * ctx; /* the user data (XML parser context) */
3666 int n_ctx;
3667 xmlChar * value; /* The pcdata content */
3668 int n_value;
3669 int len; /* the block length */
3670 int n_len;
3671
3672 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3673 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3674 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3675 mem_base = xmlMemBlocks();
3676 ctx = gen_void_ptr(n_ctx, 0);
3677 value = gen_const_xmlChar_ptr(n_value, 1);
3678 len = gen_int(n_len, 2);
3679
William M. Brackf13f77f2004-11-12 16:03:48 +00003680 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003681 call_tests++;
3682 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003683 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003684 des_int(n_len, len, 2);
3685 xmlResetLastError();
3686 if (mem_base != xmlMemBlocks()) {
3687 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3688 xmlMemBlocks() - mem_base);
3689 test_ret++;
3690 printf(" %d", n_ctx);
3691 printf(" %d", n_value);
3692 printf(" %d", n_len);
3693 printf("\n");
3694 }
3695 }
3696 }
3697 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003699
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003700 return(test_ret);
3701}
3702
3703
3704static int
3705test_xmlSAX2Characters(void) {
3706 int test_ret = 0;
3707
3708 int mem_base;
3709 void * ctx; /* the user data (XML parser context) */
3710 int n_ctx;
3711 xmlChar * ch; /* a xmlChar string */
3712 int n_ch;
3713 int len; /* the number of xmlChar */
3714 int n_len;
3715
3716 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3717 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3718 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3719 mem_base = xmlMemBlocks();
3720 ctx = gen_void_ptr(n_ctx, 0);
3721 ch = gen_const_xmlChar_ptr(n_ch, 1);
3722 len = gen_int(n_len, 2);
3723
William M. Brackf13f77f2004-11-12 16:03:48 +00003724 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003725 call_tests++;
3726 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003727 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003728 des_int(n_len, len, 2);
3729 xmlResetLastError();
3730 if (mem_base != xmlMemBlocks()) {
3731 printf("Leak of %d blocks found in xmlSAX2Characters",
3732 xmlMemBlocks() - mem_base);
3733 test_ret++;
3734 printf(" %d", n_ctx);
3735 printf(" %d", n_ch);
3736 printf(" %d", n_len);
3737 printf("\n");
3738 }
3739 }
3740 }
3741 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003743
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003744 return(test_ret);
3745}
3746
3747
3748static int
3749test_xmlSAX2Comment(void) {
3750 int test_ret = 0;
3751
3752 int mem_base;
3753 void * ctx; /* the user data (XML parser context) */
3754 int n_ctx;
3755 xmlChar * value; /* the xmlSAX2Comment content */
3756 int n_value;
3757
3758 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3759 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3760 mem_base = xmlMemBlocks();
3761 ctx = gen_void_ptr(n_ctx, 0);
3762 value = gen_const_xmlChar_ptr(n_value, 1);
3763
William M. Brackf13f77f2004-11-12 16:03:48 +00003764 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003765 call_tests++;
3766 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003767 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003768 xmlResetLastError();
3769 if (mem_base != xmlMemBlocks()) {
3770 printf("Leak of %d blocks found in xmlSAX2Comment",
3771 xmlMemBlocks() - mem_base);
3772 test_ret++;
3773 printf(" %d", n_ctx);
3774 printf(" %d", n_value);
3775 printf("\n");
3776 }
3777 }
3778 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003779 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003780
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003781 return(test_ret);
3782}
3783
3784
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003785static int
3786test_xmlSAX2ElementDecl(void) {
3787 int test_ret = 0;
3788
3789 int mem_base;
3790 void * ctx; /* the user data (XML parser context) */
3791 int n_ctx;
3792 xmlChar * name; /* the element name */
3793 int n_name;
3794 int type; /* the element type */
3795 int n_type;
3796 xmlElementContentPtr content; /* the element value tree */
3797 int n_content;
3798
3799 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3800 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3801 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3802 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3803 mem_base = xmlMemBlocks();
3804 ctx = gen_void_ptr(n_ctx, 0);
3805 name = gen_const_xmlChar_ptr(n_name, 1);
3806 type = gen_int(n_type, 2);
3807 content = gen_xmlElementContentPtr(n_content, 3);
3808
William M. Brackf13f77f2004-11-12 16:03:48 +00003809 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003810 call_tests++;
3811 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003812 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003813 des_int(n_type, type, 2);
3814 des_xmlElementContentPtr(n_content, content, 3);
3815 xmlResetLastError();
3816 if (mem_base != xmlMemBlocks()) {
3817 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3818 xmlMemBlocks() - mem_base);
3819 test_ret++;
3820 printf(" %d", n_ctx);
3821 printf(" %d", n_name);
3822 printf(" %d", n_type);
3823 printf(" %d", n_content);
3824 printf("\n");
3825 }
3826 }
3827 }
3828 }
3829 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003830 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003831
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003832 return(test_ret);
3833}
3834
3835
3836static int
3837test_xmlSAX2EndDocument(void) {
3838 int test_ret = 0;
3839
3840 int mem_base;
3841 void * ctx; /* the user data (XML parser context) */
3842 int n_ctx;
3843
3844 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3845 mem_base = xmlMemBlocks();
3846 ctx = gen_void_ptr(n_ctx, 0);
3847
3848 xmlSAX2EndDocument(ctx);
3849 call_tests++;
3850 des_void_ptr(n_ctx, ctx, 0);
3851 xmlResetLastError();
3852 if (mem_base != xmlMemBlocks()) {
3853 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3854 xmlMemBlocks() - mem_base);
3855 test_ret++;
3856 printf(" %d", n_ctx);
3857 printf("\n");
3858 }
3859 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003860 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003861
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003862 return(test_ret);
3863}
3864
3865
3866static int
3867test_xmlSAX2EndElement(void) {
3868 int test_ret = 0;
3869
William M. Brack21e4ef22005-01-02 09:53:13 +00003870#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003871#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003872 int mem_base;
3873 void * ctx; /* the user data (XML parser context) */
3874 int n_ctx;
3875 xmlChar * name; /* The element name */
3876 int n_name;
3877
3878 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3880 mem_base = xmlMemBlocks();
3881 ctx = gen_void_ptr(n_ctx, 0);
3882 name = gen_const_xmlChar_ptr(n_name, 1);
3883
William M. Brackf13f77f2004-11-12 16:03:48 +00003884 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003885 call_tests++;
3886 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003887 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003888 xmlResetLastError();
3889 if (mem_base != xmlMemBlocks()) {
3890 printf("Leak of %d blocks found in xmlSAX2EndElement",
3891 xmlMemBlocks() - mem_base);
3892 test_ret++;
3893 printf(" %d", n_ctx);
3894 printf(" %d", n_name);
3895 printf("\n");
3896 }
3897 }
3898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003899 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003900#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003901#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003902
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003903 return(test_ret);
3904}
3905
3906
3907static int
3908test_xmlSAX2EndElementNs(void) {
3909 int test_ret = 0;
3910
3911 int mem_base;
3912 void * ctx; /* the user data (XML parser context) */
3913 int n_ctx;
3914 xmlChar * localname; /* the local name of the element */
3915 int n_localname;
3916 xmlChar * prefix; /* the element namespace prefix if available */
3917 int n_prefix;
3918 xmlChar * URI; /* the element namespace name if available */
3919 int n_URI;
3920
3921 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3922 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3923 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3924 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3925 mem_base = xmlMemBlocks();
3926 ctx = gen_void_ptr(n_ctx, 0);
3927 localname = gen_const_xmlChar_ptr(n_localname, 1);
3928 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3929 URI = gen_const_xmlChar_ptr(n_URI, 3);
3930
William M. Brackf13f77f2004-11-12 16:03:48 +00003931 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003932 call_tests++;
3933 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003934 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3935 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3936 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003937 xmlResetLastError();
3938 if (mem_base != xmlMemBlocks()) {
3939 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3940 xmlMemBlocks() - mem_base);
3941 test_ret++;
3942 printf(" %d", n_ctx);
3943 printf(" %d", n_localname);
3944 printf(" %d", n_prefix);
3945 printf(" %d", n_URI);
3946 printf("\n");
3947 }
3948 }
3949 }
3950 }
3951 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003952 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003953
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003954 return(test_ret);
3955}
3956
3957
3958static int
3959test_xmlSAX2EntityDecl(void) {
3960 int test_ret = 0;
3961
3962 int mem_base;
3963 void * ctx; /* the user data (XML parser context) */
3964 int n_ctx;
3965 xmlChar * name; /* the entity name */
3966 int n_name;
3967 int type; /* the entity type */
3968 int n_type;
3969 xmlChar * publicId; /* The public ID of the entity */
3970 int n_publicId;
3971 xmlChar * systemId; /* The system ID of the entity */
3972 int n_systemId;
3973 xmlChar * content; /* the entity value (without processing). */
3974 int n_content;
3975
3976 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3977 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3978 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3979 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
3980 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
3981 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
3982 mem_base = xmlMemBlocks();
3983 ctx = gen_void_ptr(n_ctx, 0);
3984 name = gen_const_xmlChar_ptr(n_name, 1);
3985 type = gen_int(n_type, 2);
3986 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
3987 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
3988 content = gen_xmlChar_ptr(n_content, 5);
3989
William M. Brackf13f77f2004-11-12 16:03:48 +00003990 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003991 call_tests++;
3992 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003993 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003994 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003995 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
3996 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003997 des_xmlChar_ptr(n_content, content, 5);
3998 xmlResetLastError();
3999 if (mem_base != xmlMemBlocks()) {
4000 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4001 xmlMemBlocks() - mem_base);
4002 test_ret++;
4003 printf(" %d", n_ctx);
4004 printf(" %d", n_name);
4005 printf(" %d", n_type);
4006 printf(" %d", n_publicId);
4007 printf(" %d", n_systemId);
4008 printf(" %d", n_content);
4009 printf("\n");
4010 }
4011 }
4012 }
4013 }
4014 }
4015 }
4016 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004018
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004019 return(test_ret);
4020}
4021
4022
4023static int
4024test_xmlSAX2ExternalSubset(void) {
4025 int test_ret = 0;
4026
4027 int mem_base;
4028 void * ctx; /* the user data (XML parser context) */
4029 int n_ctx;
4030 xmlChar * name; /* the root element name */
4031 int n_name;
4032 xmlChar * ExternalID; /* the external ID */
4033 int n_ExternalID;
4034 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4035 int n_SystemID;
4036
4037 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4038 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4039 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4040 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4041 mem_base = xmlMemBlocks();
4042 ctx = gen_void_ptr(n_ctx, 0);
4043 name = gen_const_xmlChar_ptr(n_name, 1);
4044 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4045 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4046
William M. Brackf13f77f2004-11-12 16:03:48 +00004047 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004048 call_tests++;
4049 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004050 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4051 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4052 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004053 xmlResetLastError();
4054 if (mem_base != xmlMemBlocks()) {
4055 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4056 xmlMemBlocks() - mem_base);
4057 test_ret++;
4058 printf(" %d", n_ctx);
4059 printf(" %d", n_name);
4060 printf(" %d", n_ExternalID);
4061 printf(" %d", n_SystemID);
4062 printf("\n");
4063 }
4064 }
4065 }
4066 }
4067 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004068 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004069
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004070 return(test_ret);
4071}
4072
4073
4074static int
4075test_xmlSAX2GetColumnNumber(void) {
4076 int test_ret = 0;
4077
4078 int mem_base;
4079 int ret_val;
4080 void * ctx; /* the user data (XML parser context) */
4081 int n_ctx;
4082
4083 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4084 mem_base = xmlMemBlocks();
4085 ctx = gen_void_ptr(n_ctx, 0);
4086
4087 ret_val = xmlSAX2GetColumnNumber(ctx);
4088 desret_int(ret_val);
4089 call_tests++;
4090 des_void_ptr(n_ctx, ctx, 0);
4091 xmlResetLastError();
4092 if (mem_base != xmlMemBlocks()) {
4093 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4094 xmlMemBlocks() - mem_base);
4095 test_ret++;
4096 printf(" %d", n_ctx);
4097 printf("\n");
4098 }
4099 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004101
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004102 return(test_ret);
4103}
4104
4105
4106static int
4107test_xmlSAX2GetEntity(void) {
4108 int test_ret = 0;
4109
4110 int mem_base;
4111 xmlEntityPtr ret_val;
4112 void * ctx; /* the user data (XML parser context) */
4113 int n_ctx;
4114 xmlChar * name; /* The entity name */
4115 int n_name;
4116
4117 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4118 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4119 mem_base = xmlMemBlocks();
4120 ctx = gen_void_ptr(n_ctx, 0);
4121 name = gen_const_xmlChar_ptr(n_name, 1);
4122
William M. Brackf13f77f2004-11-12 16:03:48 +00004123 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004124 desret_xmlEntityPtr(ret_val);
4125 call_tests++;
4126 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004127 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004128 xmlResetLastError();
4129 if (mem_base != xmlMemBlocks()) {
4130 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4131 xmlMemBlocks() - mem_base);
4132 test_ret++;
4133 printf(" %d", n_ctx);
4134 printf(" %d", n_name);
4135 printf("\n");
4136 }
4137 }
4138 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004139 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004140
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004141 return(test_ret);
4142}
4143
4144
4145static int
4146test_xmlSAX2GetLineNumber(void) {
4147 int test_ret = 0;
4148
4149 int mem_base;
4150 int ret_val;
4151 void * ctx; /* the user data (XML parser context) */
4152 int n_ctx;
4153
4154 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4155 mem_base = xmlMemBlocks();
4156 ctx = gen_void_ptr(n_ctx, 0);
4157
4158 ret_val = xmlSAX2GetLineNumber(ctx);
4159 desret_int(ret_val);
4160 call_tests++;
4161 des_void_ptr(n_ctx, ctx, 0);
4162 xmlResetLastError();
4163 if (mem_base != xmlMemBlocks()) {
4164 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4165 xmlMemBlocks() - mem_base);
4166 test_ret++;
4167 printf(" %d", n_ctx);
4168 printf("\n");
4169 }
4170 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004171 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004172
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004173 return(test_ret);
4174}
4175
4176
4177static int
4178test_xmlSAX2GetParameterEntity(void) {
4179 int test_ret = 0;
4180
4181 int mem_base;
4182 xmlEntityPtr ret_val;
4183 void * ctx; /* the user data (XML parser context) */
4184 int n_ctx;
4185 xmlChar * name; /* The entity name */
4186 int n_name;
4187
4188 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4189 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4190 mem_base = xmlMemBlocks();
4191 ctx = gen_void_ptr(n_ctx, 0);
4192 name = gen_const_xmlChar_ptr(n_name, 1);
4193
William M. Brackf13f77f2004-11-12 16:03:48 +00004194 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004195 desret_xmlEntityPtr(ret_val);
4196 call_tests++;
4197 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004199 xmlResetLastError();
4200 if (mem_base != xmlMemBlocks()) {
4201 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4202 xmlMemBlocks() - mem_base);
4203 test_ret++;
4204 printf(" %d", n_ctx);
4205 printf(" %d", n_name);
4206 printf("\n");
4207 }
4208 }
4209 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004210 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004211
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004212 return(test_ret);
4213}
4214
4215
4216static int
4217test_xmlSAX2GetPublicId(void) {
4218 int test_ret = 0;
4219
4220 int mem_base;
4221 const xmlChar * ret_val;
4222 void * ctx; /* the user data (XML parser context) */
4223 int n_ctx;
4224
4225 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4226 mem_base = xmlMemBlocks();
4227 ctx = gen_void_ptr(n_ctx, 0);
4228
4229 ret_val = xmlSAX2GetPublicId(ctx);
4230 desret_const_xmlChar_ptr(ret_val);
4231 call_tests++;
4232 des_void_ptr(n_ctx, ctx, 0);
4233 xmlResetLastError();
4234 if (mem_base != xmlMemBlocks()) {
4235 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4236 xmlMemBlocks() - mem_base);
4237 test_ret++;
4238 printf(" %d", n_ctx);
4239 printf("\n");
4240 }
4241 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004243
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004244 return(test_ret);
4245}
4246
4247
4248static int
4249test_xmlSAX2GetSystemId(void) {
4250 int test_ret = 0;
4251
4252 int mem_base;
4253 const xmlChar * ret_val;
4254 void * ctx; /* the user data (XML parser context) */
4255 int n_ctx;
4256
4257 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4258 mem_base = xmlMemBlocks();
4259 ctx = gen_void_ptr(n_ctx, 0);
4260
4261 ret_val = xmlSAX2GetSystemId(ctx);
4262 desret_const_xmlChar_ptr(ret_val);
4263 call_tests++;
4264 des_void_ptr(n_ctx, ctx, 0);
4265 xmlResetLastError();
4266 if (mem_base != xmlMemBlocks()) {
4267 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4268 xmlMemBlocks() - mem_base);
4269 test_ret++;
4270 printf(" %d", n_ctx);
4271 printf("\n");
4272 }
4273 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004274 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004275
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004276 return(test_ret);
4277}
4278
4279
4280static int
4281test_xmlSAX2HasExternalSubset(void) {
4282 int test_ret = 0;
4283
4284 int mem_base;
4285 int ret_val;
4286 void * ctx; /* the user data (XML parser context) */
4287 int n_ctx;
4288
4289 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4290 mem_base = xmlMemBlocks();
4291 ctx = gen_void_ptr(n_ctx, 0);
4292
4293 ret_val = xmlSAX2HasExternalSubset(ctx);
4294 desret_int(ret_val);
4295 call_tests++;
4296 des_void_ptr(n_ctx, ctx, 0);
4297 xmlResetLastError();
4298 if (mem_base != xmlMemBlocks()) {
4299 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4300 xmlMemBlocks() - mem_base);
4301 test_ret++;
4302 printf(" %d", n_ctx);
4303 printf("\n");
4304 }
4305 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004307
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004308 return(test_ret);
4309}
4310
4311
4312static int
4313test_xmlSAX2HasInternalSubset(void) {
4314 int test_ret = 0;
4315
4316 int mem_base;
4317 int ret_val;
4318 void * ctx; /* the user data (XML parser context) */
4319 int n_ctx;
4320
4321 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4322 mem_base = xmlMemBlocks();
4323 ctx = gen_void_ptr(n_ctx, 0);
4324
4325 ret_val = xmlSAX2HasInternalSubset(ctx);
4326 desret_int(ret_val);
4327 call_tests++;
4328 des_void_ptr(n_ctx, ctx, 0);
4329 xmlResetLastError();
4330 if (mem_base != xmlMemBlocks()) {
4331 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4332 xmlMemBlocks() - mem_base);
4333 test_ret++;
4334 printf(" %d", n_ctx);
4335 printf("\n");
4336 }
4337 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004339
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004340 return(test_ret);
4341}
4342
4343
4344static int
4345test_xmlSAX2IgnorableWhitespace(void) {
4346 int test_ret = 0;
4347
4348 int mem_base;
4349 void * ctx; /* the user data (XML parser context) */
4350 int n_ctx;
4351 xmlChar * ch; /* a xmlChar string */
4352 int n_ch;
4353 int len; /* the number of xmlChar */
4354 int n_len;
4355
4356 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4357 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4358 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4359 mem_base = xmlMemBlocks();
4360 ctx = gen_void_ptr(n_ctx, 0);
4361 ch = gen_const_xmlChar_ptr(n_ch, 1);
4362 len = gen_int(n_len, 2);
4363
William M. Brackf13f77f2004-11-12 16:03:48 +00004364 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004365 call_tests++;
4366 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004367 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004368 des_int(n_len, len, 2);
4369 xmlResetLastError();
4370 if (mem_base != xmlMemBlocks()) {
4371 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4372 xmlMemBlocks() - mem_base);
4373 test_ret++;
4374 printf(" %d", n_ctx);
4375 printf(" %d", n_ch);
4376 printf(" %d", n_len);
4377 printf("\n");
4378 }
4379 }
4380 }
4381 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004382 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004383
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004384 return(test_ret);
4385}
4386
4387
4388#define gen_nb_xmlSAXHandler_ptr 1
4389static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4390 return(NULL);
4391}
4392static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4393}
4394
4395static int
4396test_xmlSAX2InitDefaultSAXHandler(void) {
4397 int test_ret = 0;
4398
4399 int mem_base;
4400 xmlSAXHandler * hdlr; /* the SAX handler */
4401 int n_hdlr;
4402 int warning; /* flag if non-zero sets the handler warning procedure */
4403 int n_warning;
4404
4405 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4406 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4407 mem_base = xmlMemBlocks();
4408 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4409 warning = gen_int(n_warning, 1);
4410
4411 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4412 call_tests++;
4413 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4414 des_int(n_warning, warning, 1);
4415 xmlResetLastError();
4416 if (mem_base != xmlMemBlocks()) {
4417 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4418 xmlMemBlocks() - mem_base);
4419 test_ret++;
4420 printf(" %d", n_hdlr);
4421 printf(" %d", n_warning);
4422 printf("\n");
4423 }
4424 }
4425 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004427
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004428 return(test_ret);
4429}
4430
4431
4432static int
4433test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4434 int test_ret = 0;
4435
William M. Brack21e4ef22005-01-02 09:53:13 +00004436#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004437 int mem_base;
4438 xmlSAXHandler * hdlr; /* the SAX handler */
4439 int n_hdlr;
4440
4441 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4442 mem_base = xmlMemBlocks();
4443 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4444
4445 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4446 call_tests++;
4447 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4448 xmlResetLastError();
4449 if (mem_base != xmlMemBlocks()) {
4450 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4451 xmlMemBlocks() - mem_base);
4452 test_ret++;
4453 printf(" %d", n_hdlr);
4454 printf("\n");
4455 }
4456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004457 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004458#endif
4459
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004460 return(test_ret);
4461}
4462
4463
4464static int
4465test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4466 int test_ret = 0;
4467
William M. Brack21e4ef22005-01-02 09:53:13 +00004468#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004469 int mem_base;
4470 xmlSAXHandler * hdlr; /* the SAX handler */
4471 int n_hdlr;
4472
4473 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4474 mem_base = xmlMemBlocks();
4475 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4476
4477 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4478 call_tests++;
4479 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4480 xmlResetLastError();
4481 if (mem_base != xmlMemBlocks()) {
4482 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4483 xmlMemBlocks() - mem_base);
4484 test_ret++;
4485 printf(" %d", n_hdlr);
4486 printf("\n");
4487 }
4488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004489 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004490#endif
4491
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004492 return(test_ret);
4493}
4494
4495
4496static int
4497test_xmlSAX2InternalSubset(void) {
4498 int test_ret = 0;
4499
4500 int mem_base;
4501 void * ctx; /* the user data (XML parser context) */
4502 int n_ctx;
4503 xmlChar * name; /* the root element name */
4504 int n_name;
4505 xmlChar * ExternalID; /* the external ID */
4506 int n_ExternalID;
4507 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4508 int n_SystemID;
4509
4510 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4511 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4512 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4513 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4514 mem_base = xmlMemBlocks();
4515 ctx = gen_void_ptr(n_ctx, 0);
4516 name = gen_const_xmlChar_ptr(n_name, 1);
4517 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4518 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4519
William M. Brackf13f77f2004-11-12 16:03:48 +00004520 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004521 call_tests++;
4522 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004523 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4524 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4525 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004526 xmlResetLastError();
4527 if (mem_base != xmlMemBlocks()) {
4528 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4529 xmlMemBlocks() - mem_base);
4530 test_ret++;
4531 printf(" %d", n_ctx);
4532 printf(" %d", n_name);
4533 printf(" %d", n_ExternalID);
4534 printf(" %d", n_SystemID);
4535 printf("\n");
4536 }
4537 }
4538 }
4539 }
4540 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004542
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004543 return(test_ret);
4544}
4545
4546
4547static int
4548test_xmlSAX2IsStandalone(void) {
4549 int test_ret = 0;
4550
4551 int mem_base;
4552 int ret_val;
4553 void * ctx; /* the user data (XML parser context) */
4554 int n_ctx;
4555
4556 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4557 mem_base = xmlMemBlocks();
4558 ctx = gen_void_ptr(n_ctx, 0);
4559
4560 ret_val = xmlSAX2IsStandalone(ctx);
4561 desret_int(ret_val);
4562 call_tests++;
4563 des_void_ptr(n_ctx, ctx, 0);
4564 xmlResetLastError();
4565 if (mem_base != xmlMemBlocks()) {
4566 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4567 xmlMemBlocks() - mem_base);
4568 test_ret++;
4569 printf(" %d", n_ctx);
4570 printf("\n");
4571 }
4572 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004574
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004575 return(test_ret);
4576}
4577
4578
4579static int
4580test_xmlSAX2NotationDecl(void) {
4581 int test_ret = 0;
4582
4583 int mem_base;
4584 void * ctx; /* the user data (XML parser context) */
4585 int n_ctx;
4586 xmlChar * name; /* The name of the notation */
4587 int n_name;
4588 xmlChar * publicId; /* The public ID of the entity */
4589 int n_publicId;
4590 xmlChar * systemId; /* The system ID of the entity */
4591 int n_systemId;
4592
4593 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4594 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4595 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4596 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4597 mem_base = xmlMemBlocks();
4598 ctx = gen_void_ptr(n_ctx, 0);
4599 name = gen_const_xmlChar_ptr(n_name, 1);
4600 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4601 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4602
William M. Brackf13f77f2004-11-12 16:03:48 +00004603 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004604 call_tests++;
4605 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004606 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4607 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4608 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004609 xmlResetLastError();
4610 if (mem_base != xmlMemBlocks()) {
4611 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4612 xmlMemBlocks() - mem_base);
4613 test_ret++;
4614 printf(" %d", n_ctx);
4615 printf(" %d", n_name);
4616 printf(" %d", n_publicId);
4617 printf(" %d", n_systemId);
4618 printf("\n");
4619 }
4620 }
4621 }
4622 }
4623 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004624 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004625
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004626 return(test_ret);
4627}
4628
4629
4630static int
4631test_xmlSAX2ProcessingInstruction(void) {
4632 int test_ret = 0;
4633
4634 int mem_base;
4635 void * ctx; /* the user data (XML parser context) */
4636 int n_ctx;
4637 xmlChar * target; /* the target name */
4638 int n_target;
4639 xmlChar * data; /* the PI data's */
4640 int n_data;
4641
4642 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4643 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4644 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4645 mem_base = xmlMemBlocks();
4646 ctx = gen_void_ptr(n_ctx, 0);
4647 target = gen_const_xmlChar_ptr(n_target, 1);
4648 data = gen_const_xmlChar_ptr(n_data, 2);
4649
William M. Brackf13f77f2004-11-12 16:03:48 +00004650 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004651 call_tests++;
4652 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004653 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4654 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004655 xmlResetLastError();
4656 if (mem_base != xmlMemBlocks()) {
4657 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4658 xmlMemBlocks() - mem_base);
4659 test_ret++;
4660 printf(" %d", n_ctx);
4661 printf(" %d", n_target);
4662 printf(" %d", n_data);
4663 printf("\n");
4664 }
4665 }
4666 }
4667 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004668 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004669
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004670 return(test_ret);
4671}
4672
4673
4674static int
4675test_xmlSAX2Reference(void) {
4676 int test_ret = 0;
4677
4678 int mem_base;
4679 void * ctx; /* the user data (XML parser context) */
4680 int n_ctx;
4681 xmlChar * name; /* The entity name */
4682 int n_name;
4683
4684 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4685 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4686 mem_base = xmlMemBlocks();
4687 ctx = gen_void_ptr(n_ctx, 0);
4688 name = gen_const_xmlChar_ptr(n_name, 1);
4689
William M. Brackf13f77f2004-11-12 16:03:48 +00004690 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 call_tests++;
4692 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004693 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004694 xmlResetLastError();
4695 if (mem_base != xmlMemBlocks()) {
4696 printf("Leak of %d blocks found in xmlSAX2Reference",
4697 xmlMemBlocks() - mem_base);
4698 test_ret++;
4699 printf(" %d", n_ctx);
4700 printf(" %d", n_name);
4701 printf("\n");
4702 }
4703 }
4704 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004705 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004706
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004707 return(test_ret);
4708}
4709
4710
4711static int
4712test_xmlSAX2ResolveEntity(void) {
4713 int test_ret = 0;
4714
4715 int mem_base;
4716 xmlParserInputPtr ret_val;
4717 void * ctx; /* the user data (XML parser context) */
4718 int n_ctx;
4719 xmlChar * publicId; /* The public ID of the entity */
4720 int n_publicId;
4721 xmlChar * systemId; /* The system ID of the entity */
4722 int n_systemId;
4723
4724 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4725 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4726 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4727 mem_base = xmlMemBlocks();
4728 ctx = gen_void_ptr(n_ctx, 0);
4729 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4730 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4731
William M. Brackf13f77f2004-11-12 16:03:48 +00004732 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004733 desret_xmlParserInputPtr(ret_val);
4734 call_tests++;
4735 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004736 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4737 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004738 xmlResetLastError();
4739 if (mem_base != xmlMemBlocks()) {
4740 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4741 xmlMemBlocks() - mem_base);
4742 test_ret++;
4743 printf(" %d", n_ctx);
4744 printf(" %d", n_publicId);
4745 printf(" %d", n_systemId);
4746 printf("\n");
4747 }
4748 }
4749 }
4750 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004752
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004753 return(test_ret);
4754}
4755
4756
4757#define gen_nb_xmlSAXLocatorPtr 1
4758static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4759 return(NULL);
4760}
4761static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4762}
4763
4764static int
4765test_xmlSAX2SetDocumentLocator(void) {
4766 int test_ret = 0;
4767
4768 int mem_base;
4769 void * ctx; /* the user data (XML parser context) */
4770 int n_ctx;
4771 xmlSAXLocatorPtr loc; /* A SAX Locator */
4772 int n_loc;
4773
4774 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4775 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4776 mem_base = xmlMemBlocks();
4777 ctx = gen_void_ptr(n_ctx, 0);
4778 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4779
4780 xmlSAX2SetDocumentLocator(ctx, loc);
4781 call_tests++;
4782 des_void_ptr(n_ctx, ctx, 0);
4783 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4784 xmlResetLastError();
4785 if (mem_base != xmlMemBlocks()) {
4786 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4787 xmlMemBlocks() - mem_base);
4788 test_ret++;
4789 printf(" %d", n_ctx);
4790 printf(" %d", n_loc);
4791 printf("\n");
4792 }
4793 }
4794 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004795 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004796
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004797 return(test_ret);
4798}
4799
4800
4801static int
4802test_xmlSAX2StartDocument(void) {
4803 int test_ret = 0;
4804
4805 int mem_base;
4806 void * ctx; /* the user data (XML parser context) */
4807 int n_ctx;
4808
4809 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4810 mem_base = xmlMemBlocks();
4811 ctx = gen_void_ptr(n_ctx, 0);
4812
4813 xmlSAX2StartDocument(ctx);
4814 call_tests++;
4815 des_void_ptr(n_ctx, ctx, 0);
4816 xmlResetLastError();
4817 if (mem_base != xmlMemBlocks()) {
4818 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4819 xmlMemBlocks() - mem_base);
4820 test_ret++;
4821 printf(" %d", n_ctx);
4822 printf("\n");
4823 }
4824 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004825 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004826
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004827 return(test_ret);
4828}
4829
4830
4831static int
4832test_xmlSAX2StartElement(void) {
4833 int test_ret = 0;
4834
William M. Brack21e4ef22005-01-02 09:53:13 +00004835#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004836#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004837 int mem_base;
4838 void * ctx; /* the user data (XML parser context) */
4839 int n_ctx;
4840 xmlChar * fullname; /* The element name, including namespace prefix */
4841 int n_fullname;
4842 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4843 int n_atts;
4844
4845 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4846 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4847 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4848 mem_base = xmlMemBlocks();
4849 ctx = gen_void_ptr(n_ctx, 0);
4850 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4851 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4852
William M. Brackf13f77f2004-11-12 16:03:48 +00004853 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004854 call_tests++;
4855 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004856 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4857 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004858 xmlResetLastError();
4859 if (mem_base != xmlMemBlocks()) {
4860 printf("Leak of %d blocks found in xmlSAX2StartElement",
4861 xmlMemBlocks() - mem_base);
4862 test_ret++;
4863 printf(" %d", n_ctx);
4864 printf(" %d", n_fullname);
4865 printf(" %d", n_atts);
4866 printf("\n");
4867 }
4868 }
4869 }
4870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004871 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004872#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004873#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004874
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004875 return(test_ret);
4876}
4877
4878
4879static int
4880test_xmlSAX2StartElementNs(void) {
4881 int test_ret = 0;
4882
4883 int mem_base;
4884 void * ctx; /* the user data (XML parser context) */
4885 int n_ctx;
4886 xmlChar * localname; /* the local name of the element */
4887 int n_localname;
4888 xmlChar * prefix; /* the element namespace prefix if available */
4889 int n_prefix;
4890 xmlChar * URI; /* the element namespace name if available */
4891 int n_URI;
4892 int nb_namespaces; /* number of namespace definitions on that node */
4893 int n_nb_namespaces;
4894 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4895 int n_namespaces;
4896 int nb_attributes; /* the number of attributes on that node */
4897 int n_nb_attributes;
4898 int nb_defaulted; /* the number of defaulted attributes. */
4899 int n_nb_defaulted;
4900 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4901 int n_attributes;
4902
4903 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4904 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4905 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4906 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4907 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4908 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4909 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4910 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4911 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4912 mem_base = xmlMemBlocks();
4913 ctx = gen_void_ptr(n_ctx, 0);
4914 localname = gen_const_xmlChar_ptr(n_localname, 1);
4915 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4916 URI = gen_const_xmlChar_ptr(n_URI, 3);
4917 nb_namespaces = gen_int(n_nb_namespaces, 4);
4918 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4919 nb_attributes = gen_int(n_nb_attributes, 6);
4920 nb_defaulted = gen_int(n_nb_defaulted, 7);
4921 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4922
William M. Brackf13f77f2004-11-12 16:03:48 +00004923 xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004924 call_tests++;
4925 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004926 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4927 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4928 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004929 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004930 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004931 des_int(n_nb_attributes, nb_attributes, 6);
4932 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004933 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004934 xmlResetLastError();
4935 if (mem_base != xmlMemBlocks()) {
4936 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4937 xmlMemBlocks() - mem_base);
4938 test_ret++;
4939 printf(" %d", n_ctx);
4940 printf(" %d", n_localname);
4941 printf(" %d", n_prefix);
4942 printf(" %d", n_URI);
4943 printf(" %d", n_nb_namespaces);
4944 printf(" %d", n_namespaces);
4945 printf(" %d", n_nb_attributes);
4946 printf(" %d", n_nb_defaulted);
4947 printf(" %d", n_attributes);
4948 printf("\n");
4949 }
4950 }
4951 }
4952 }
4953 }
4954 }
4955 }
4956 }
4957 }
4958 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004959 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004960
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004961 return(test_ret);
4962}
4963
4964
4965static int
4966test_xmlSAX2UnparsedEntityDecl(void) {
4967 int test_ret = 0;
4968
4969 int mem_base;
4970 void * ctx; /* the user data (XML parser context) */
4971 int n_ctx;
4972 xmlChar * name; /* The name of the entity */
4973 int n_name;
4974 xmlChar * publicId; /* The public ID of the entity */
4975 int n_publicId;
4976 xmlChar * systemId; /* The system ID of the entity */
4977 int n_systemId;
4978 xmlChar * notationName; /* the name of the notation */
4979 int n_notationName;
4980
4981 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4982 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4983 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4984 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4985 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
4986 mem_base = xmlMemBlocks();
4987 ctx = gen_void_ptr(n_ctx, 0);
4988 name = gen_const_xmlChar_ptr(n_name, 1);
4989 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4990 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4991 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
4992
William M. Brackf13f77f2004-11-12 16:03:48 +00004993 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004994 call_tests++;
4995 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004996 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4997 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4998 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
4999 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005000 xmlResetLastError();
5001 if (mem_base != xmlMemBlocks()) {
5002 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5003 xmlMemBlocks() - mem_base);
5004 test_ret++;
5005 printf(" %d", n_ctx);
5006 printf(" %d", n_name);
5007 printf(" %d", n_publicId);
5008 printf(" %d", n_systemId);
5009 printf(" %d", n_notationName);
5010 printf("\n");
5011 }
5012 }
5013 }
5014 }
5015 }
5016 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005018
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005019 return(test_ret);
5020}
5021
5022
5023static int
5024test_xmlSAXDefaultVersion(void) {
5025 int test_ret = 0;
5026
William M. Brack21e4ef22005-01-02 09:53:13 +00005027#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005028#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005029 int mem_base;
5030 int ret_val;
5031 int version; /* the version, 1 or 2 */
5032 int n_version;
5033
5034 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5035 mem_base = xmlMemBlocks();
5036 version = gen_int(n_version, 0);
5037
5038 ret_val = xmlSAXDefaultVersion(version);
5039 desret_int(ret_val);
5040 call_tests++;
5041 des_int(n_version, version, 0);
5042 xmlResetLastError();
5043 if (mem_base != xmlMemBlocks()) {
5044 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5045 xmlMemBlocks() - mem_base);
5046 test_ret++;
5047 printf(" %d", n_version);
5048 printf("\n");
5049 }
5050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005051 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005052#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005053#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005055 return(test_ret);
5056}
5057
5058
5059static int
5060test_xmlSAXVersion(void) {
5061 int test_ret = 0;
5062
5063 int mem_base;
5064 int ret_val;
5065 xmlSAXHandler * hdlr; /* the SAX handler */
5066 int n_hdlr;
5067 int version; /* the version, 1 or 2 */
5068 int n_version;
5069
5070 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5071 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5072 mem_base = xmlMemBlocks();
5073 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5074 version = gen_int(n_version, 1);
5075
5076 ret_val = xmlSAXVersion(hdlr, version);
5077 desret_int(ret_val);
5078 call_tests++;
5079 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5080 des_int(n_version, version, 1);
5081 xmlResetLastError();
5082 if (mem_base != xmlMemBlocks()) {
5083 printf("Leak of %d blocks found in xmlSAXVersion",
5084 xmlMemBlocks() - mem_base);
5085 test_ret++;
5086 printf(" %d", n_hdlr);
5087 printf(" %d", n_version);
5088 printf("\n");
5089 }
5090 }
5091 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005093
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005094 return(test_ret);
5095}
5096
5097static int
5098test_SAX2(void) {
5099 int test_ret = 0;
5100
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005101 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005102 test_ret += test_docbDefaultSAXHandlerInit();
5103 test_ret += test_htmlDefaultSAXHandlerInit();
5104 test_ret += test_xmlDefaultSAXHandlerInit();
5105 test_ret += test_xmlSAX2AttributeDecl();
5106 test_ret += test_xmlSAX2CDataBlock();
5107 test_ret += test_xmlSAX2Characters();
5108 test_ret += test_xmlSAX2Comment();
5109 test_ret += test_xmlSAX2ElementDecl();
5110 test_ret += test_xmlSAX2EndDocument();
5111 test_ret += test_xmlSAX2EndElement();
5112 test_ret += test_xmlSAX2EndElementNs();
5113 test_ret += test_xmlSAX2EntityDecl();
5114 test_ret += test_xmlSAX2ExternalSubset();
5115 test_ret += test_xmlSAX2GetColumnNumber();
5116 test_ret += test_xmlSAX2GetEntity();
5117 test_ret += test_xmlSAX2GetLineNumber();
5118 test_ret += test_xmlSAX2GetParameterEntity();
5119 test_ret += test_xmlSAX2GetPublicId();
5120 test_ret += test_xmlSAX2GetSystemId();
5121 test_ret += test_xmlSAX2HasExternalSubset();
5122 test_ret += test_xmlSAX2HasInternalSubset();
5123 test_ret += test_xmlSAX2IgnorableWhitespace();
5124 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5125 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5126 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5127 test_ret += test_xmlSAX2InternalSubset();
5128 test_ret += test_xmlSAX2IsStandalone();
5129 test_ret += test_xmlSAX2NotationDecl();
5130 test_ret += test_xmlSAX2ProcessingInstruction();
5131 test_ret += test_xmlSAX2Reference();
5132 test_ret += test_xmlSAX2ResolveEntity();
5133 test_ret += test_xmlSAX2SetDocumentLocator();
5134 test_ret += test_xmlSAX2StartDocument();
5135 test_ret += test_xmlSAX2StartElement();
5136 test_ret += test_xmlSAX2StartElementNs();
5137 test_ret += test_xmlSAX2UnparsedEntityDecl();
5138 test_ret += test_xmlSAXDefaultVersion();
5139 test_ret += test_xmlSAXVersion();
5140
5141 if (test_ret != 0)
5142 printf("Module SAX2: %d errors\n", test_ret);
5143 return(test_ret);
5144}
5145
Daniel Veillarda82b1822004-11-08 16:24:57 +00005146static int
5147test_xmlC14NDocDumpMemory(void) {
5148 int test_ret = 0;
5149
William M. Brack21e4ef22005-01-02 09:53:13 +00005150#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005151 int mem_base;
5152 int ret_val;
5153 xmlDocPtr doc; /* the XML document for canonization */
5154 int n_doc;
5155 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5156 int n_nodes;
5157 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5158 int n_exclusive;
5159 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5160 int n_inclusive_ns_prefixes;
5161 int with_comments; /* include comments in the result (!=0) or not (==0) */
5162 int n_with_comments;
5163 xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */
5164 int n_doc_txt_ptr;
5165
5166 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5167 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5168 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5169 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5170 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5171 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5172 mem_base = xmlMemBlocks();
5173 doc = gen_xmlDocPtr(n_doc, 0);
5174 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5175 exclusive = gen_int(n_exclusive, 2);
5176 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5177 with_comments = gen_int(n_with_comments, 4);
5178 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5179
5180 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5181 desret_int(ret_val);
5182 call_tests++;
5183 des_xmlDocPtr(n_doc, doc, 0);
5184 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5185 des_int(n_exclusive, exclusive, 2);
5186 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5187 des_int(n_with_comments, with_comments, 4);
5188 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5189 xmlResetLastError();
5190 if (mem_base != xmlMemBlocks()) {
5191 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5192 xmlMemBlocks() - mem_base);
5193 test_ret++;
5194 printf(" %d", n_doc);
5195 printf(" %d", n_nodes);
5196 printf(" %d", n_exclusive);
5197 printf(" %d", n_inclusive_ns_prefixes);
5198 printf(" %d", n_with_comments);
5199 printf(" %d", n_doc_txt_ptr);
5200 printf("\n");
5201 }
5202 }
5203 }
5204 }
5205 }
5206 }
5207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005208 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005209#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005210
Daniel Veillarda82b1822004-11-08 16:24:57 +00005211 return(test_ret);
5212}
5213
5214
5215static int
5216test_xmlC14NDocSave(void) {
5217 int test_ret = 0;
5218
William M. Brack21e4ef22005-01-02 09:53:13 +00005219#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005220 int mem_base;
5221 int ret_val;
5222 xmlDocPtr doc; /* the XML document for canonization */
5223 int n_doc;
5224 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5225 int n_nodes;
5226 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5227 int n_exclusive;
5228 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5229 int n_inclusive_ns_prefixes;
5230 int with_comments; /* include comments in the result (!=0) or not (==0) */
5231 int n_with_comments;
5232 const char * filename; /* the filename to store canonical XML image */
5233 int n_filename;
5234 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5235 int n_compression;
5236
5237 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5238 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5239 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5240 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5241 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5242 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5243 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5244 mem_base = xmlMemBlocks();
5245 doc = gen_xmlDocPtr(n_doc, 0);
5246 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5247 exclusive = gen_int(n_exclusive, 2);
5248 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5249 with_comments = gen_int(n_with_comments, 4);
5250 filename = gen_fileoutput(n_filename, 5);
5251 compression = gen_int(n_compression, 6);
5252
5253 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5254 desret_int(ret_val);
5255 call_tests++;
5256 des_xmlDocPtr(n_doc, doc, 0);
5257 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5258 des_int(n_exclusive, exclusive, 2);
5259 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5260 des_int(n_with_comments, with_comments, 4);
5261 des_fileoutput(n_filename, filename, 5);
5262 des_int(n_compression, compression, 6);
5263 xmlResetLastError();
5264 if (mem_base != xmlMemBlocks()) {
5265 printf("Leak of %d blocks found in xmlC14NDocSave",
5266 xmlMemBlocks() - mem_base);
5267 test_ret++;
5268 printf(" %d", n_doc);
5269 printf(" %d", n_nodes);
5270 printf(" %d", n_exclusive);
5271 printf(" %d", n_inclusive_ns_prefixes);
5272 printf(" %d", n_with_comments);
5273 printf(" %d", n_filename);
5274 printf(" %d", n_compression);
5275 printf("\n");
5276 }
5277 }
5278 }
5279 }
5280 }
5281 }
5282 }
5283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005284 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005285#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005286
Daniel Veillarda82b1822004-11-08 16:24:57 +00005287 return(test_ret);
5288}
5289
5290
5291static int
5292test_xmlC14NDocSaveTo(void) {
5293 int test_ret = 0;
5294
William M. Brack21e4ef22005-01-02 09:53:13 +00005295#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005296 int mem_base;
5297 int ret_val;
5298 xmlDocPtr doc; /* the XML document for canonization */
5299 int n_doc;
5300 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5301 int n_nodes;
5302 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5303 int n_exclusive;
5304 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5305 int n_inclusive_ns_prefixes;
5306 int with_comments; /* include comments in the result (!=0) or not (==0) */
5307 int n_with_comments;
5308 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5309 int n_buf;
5310
5311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5312 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5313 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5314 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5315 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5316 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5317 mem_base = xmlMemBlocks();
5318 doc = gen_xmlDocPtr(n_doc, 0);
5319 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5320 exclusive = gen_int(n_exclusive, 2);
5321 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5322 with_comments = gen_int(n_with_comments, 4);
5323 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5324
5325 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5326 desret_int(ret_val);
5327 call_tests++;
5328 des_xmlDocPtr(n_doc, doc, 0);
5329 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5330 des_int(n_exclusive, exclusive, 2);
5331 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5332 des_int(n_with_comments, with_comments, 4);
5333 des_xmlOutputBufferPtr(n_buf, buf, 5);
5334 xmlResetLastError();
5335 if (mem_base != xmlMemBlocks()) {
5336 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5337 xmlMemBlocks() - mem_base);
5338 test_ret++;
5339 printf(" %d", n_doc);
5340 printf(" %d", n_nodes);
5341 printf(" %d", n_exclusive);
5342 printf(" %d", n_inclusive_ns_prefixes);
5343 printf(" %d", n_with_comments);
5344 printf(" %d", n_buf);
5345 printf("\n");
5346 }
5347 }
5348 }
5349 }
5350 }
5351 }
5352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005353 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005354#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005355
Daniel Veillarda82b1822004-11-08 16:24:57 +00005356 return(test_ret);
5357}
5358
5359
5360static int
5361test_xmlC14NExecute(void) {
5362 int test_ret = 0;
5363
5364
5365 /* missing type support */
5366 return(test_ret);
5367}
5368
5369static int
5370test_c14n(void) {
5371 int test_ret = 0;
5372
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005373 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005374 test_ret += test_xmlC14NDocDumpMemory();
5375 test_ret += test_xmlC14NDocSave();
5376 test_ret += test_xmlC14NDocSaveTo();
5377 test_ret += test_xmlC14NExecute();
5378
5379 if (test_ret != 0)
5380 printf("Module c14n: %d errors\n", test_ret);
5381 return(test_ret);
5382}
Daniel Veillarda521d282004-11-09 14:59:59 +00005383#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005384
Daniel Veillardce682bc2004-11-05 17:22:25 +00005385#define gen_nb_xmlCatalogPtr 1
5386static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5387 return(NULL);
5388}
5389static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5390}
Daniel Veillarda521d282004-11-09 14:59:59 +00005391#endif
5392
Daniel Veillardce682bc2004-11-05 17:22:25 +00005393
Daniel Veillardd93f6252004-11-02 15:53:51 +00005394static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005395test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005397
William M. Brack21e4ef22005-01-02 09:53:13 +00005398#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005399 int mem_base;
5400 int ret_val;
5401 xmlCatalogPtr catal; /* a Catalog */
5402 int n_catal;
5403 xmlChar * type; /* the type of record to add to the catalog */
5404 int n_type;
5405 xmlChar * orig; /* the system, public or prefix to match */
5406 int n_orig;
5407 xmlChar * replace; /* the replacement value for the match */
5408 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005409
Daniel Veillardce682bc2004-11-05 17:22:25 +00005410 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5411 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5412 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5413 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5414 mem_base = xmlMemBlocks();
5415 catal = gen_xmlCatalogPtr(n_catal, 0);
5416 type = gen_const_xmlChar_ptr(n_type, 1);
5417 orig = gen_const_xmlChar_ptr(n_orig, 2);
5418 replace = gen_const_xmlChar_ptr(n_replace, 3);
5419
William M. Brackf13f77f2004-11-12 16:03:48 +00005420 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005421 desret_int(ret_val);
5422 call_tests++;
5423 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005424 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5425 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5426 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005427 xmlResetLastError();
5428 if (mem_base != xmlMemBlocks()) {
5429 printf("Leak of %d blocks found in xmlACatalogAdd",
5430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005431 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005432 printf(" %d", n_catal);
5433 printf(" %d", n_type);
5434 printf(" %d", n_orig);
5435 printf(" %d", n_replace);
5436 printf("\n");
5437 }
5438 }
5439 }
5440 }
5441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005442 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005443#endif
5444
Daniel Veillard42595322004-11-08 10:52:06 +00005445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005446}
5447
5448
5449static int
5450test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005452
William M. Brack21e4ef22005-01-02 09:53:13 +00005453#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005454 int mem_base;
5455 xmlCatalogPtr catal; /* a Catalog */
5456 int n_catal;
5457 FILE * out; /* the file. */
5458 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005459
Daniel Veillardce682bc2004-11-05 17:22:25 +00005460 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5461 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5462 mem_base = xmlMemBlocks();
5463 catal = gen_xmlCatalogPtr(n_catal, 0);
5464 out = gen_FILE_ptr(n_out, 1);
5465
5466 xmlACatalogDump(catal, out);
5467 call_tests++;
5468 des_xmlCatalogPtr(n_catal, catal, 0);
5469 des_FILE_ptr(n_out, out, 1);
5470 xmlResetLastError();
5471 if (mem_base != xmlMemBlocks()) {
5472 printf("Leak of %d blocks found in xmlACatalogDump",
5473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005475 printf(" %d", n_catal);
5476 printf(" %d", n_out);
5477 printf("\n");
5478 }
5479 }
5480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005481 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005482#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005483
Daniel Veillard42595322004-11-08 10:52:06 +00005484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005485}
5486
5487
5488static int
5489test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005491
William M. Brack21e4ef22005-01-02 09:53:13 +00005492#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005493 int mem_base;
5494 int ret_val;
5495 xmlCatalogPtr catal; /* a Catalog */
5496 int n_catal;
5497 xmlChar * value; /* the value to remove */
5498 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005499
Daniel Veillardce682bc2004-11-05 17:22:25 +00005500 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5501 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5502 mem_base = xmlMemBlocks();
5503 catal = gen_xmlCatalogPtr(n_catal, 0);
5504 value = gen_const_xmlChar_ptr(n_value, 1);
5505
William M. Brackf13f77f2004-11-12 16:03:48 +00005506 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005507 desret_int(ret_val);
5508 call_tests++;
5509 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005510 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005511 xmlResetLastError();
5512 if (mem_base != xmlMemBlocks()) {
5513 printf("Leak of %d blocks found in xmlACatalogRemove",
5514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005516 printf(" %d", n_catal);
5517 printf(" %d", n_value);
5518 printf("\n");
5519 }
5520 }
5521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005522 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005523#endif
5524
Daniel Veillard42595322004-11-08 10:52:06 +00005525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005526}
5527
5528
5529static int
5530test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005532
William M. Brack21e4ef22005-01-02 09:53:13 +00005533#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005534 int mem_base;
5535 xmlChar * ret_val;
5536 xmlCatalogPtr catal; /* a Catalog */
5537 int n_catal;
5538 xmlChar * pubID; /* the public ID string */
5539 int n_pubID;
5540 xmlChar * sysID; /* the system ID string */
5541 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005542
Daniel Veillardce682bc2004-11-05 17:22:25 +00005543 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5544 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5545 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5546 mem_base = xmlMemBlocks();
5547 catal = gen_xmlCatalogPtr(n_catal, 0);
5548 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5549 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5550
William M. Brackf13f77f2004-11-12 16:03:48 +00005551 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005552 desret_xmlChar_ptr(ret_val);
5553 call_tests++;
5554 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005555 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5556 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005557 xmlResetLastError();
5558 if (mem_base != xmlMemBlocks()) {
5559 printf("Leak of %d blocks found in xmlACatalogResolve",
5560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005561 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005562 printf(" %d", n_catal);
5563 printf(" %d", n_pubID);
5564 printf(" %d", n_sysID);
5565 printf("\n");
5566 }
5567 }
5568 }
5569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005570 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005571#endif
5572
Daniel Veillard42595322004-11-08 10:52:06 +00005573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005574}
5575
5576
5577static int
5578test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005580
William M. Brack21e4ef22005-01-02 09:53:13 +00005581#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005582 int mem_base;
5583 xmlChar * ret_val;
5584 xmlCatalogPtr catal; /* a Catalog */
5585 int n_catal;
5586 xmlChar * pubID; /* the public ID string */
5587 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005588
Daniel Veillardce682bc2004-11-05 17:22:25 +00005589 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5590 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5591 mem_base = xmlMemBlocks();
5592 catal = gen_xmlCatalogPtr(n_catal, 0);
5593 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5594
William M. Brackf13f77f2004-11-12 16:03:48 +00005595 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005596 desret_xmlChar_ptr(ret_val);
5597 call_tests++;
5598 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005599 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005600 xmlResetLastError();
5601 if (mem_base != xmlMemBlocks()) {
5602 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005604 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005605 printf(" %d", n_catal);
5606 printf(" %d", n_pubID);
5607 printf("\n");
5608 }
5609 }
5610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005611 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005612#endif
5613
Daniel Veillard42595322004-11-08 10:52:06 +00005614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005615}
5616
5617
5618static int
5619test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005621
William M. Brack21e4ef22005-01-02 09:53:13 +00005622#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005623 int mem_base;
5624 xmlChar * ret_val;
5625 xmlCatalogPtr catal; /* a Catalog */
5626 int n_catal;
5627 xmlChar * sysID; /* the system ID string */
5628 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005629
Daniel Veillardce682bc2004-11-05 17:22:25 +00005630 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5631 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5632 mem_base = xmlMemBlocks();
5633 catal = gen_xmlCatalogPtr(n_catal, 0);
5634 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5635
William M. Brackf13f77f2004-11-12 16:03:48 +00005636 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005637 desret_xmlChar_ptr(ret_val);
5638 call_tests++;
5639 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005640 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005641 xmlResetLastError();
5642 if (mem_base != xmlMemBlocks()) {
5643 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005645 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005646 printf(" %d", n_catal);
5647 printf(" %d", n_sysID);
5648 printf("\n");
5649 }
5650 }
5651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005652 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005653#endif
5654
Daniel Veillard42595322004-11-08 10:52:06 +00005655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005656}
5657
5658
5659static int
5660test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005662
William M. Brack21e4ef22005-01-02 09:53:13 +00005663#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005664 int mem_base;
5665 xmlChar * ret_val;
5666 xmlCatalogPtr catal; /* a Catalog */
5667 int n_catal;
5668 xmlChar * URI; /* the URI */
5669 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005670
Daniel Veillardce682bc2004-11-05 17:22:25 +00005671 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5672 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5673 mem_base = xmlMemBlocks();
5674 catal = gen_xmlCatalogPtr(n_catal, 0);
5675 URI = gen_const_xmlChar_ptr(n_URI, 1);
5676
William M. Brackf13f77f2004-11-12 16:03:48 +00005677 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005678 desret_xmlChar_ptr(ret_val);
5679 call_tests++;
5680 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005681 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005682 xmlResetLastError();
5683 if (mem_base != xmlMemBlocks()) {
5684 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005686 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005687 printf(" %d", n_catal);
5688 printf(" %d", n_URI);
5689 printf("\n");
5690 }
5691 }
5692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005693 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005694#endif
5695
Daniel Veillard42595322004-11-08 10:52:06 +00005696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005697}
5698
5699
5700static int
5701test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005703
William M. Brack21e4ef22005-01-02 09:53:13 +00005704#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005705 int mem_base;
5706 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005707 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005708 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005709 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005710 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005711 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005712 int n_replace;
5713
5714 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5715 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5716 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005718 type = gen_const_xmlChar_ptr(n_type, 0);
5719 orig = gen_const_xmlChar_ptr(n_orig, 1);
5720 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005721
William M. Brackf13f77f2004-11-12 16:03:48 +00005722 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005723 desret_int(ret_val);
5724 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005725 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5726 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5727 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005728 xmlResetLastError();
5729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005730 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005733 printf(" %d", n_type);
5734 printf(" %d", n_orig);
5735 printf(" %d", n_replace);
5736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005737 }
5738 }
5739 }
5740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005741 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005742#endif
5743
Daniel Veillard42595322004-11-08 10:52:06 +00005744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005745}
5746
5747
5748static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005749test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005751
William M. Brack21e4ef22005-01-02 09:53:13 +00005752#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005753
Daniel Veillardd93f6252004-11-02 15:53:51 +00005754
5755 xmlCatalogCleanup();
5756 call_tests++;
5757 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005758 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759#endif
5760
Daniel Veillard42595322004-11-08 10:52:06 +00005761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005762}
5763
5764
5765static int
5766test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005768
William M. Brack21e4ef22005-01-02 09:53:13 +00005769#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005770 int ret_val;
5771
5772
5773 ret_val = xmlCatalogConvert();
5774 desret_int(ret_val);
5775 call_tests++;
5776 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005777 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778#endif
5779
Daniel Veillard42595322004-11-08 10:52:06 +00005780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005781}
5782
5783
5784static int
5785test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005787
William M. Brack21e4ef22005-01-02 09:53:13 +00005788#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005789 int mem_base;
5790 FILE * out; /* the file. */
5791 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005792
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005793 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5794 mem_base = xmlMemBlocks();
5795 out = gen_FILE_ptr(n_out, 0);
5796
5797 xmlCatalogDump(out);
5798 call_tests++;
5799 des_FILE_ptr(n_out, out, 0);
5800 xmlResetLastError();
5801 if (mem_base != xmlMemBlocks()) {
5802 printf("Leak of %d blocks found in xmlCatalogDump",
5803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005804 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005805 printf(" %d", n_out);
5806 printf("\n");
5807 }
5808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005809 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005810#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005811
Daniel Veillard42595322004-11-08 10:52:06 +00005812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005813}
5814
5815
5816static int
5817test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005819
William M. Brack21e4ef22005-01-02 09:53:13 +00005820#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005821 int mem_base;
5822 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823
Daniel Veillard57b25162004-11-06 14:50:18 +00005824 mem_base = xmlMemBlocks();
5825
5826 ret_val = xmlCatalogGetDefaults();
5827 desret_xmlCatalogAllow(ret_val);
5828 call_tests++;
5829 xmlResetLastError();
5830 if (mem_base != xmlMemBlocks()) {
5831 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005833 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005834 printf("\n");
5835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005836 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005837#endif
5838
Daniel Veillard42595322004-11-08 10:52:06 +00005839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005840}
5841
5842
5843static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005844test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005846
William M. Brack21e4ef22005-01-02 09:53:13 +00005847#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005848 int mem_base;
5849 int ret_val;
5850 xmlCatalogPtr catal; /* should this create an SGML catalog */
5851 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005852
Daniel Veillardce682bc2004-11-05 17:22:25 +00005853 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5854 mem_base = xmlMemBlocks();
5855 catal = gen_xmlCatalogPtr(n_catal, 0);
5856
5857 ret_val = xmlCatalogIsEmpty(catal);
5858 desret_int(ret_val);
5859 call_tests++;
5860 des_xmlCatalogPtr(n_catal, catal, 0);
5861 xmlResetLastError();
5862 if (mem_base != xmlMemBlocks()) {
5863 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005865 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005866 printf(" %d", n_catal);
5867 printf("\n");
5868 }
5869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005870 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005871#endif
5872
Daniel Veillard42595322004-11-08 10:52:06 +00005873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005874}
5875
5876
5877static int
5878test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880
William M. Brack21e4ef22005-01-02 09:53:13 +00005881#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005882 int mem_base;
5883 xmlChar * ret_val;
5884 void * catalogs; /* a document's list of catalogs */
5885 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005886 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005887 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005888 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005889 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005890
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005891 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5892 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5893 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005895 catalogs = gen_void_ptr(n_catalogs, 0);
5896 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5897 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005898
William M. Brackf13f77f2004-11-12 16:03:48 +00005899 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005900 desret_xmlChar_ptr(ret_val);
5901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005902 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005903 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5904 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005905 xmlResetLastError();
5906 if (mem_base != xmlMemBlocks()) {
5907 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005909 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005910 printf(" %d", n_catalogs);
5911 printf(" %d", n_pubID);
5912 printf(" %d", n_sysID);
5913 printf("\n");
5914 }
5915 }
5916 }
5917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005918 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005919#endif
5920
Daniel Veillard42595322004-11-08 10:52:06 +00005921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005922}
5923
5924
5925static int
5926test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005928
William M. Brack21e4ef22005-01-02 09:53:13 +00005929#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005930 int mem_base;
5931 xmlChar * ret_val;
5932 void * catalogs; /* a document's list of catalogs */
5933 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005934 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005935 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005936
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005937 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5938 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005940 catalogs = gen_void_ptr(n_catalogs, 0);
5941 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005942
William M. Brackf13f77f2004-11-12 16:03:48 +00005943 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005944 desret_xmlChar_ptr(ret_val);
5945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005946 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005947 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005948 xmlResetLastError();
5949 if (mem_base != xmlMemBlocks()) {
5950 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005952 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005953 printf(" %d", n_catalogs);
5954 printf(" %d", n_URI);
5955 printf("\n");
5956 }
5957 }
5958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005959 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005960#endif
5961
Daniel Veillard42595322004-11-08 10:52:06 +00005962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005963}
5964
5965
5966static int
5967test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005969
William M. Brack21e4ef22005-01-02 09:53:13 +00005970#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005971 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005972 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005973 int n_value;
5974
5975 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00005976 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005977
William M. Brackf13f77f2004-11-12 16:03:48 +00005978 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005979 desret_int(ret_val);
5980 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005981 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005982 xmlResetLastError();
5983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005984 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005985#endif
5986
Daniel Veillard42595322004-11-08 10:52:06 +00005987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005988}
5989
5990
5991static int
5992test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005994
William M. Brack21e4ef22005-01-02 09:53:13 +00005995#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005996 int mem_base;
5997 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005998 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005999 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006000 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006001 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006002
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006003 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6004 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006006 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6007 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006008
William M. Brackf13f77f2004-11-12 16:03:48 +00006009 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006010 desret_xmlChar_ptr(ret_val);
6011 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006012 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6013 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006014 xmlResetLastError();
6015 if (mem_base != xmlMemBlocks()) {
6016 printf("Leak of %d blocks found in xmlCatalogResolve",
6017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006018 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006019 printf(" %d", n_pubID);
6020 printf(" %d", n_sysID);
6021 printf("\n");
6022 }
6023 }
6024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006025 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006026#endif
6027
Daniel Veillard42595322004-11-08 10:52:06 +00006028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006029}
6030
6031
6032static int
6033test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006035
William M. Brack21e4ef22005-01-02 09:53:13 +00006036#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006037 int mem_base;
6038 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006039 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006040 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006041
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006042 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6043 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006044 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006045
William M. Brackf13f77f2004-11-12 16:03:48 +00006046 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006047 desret_xmlChar_ptr(ret_val);
6048 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006049 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006050 xmlResetLastError();
6051 if (mem_base != xmlMemBlocks()) {
6052 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006054 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006055 printf(" %d", n_pubID);
6056 printf("\n");
6057 }
6058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006059 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006060#endif
6061
Daniel Veillard42595322004-11-08 10:52:06 +00006062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006063}
6064
6065
6066static int
6067test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006069
William M. Brack21e4ef22005-01-02 09:53:13 +00006070#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006071 int mem_base;
6072 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006073 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006074 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006075
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006078 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006079
William M. Brackf13f77f2004-11-12 16:03:48 +00006080 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081 desret_xmlChar_ptr(ret_val);
6082 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006083 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006084 xmlResetLastError();
6085 if (mem_base != xmlMemBlocks()) {
6086 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006088 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006089 printf(" %d", n_sysID);
6090 printf("\n");
6091 }
6092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006093 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006094#endif
6095
Daniel Veillard42595322004-11-08 10:52:06 +00006096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006097}
6098
6099
6100static int
6101test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006103
William M. Brack21e4ef22005-01-02 09:53:13 +00006104#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006105 int mem_base;
6106 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006107 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006108 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006109
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6111 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006112 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006113
William M. Brackf13f77f2004-11-12 16:03:48 +00006114 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115 desret_xmlChar_ptr(ret_val);
6116 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006117 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006118 xmlResetLastError();
6119 if (mem_base != xmlMemBlocks()) {
6120 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006122 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006123 printf(" %d", n_URI);
6124 printf("\n");
6125 }
6126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006127 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006128#endif
6129
Daniel Veillard42595322004-11-08 10:52:06 +00006130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006131}
6132
6133
6134static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006135test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006137
William M. Brack21e4ef22005-01-02 09:53:13 +00006138#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006139 int mem_base;
6140 xmlCatalogPrefer ret_val;
6141 xmlCatalogPrefer prefer; /* the default preference for delegation */
6142 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006143
Daniel Veillard57b25162004-11-06 14:50:18 +00006144 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6145 mem_base = xmlMemBlocks();
6146 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6147
6148 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6149 desret_xmlCatalogPrefer(ret_val);
6150 call_tests++;
6151 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6152 xmlResetLastError();
6153 if (mem_base != xmlMemBlocks()) {
6154 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006156 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006157 printf(" %d", n_prefer);
6158 printf("\n");
6159 }
6160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006161 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006162#endif
6163
Daniel Veillard42595322004-11-08 10:52:06 +00006164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006165}
6166
6167
6168static int
6169test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006171
William M. Brack21e4ef22005-01-02 09:53:13 +00006172#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006173 int mem_base;
6174 xmlCatalogAllow allow; /* what catalogs should be accepted */
6175 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006176
Daniel Veillard57b25162004-11-06 14:50:18 +00006177 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6178 mem_base = xmlMemBlocks();
6179 allow = gen_xmlCatalogAllow(n_allow, 0);
6180
6181 xmlCatalogSetDefaults(allow);
6182 call_tests++;
6183 des_xmlCatalogAllow(n_allow, allow, 0);
6184 xmlResetLastError();
6185 if (mem_base != xmlMemBlocks()) {
6186 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006188 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006189 printf(" %d", n_allow);
6190 printf("\n");
6191 }
6192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006193 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006194#endif
6195
Daniel Veillard42595322004-11-08 10:52:06 +00006196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006197}
6198
6199
6200static int
6201test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006203
William M. Brack21e4ef22005-01-02 09:53:13 +00006204#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006205 int mem_base;
6206 int ret_val;
6207 xmlCatalogPtr catal; /* the catalog */
6208 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006209
Daniel Veillardce682bc2004-11-05 17:22:25 +00006210 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6211 mem_base = xmlMemBlocks();
6212 catal = gen_xmlCatalogPtr(n_catal, 0);
6213
6214 ret_val = xmlConvertSGMLCatalog(catal);
6215 desret_int(ret_val);
6216 call_tests++;
6217 des_xmlCatalogPtr(n_catal, catal, 0);
6218 xmlResetLastError();
6219 if (mem_base != xmlMemBlocks()) {
6220 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006222 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006223 printf(" %d", n_catal);
6224 printf("\n");
6225 }
6226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006227 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006228#endif
6229
Daniel Veillard42595322004-11-08 10:52:06 +00006230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006231}
6232
6233
6234static int
6235test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006237
William M. Brack21e4ef22005-01-02 09:53:13 +00006238#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006239 int mem_base;
6240
6241 mem_base = xmlMemBlocks();
6242
6243 xmlInitializeCatalog();
6244 call_tests++;
6245 xmlResetLastError();
6246 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006247 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006249 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006250 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006252 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006253#endif
6254
Daniel Veillard42595322004-11-08 10:52:06 +00006255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006256}
6257
6258
6259static int
6260test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006262
6263
6264 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006266}
6267
6268
6269static int
6270test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006272
William M. Brack21e4ef22005-01-02 09:53:13 +00006273#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006274 int ret_val;
6275 const char * filename; /* a file path */
6276 int n_filename;
6277
6278 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006279 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006280
6281 ret_val = xmlLoadCatalog(filename);
6282 desret_int(ret_val);
6283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006284 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006285 xmlResetLastError();
6286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006287 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006288#endif
6289
Daniel Veillard42595322004-11-08 10:52:06 +00006290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006291}
6292
6293
6294static int
6295test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006297
William M. Brack21e4ef22005-01-02 09:53:13 +00006298#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006299 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006300 int n_pathss;
6301
6302 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006303 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006304
William M. Brackf13f77f2004-11-12 16:03:48 +00006305 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006306 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006307 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308 xmlResetLastError();
6309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006310 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006311#endif
6312
Daniel Veillard42595322004-11-08 10:52:06 +00006313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006314}
6315
6316
6317static int
6318test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006320
6321
6322 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006324}
6325
6326
6327static int
6328test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006330
6331
6332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006334}
6335
6336
6337static int
6338test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006340
William M. Brack21e4ef22005-01-02 09:53:13 +00006341#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342 int mem_base;
6343 xmlDocPtr ret_val;
6344 const char * filename; /* the filename */
6345 int n_filename;
6346
6347 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6348 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006349 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006350
6351 ret_val = xmlParseCatalogFile(filename);
6352 desret_xmlDocPtr(ret_val);
6353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006354 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006355 xmlResetLastError();
6356 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006357 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006359 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006360 printf(" %d", n_filename);
6361 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006362 }
6363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006364 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006365#endif
6366
Daniel Veillard42595322004-11-08 10:52:06 +00006367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006368}
6369
6370static int
6371test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006373
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006374 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006375 test_ret += test_xmlACatalogAdd();
6376 test_ret += test_xmlACatalogDump();
6377 test_ret += test_xmlACatalogRemove();
6378 test_ret += test_xmlACatalogResolve();
6379 test_ret += test_xmlACatalogResolvePublic();
6380 test_ret += test_xmlACatalogResolveSystem();
6381 test_ret += test_xmlACatalogResolveURI();
6382 test_ret += test_xmlCatalogAdd();
6383 test_ret += test_xmlCatalogCleanup();
6384 test_ret += test_xmlCatalogConvert();
6385 test_ret += test_xmlCatalogDump();
6386 test_ret += test_xmlCatalogGetDefaults();
6387 test_ret += test_xmlCatalogIsEmpty();
6388 test_ret += test_xmlCatalogLocalResolve();
6389 test_ret += test_xmlCatalogLocalResolveURI();
6390 test_ret += test_xmlCatalogRemove();
6391 test_ret += test_xmlCatalogResolve();
6392 test_ret += test_xmlCatalogResolvePublic();
6393 test_ret += test_xmlCatalogResolveSystem();
6394 test_ret += test_xmlCatalogResolveURI();
6395 test_ret += test_xmlCatalogSetDefaultPrefer();
6396 test_ret += test_xmlCatalogSetDefaults();
6397 test_ret += test_xmlConvertSGMLCatalog();
6398 test_ret += test_xmlInitializeCatalog();
6399 test_ret += test_xmlLoadACatalog();
6400 test_ret += test_xmlLoadCatalog();
6401 test_ret += test_xmlLoadCatalogs();
6402 test_ret += test_xmlLoadSGMLSuperCatalog();
6403 test_ret += test_xmlNewCatalog();
6404 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006405
Daniel Veillard42595322004-11-08 10:52:06 +00006406 if (test_ret != 0)
6407 printf("Module catalog: %d errors\n", test_ret);
6408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006409}
6410
Daniel Veillardce682bc2004-11-05 17:22:25 +00006411#define gen_nb_const_xmlChRangeGroupPtr 1
6412static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6413 return(NULL);
6414}
6415static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6416}
6417
Daniel Veillardd93f6252004-11-02 15:53:51 +00006418static int
6419test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006421
Daniel Veillardce682bc2004-11-05 17:22:25 +00006422 int mem_base;
6423 int ret_val;
6424 unsigned int val; /* character to be validated */
6425 int n_val;
6426 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6427 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006428
Daniel Veillardce682bc2004-11-05 17:22:25 +00006429 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6430 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6431 mem_base = xmlMemBlocks();
6432 val = gen_unsigned_int(n_val, 0);
6433 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6434
William M. Brackf13f77f2004-11-12 16:03:48 +00006435 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006436 desret_int(ret_val);
6437 call_tests++;
6438 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006439 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006440 xmlResetLastError();
6441 if (mem_base != xmlMemBlocks()) {
6442 printf("Leak of %d blocks found in xmlCharInRange",
6443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006444 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006445 printf(" %d", n_val);
6446 printf(" %d", n_rptr);
6447 printf("\n");
6448 }
6449 }
6450 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006451 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006452
Daniel Veillard42595322004-11-08 10:52:06 +00006453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454}
6455
6456
6457static int
6458test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006460
Daniel Veillard3d97e662004-11-04 10:49:00 +00006461 int mem_base;
6462 int ret_val;
6463 unsigned int ch; /* character to validate */
6464 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006465
Daniel Veillard3d97e662004-11-04 10:49:00 +00006466 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6467 mem_base = xmlMemBlocks();
6468 ch = gen_unsigned_int(n_ch, 0);
6469
6470 ret_val = xmlIsBaseChar(ch);
6471 desret_int(ret_val);
6472 call_tests++;
6473 des_unsigned_int(n_ch, ch, 0);
6474 xmlResetLastError();
6475 if (mem_base != xmlMemBlocks()) {
6476 printf("Leak of %d blocks found in xmlIsBaseChar",
6477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006478 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006479 printf(" %d", n_ch);
6480 printf("\n");
6481 }
6482 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006484
Daniel Veillard42595322004-11-08 10:52:06 +00006485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006486}
6487
6488
6489static int
6490test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006492
Daniel Veillard3d97e662004-11-04 10:49:00 +00006493 int mem_base;
6494 int ret_val;
6495 unsigned int ch; /* character to validate */
6496 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006497
Daniel Veillard3d97e662004-11-04 10:49:00 +00006498 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6499 mem_base = xmlMemBlocks();
6500 ch = gen_unsigned_int(n_ch, 0);
6501
6502 ret_val = xmlIsBlank(ch);
6503 desret_int(ret_val);
6504 call_tests++;
6505 des_unsigned_int(n_ch, ch, 0);
6506 xmlResetLastError();
6507 if (mem_base != xmlMemBlocks()) {
6508 printf("Leak of %d blocks found in xmlIsBlank",
6509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006510 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006511 printf(" %d", n_ch);
6512 printf("\n");
6513 }
6514 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006516
Daniel Veillard42595322004-11-08 10:52:06 +00006517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006518}
6519
6520
6521static int
6522test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006524
Daniel Veillard3d97e662004-11-04 10:49:00 +00006525 int mem_base;
6526 int ret_val;
6527 unsigned int ch; /* character to validate */
6528 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006529
Daniel Veillard3d97e662004-11-04 10:49:00 +00006530 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6531 mem_base = xmlMemBlocks();
6532 ch = gen_unsigned_int(n_ch, 0);
6533
6534 ret_val = xmlIsChar(ch);
6535 desret_int(ret_val);
6536 call_tests++;
6537 des_unsigned_int(n_ch, ch, 0);
6538 xmlResetLastError();
6539 if (mem_base != xmlMemBlocks()) {
6540 printf("Leak of %d blocks found in xmlIsChar",
6541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006542 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006543 printf(" %d", n_ch);
6544 printf("\n");
6545 }
6546 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006548
Daniel Veillard42595322004-11-08 10:52:06 +00006549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006550}
6551
6552
6553static int
6554test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006556
Daniel Veillard3d97e662004-11-04 10:49:00 +00006557 int mem_base;
6558 int ret_val;
6559 unsigned int ch; /* character to validate */
6560 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006561
Daniel Veillard3d97e662004-11-04 10:49:00 +00006562 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6563 mem_base = xmlMemBlocks();
6564 ch = gen_unsigned_int(n_ch, 0);
6565
6566 ret_val = xmlIsCombining(ch);
6567 desret_int(ret_val);
6568 call_tests++;
6569 des_unsigned_int(n_ch, ch, 0);
6570 xmlResetLastError();
6571 if (mem_base != xmlMemBlocks()) {
6572 printf("Leak of %d blocks found in xmlIsCombining",
6573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006574 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006575 printf(" %d", n_ch);
6576 printf("\n");
6577 }
6578 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006580
Daniel Veillard42595322004-11-08 10:52:06 +00006581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006582}
6583
6584
6585static int
6586test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006588
Daniel Veillard3d97e662004-11-04 10:49:00 +00006589 int mem_base;
6590 int ret_val;
6591 unsigned int ch; /* character to validate */
6592 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006593
Daniel Veillard3d97e662004-11-04 10:49:00 +00006594 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6595 mem_base = xmlMemBlocks();
6596 ch = gen_unsigned_int(n_ch, 0);
6597
6598 ret_val = xmlIsDigit(ch);
6599 desret_int(ret_val);
6600 call_tests++;
6601 des_unsigned_int(n_ch, ch, 0);
6602 xmlResetLastError();
6603 if (mem_base != xmlMemBlocks()) {
6604 printf("Leak of %d blocks found in xmlIsDigit",
6605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006606 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006607 printf(" %d", n_ch);
6608 printf("\n");
6609 }
6610 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006612
Daniel Veillard42595322004-11-08 10:52:06 +00006613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006614}
6615
6616
6617static int
6618test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006620
Daniel Veillard3d97e662004-11-04 10:49:00 +00006621 int mem_base;
6622 int ret_val;
6623 unsigned int ch; /* character to validate */
6624 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006625
Daniel Veillard3d97e662004-11-04 10:49:00 +00006626 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6627 mem_base = xmlMemBlocks();
6628 ch = gen_unsigned_int(n_ch, 0);
6629
6630 ret_val = xmlIsExtender(ch);
6631 desret_int(ret_val);
6632 call_tests++;
6633 des_unsigned_int(n_ch, ch, 0);
6634 xmlResetLastError();
6635 if (mem_base != xmlMemBlocks()) {
6636 printf("Leak of %d blocks found in xmlIsExtender",
6637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006638 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006639 printf(" %d", n_ch);
6640 printf("\n");
6641 }
6642 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006644
Daniel Veillard42595322004-11-08 10:52:06 +00006645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006646}
6647
6648
6649static int
6650test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006652
Daniel Veillard3d97e662004-11-04 10:49:00 +00006653 int mem_base;
6654 int ret_val;
6655 unsigned int ch; /* character to validate */
6656 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006657
Daniel Veillard3d97e662004-11-04 10:49:00 +00006658 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6659 mem_base = xmlMemBlocks();
6660 ch = gen_unsigned_int(n_ch, 0);
6661
6662 ret_val = xmlIsIdeographic(ch);
6663 desret_int(ret_val);
6664 call_tests++;
6665 des_unsigned_int(n_ch, ch, 0);
6666 xmlResetLastError();
6667 if (mem_base != xmlMemBlocks()) {
6668 printf("Leak of %d blocks found in xmlIsIdeographic",
6669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006670 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006671 printf(" %d", n_ch);
6672 printf("\n");
6673 }
6674 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006676
Daniel Veillard42595322004-11-08 10:52:06 +00006677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006678}
6679
6680
6681static int
6682test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006684
Daniel Veillard3d97e662004-11-04 10:49:00 +00006685 int mem_base;
6686 int ret_val;
6687 unsigned int ch; /* character to validate */
6688 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006689
Daniel Veillard3d97e662004-11-04 10:49:00 +00006690 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6691 mem_base = xmlMemBlocks();
6692 ch = gen_unsigned_int(n_ch, 0);
6693
6694 ret_val = xmlIsPubidChar(ch);
6695 desret_int(ret_val);
6696 call_tests++;
6697 des_unsigned_int(n_ch, ch, 0);
6698 xmlResetLastError();
6699 if (mem_base != xmlMemBlocks()) {
6700 printf("Leak of %d blocks found in xmlIsPubidChar",
6701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006702 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006703 printf(" %d", n_ch);
6704 printf("\n");
6705 }
6706 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006707 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006708
Daniel Veillard42595322004-11-08 10:52:06 +00006709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006710}
6711
6712static int
6713test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006715
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006716 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006717 test_ret += test_xmlCharInRange();
6718 test_ret += test_xmlIsBaseChar();
6719 test_ret += test_xmlIsBlank();
6720 test_ret += test_xmlIsChar();
6721 test_ret += test_xmlIsCombining();
6722 test_ret += test_xmlIsDigit();
6723 test_ret += test_xmlIsExtender();
6724 test_ret += test_xmlIsIdeographic();
6725 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006726
Daniel Veillard42595322004-11-08 10:52:06 +00006727 if (test_ret != 0)
6728 printf("Module chvalid: %d errors\n", test_ret);
6729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006730}
6731
6732static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006733test_xmlBoolToText(void) {
6734 int test_ret = 0;
6735
William M. Brack21e4ef22005-01-02 09:53:13 +00006736#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006737 int mem_base;
6738 const char * ret_val;
6739 int boolval; /* a bool to turn into text */
6740 int n_boolval;
6741
6742 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6743 mem_base = xmlMemBlocks();
6744 boolval = gen_int(n_boolval, 0);
6745
6746 ret_val = xmlBoolToText(boolval);
6747 desret_const_char_ptr(ret_val);
6748 call_tests++;
6749 des_int(n_boolval, boolval, 0);
6750 xmlResetLastError();
6751 if (mem_base != xmlMemBlocks()) {
6752 printf("Leak of %d blocks found in xmlBoolToText",
6753 xmlMemBlocks() - mem_base);
6754 test_ret++;
6755 printf(" %d", n_boolval);
6756 printf("\n");
6757 }
6758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006759 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006760#endif
6761
Daniel Veillarda82b1822004-11-08 16:24:57 +00006762 return(test_ret);
6763}
6764
6765
6766static int
6767test_xmlDebugCheckDocument(void) {
6768 int test_ret = 0;
6769
William M. Brack21e4ef22005-01-02 09:53:13 +00006770#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006771 int mem_base;
6772 int ret_val;
6773 FILE * output; /* the FILE * for the output */
6774 int n_output;
6775 xmlDocPtr doc; /* the document */
6776 int n_doc;
6777
6778 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6779 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6780 mem_base = xmlMemBlocks();
6781 output = gen_debug_FILE_ptr(n_output, 0);
6782 doc = gen_xmlDocPtr(n_doc, 1);
6783
6784 ret_val = xmlDebugCheckDocument(output, doc);
6785 desret_int(ret_val);
6786 call_tests++;
6787 des_debug_FILE_ptr(n_output, output, 0);
6788 des_xmlDocPtr(n_doc, doc, 1);
6789 xmlResetLastError();
6790 if (mem_base != xmlMemBlocks()) {
6791 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6792 xmlMemBlocks() - mem_base);
6793 test_ret++;
6794 printf(" %d", n_output);
6795 printf(" %d", n_doc);
6796 printf("\n");
6797 }
6798 }
6799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006800 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006801#endif
6802
Daniel Veillarda82b1822004-11-08 16:24:57 +00006803 return(test_ret);
6804}
6805
6806
6807static int
6808test_xmlDebugDumpAttr(void) {
6809 int test_ret = 0;
6810
William M. Brack21e4ef22005-01-02 09:53:13 +00006811#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006812 int mem_base;
6813 FILE * output; /* the FILE * for the output */
6814 int n_output;
6815 xmlAttrPtr attr; /* the attribute */
6816 int n_attr;
6817 int depth; /* the indentation level. */
6818 int n_depth;
6819
6820 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6821 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6822 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6823 mem_base = xmlMemBlocks();
6824 output = gen_debug_FILE_ptr(n_output, 0);
6825 attr = gen_xmlAttrPtr(n_attr, 1);
6826 depth = gen_int(n_depth, 2);
6827
6828 xmlDebugDumpAttr(output, attr, depth);
6829 call_tests++;
6830 des_debug_FILE_ptr(n_output, output, 0);
6831 des_xmlAttrPtr(n_attr, attr, 1);
6832 des_int(n_depth, depth, 2);
6833 xmlResetLastError();
6834 if (mem_base != xmlMemBlocks()) {
6835 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6836 xmlMemBlocks() - mem_base);
6837 test_ret++;
6838 printf(" %d", n_output);
6839 printf(" %d", n_attr);
6840 printf(" %d", n_depth);
6841 printf("\n");
6842 }
6843 }
6844 }
6845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006846 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006847#endif
6848
Daniel Veillarda82b1822004-11-08 16:24:57 +00006849 return(test_ret);
6850}
6851
6852
6853static int
6854test_xmlDebugDumpAttrList(void) {
6855 int test_ret = 0;
6856
William M. Brack21e4ef22005-01-02 09:53:13 +00006857#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006858 int mem_base;
6859 FILE * output; /* the FILE * for the output */
6860 int n_output;
6861 xmlAttrPtr attr; /* the attribute list */
6862 int n_attr;
6863 int depth; /* the indentation level. */
6864 int n_depth;
6865
6866 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6867 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6868 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6869 mem_base = xmlMemBlocks();
6870 output = gen_debug_FILE_ptr(n_output, 0);
6871 attr = gen_xmlAttrPtr(n_attr, 1);
6872 depth = gen_int(n_depth, 2);
6873
6874 xmlDebugDumpAttrList(output, attr, depth);
6875 call_tests++;
6876 des_debug_FILE_ptr(n_output, output, 0);
6877 des_xmlAttrPtr(n_attr, attr, 1);
6878 des_int(n_depth, depth, 2);
6879 xmlResetLastError();
6880 if (mem_base != xmlMemBlocks()) {
6881 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6882 xmlMemBlocks() - mem_base);
6883 test_ret++;
6884 printf(" %d", n_output);
6885 printf(" %d", n_attr);
6886 printf(" %d", n_depth);
6887 printf("\n");
6888 }
6889 }
6890 }
6891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006892 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006893#endif
6894
Daniel Veillarda82b1822004-11-08 16:24:57 +00006895 return(test_ret);
6896}
6897
6898
6899static int
6900test_xmlDebugDumpDTD(void) {
6901 int test_ret = 0;
6902
William M. Brack21e4ef22005-01-02 09:53:13 +00006903#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006904 int mem_base;
6905 FILE * output; /* the FILE * for the output */
6906 int n_output;
6907 xmlDtdPtr dtd; /* the DTD */
6908 int n_dtd;
6909
6910 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6911 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6912 mem_base = xmlMemBlocks();
6913 output = gen_debug_FILE_ptr(n_output, 0);
6914 dtd = gen_xmlDtdPtr(n_dtd, 1);
6915
6916 xmlDebugDumpDTD(output, dtd);
6917 call_tests++;
6918 des_debug_FILE_ptr(n_output, output, 0);
6919 des_xmlDtdPtr(n_dtd, dtd, 1);
6920 xmlResetLastError();
6921 if (mem_base != xmlMemBlocks()) {
6922 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6923 xmlMemBlocks() - mem_base);
6924 test_ret++;
6925 printf(" %d", n_output);
6926 printf(" %d", n_dtd);
6927 printf("\n");
6928 }
6929 }
6930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006931 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006932#endif
6933
Daniel Veillarda82b1822004-11-08 16:24:57 +00006934 return(test_ret);
6935}
6936
6937
6938static int
6939test_xmlDebugDumpDocument(void) {
6940 int test_ret = 0;
6941
William M. Brack21e4ef22005-01-02 09:53:13 +00006942#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006943 int mem_base;
6944 FILE * output; /* the FILE * for the output */
6945 int n_output;
6946 xmlDocPtr doc; /* the document */
6947 int n_doc;
6948
6949 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6950 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6951 mem_base = xmlMemBlocks();
6952 output = gen_debug_FILE_ptr(n_output, 0);
6953 doc = gen_xmlDocPtr(n_doc, 1);
6954
6955 xmlDebugDumpDocument(output, doc);
6956 call_tests++;
6957 des_debug_FILE_ptr(n_output, output, 0);
6958 des_xmlDocPtr(n_doc, doc, 1);
6959 xmlResetLastError();
6960 if (mem_base != xmlMemBlocks()) {
6961 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6962 xmlMemBlocks() - mem_base);
6963 test_ret++;
6964 printf(" %d", n_output);
6965 printf(" %d", n_doc);
6966 printf("\n");
6967 }
6968 }
6969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006970 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006971#endif
6972
Daniel Veillarda82b1822004-11-08 16:24:57 +00006973 return(test_ret);
6974}
6975
6976
6977static int
6978test_xmlDebugDumpDocumentHead(void) {
6979 int test_ret = 0;
6980
William M. Brack21e4ef22005-01-02 09:53:13 +00006981#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006982 int mem_base;
6983 FILE * output; /* the FILE * for the output */
6984 int n_output;
6985 xmlDocPtr doc; /* the document */
6986 int n_doc;
6987
6988 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6989 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6990 mem_base = xmlMemBlocks();
6991 output = gen_debug_FILE_ptr(n_output, 0);
6992 doc = gen_xmlDocPtr(n_doc, 1);
6993
6994 xmlDebugDumpDocumentHead(output, doc);
6995 call_tests++;
6996 des_debug_FILE_ptr(n_output, output, 0);
6997 des_xmlDocPtr(n_doc, doc, 1);
6998 xmlResetLastError();
6999 if (mem_base != xmlMemBlocks()) {
7000 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7001 xmlMemBlocks() - mem_base);
7002 test_ret++;
7003 printf(" %d", n_output);
7004 printf(" %d", n_doc);
7005 printf("\n");
7006 }
7007 }
7008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007009 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007010#endif
7011
Daniel Veillarda82b1822004-11-08 16:24:57 +00007012 return(test_ret);
7013}
7014
7015
7016static int
7017test_xmlDebugDumpEntities(void) {
7018 int test_ret = 0;
7019
William M. Brack21e4ef22005-01-02 09:53:13 +00007020#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007021 int mem_base;
7022 FILE * output; /* the FILE * for the output */
7023 int n_output;
7024 xmlDocPtr doc; /* the document */
7025 int n_doc;
7026
7027 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7028 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7029 mem_base = xmlMemBlocks();
7030 output = gen_debug_FILE_ptr(n_output, 0);
7031 doc = gen_xmlDocPtr(n_doc, 1);
7032
7033 xmlDebugDumpEntities(output, doc);
7034 call_tests++;
7035 des_debug_FILE_ptr(n_output, output, 0);
7036 des_xmlDocPtr(n_doc, doc, 1);
7037 xmlResetLastError();
7038 if (mem_base != xmlMemBlocks()) {
7039 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7040 xmlMemBlocks() - mem_base);
7041 test_ret++;
7042 printf(" %d", n_output);
7043 printf(" %d", n_doc);
7044 printf("\n");
7045 }
7046 }
7047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007048 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007049#endif
7050
Daniel Veillarda82b1822004-11-08 16:24:57 +00007051 return(test_ret);
7052}
7053
7054
7055static int
7056test_xmlDebugDumpNode(void) {
7057 int test_ret = 0;
7058
William M. Brack21e4ef22005-01-02 09:53:13 +00007059#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007060 int mem_base;
7061 FILE * output; /* the FILE * for the output */
7062 int n_output;
7063 xmlNodePtr node; /* the node */
7064 int n_node;
7065 int depth; /* the indentation level. */
7066 int n_depth;
7067
7068 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7069 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7070 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7071 mem_base = xmlMemBlocks();
7072 output = gen_debug_FILE_ptr(n_output, 0);
7073 node = gen_xmlNodePtr(n_node, 1);
7074 depth = gen_int(n_depth, 2);
7075
7076 xmlDebugDumpNode(output, node, depth);
7077 call_tests++;
7078 des_debug_FILE_ptr(n_output, output, 0);
7079 des_xmlNodePtr(n_node, node, 1);
7080 des_int(n_depth, depth, 2);
7081 xmlResetLastError();
7082 if (mem_base != xmlMemBlocks()) {
7083 printf("Leak of %d blocks found in xmlDebugDumpNode",
7084 xmlMemBlocks() - mem_base);
7085 test_ret++;
7086 printf(" %d", n_output);
7087 printf(" %d", n_node);
7088 printf(" %d", n_depth);
7089 printf("\n");
7090 }
7091 }
7092 }
7093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007095#endif
7096
Daniel Veillarda82b1822004-11-08 16:24:57 +00007097 return(test_ret);
7098}
7099
7100
7101static int
7102test_xmlDebugDumpNodeList(void) {
7103 int test_ret = 0;
7104
William M. Brack21e4ef22005-01-02 09:53:13 +00007105#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007106 int mem_base;
7107 FILE * output; /* the FILE * for the output */
7108 int n_output;
7109 xmlNodePtr node; /* the node list */
7110 int n_node;
7111 int depth; /* the indentation level. */
7112 int n_depth;
7113
7114 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7115 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7116 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7117 mem_base = xmlMemBlocks();
7118 output = gen_debug_FILE_ptr(n_output, 0);
7119 node = gen_xmlNodePtr(n_node, 1);
7120 depth = gen_int(n_depth, 2);
7121
7122 xmlDebugDumpNodeList(output, node, depth);
7123 call_tests++;
7124 des_debug_FILE_ptr(n_output, output, 0);
7125 des_xmlNodePtr(n_node, node, 1);
7126 des_int(n_depth, depth, 2);
7127 xmlResetLastError();
7128 if (mem_base != xmlMemBlocks()) {
7129 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7130 xmlMemBlocks() - mem_base);
7131 test_ret++;
7132 printf(" %d", n_output);
7133 printf(" %d", n_node);
7134 printf(" %d", n_depth);
7135 printf("\n");
7136 }
7137 }
7138 }
7139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007140 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007141#endif
7142
Daniel Veillarda82b1822004-11-08 16:24:57 +00007143 return(test_ret);
7144}
7145
7146
7147static int
7148test_xmlDebugDumpOneNode(void) {
7149 int test_ret = 0;
7150
William M. Brack21e4ef22005-01-02 09:53:13 +00007151#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007152 int mem_base;
7153 FILE * output; /* the FILE * for the output */
7154 int n_output;
7155 xmlNodePtr node; /* the node */
7156 int n_node;
7157 int depth; /* the indentation level. */
7158 int n_depth;
7159
7160 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7161 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7162 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7163 mem_base = xmlMemBlocks();
7164 output = gen_debug_FILE_ptr(n_output, 0);
7165 node = gen_xmlNodePtr(n_node, 1);
7166 depth = gen_int(n_depth, 2);
7167
7168 xmlDebugDumpOneNode(output, node, depth);
7169 call_tests++;
7170 des_debug_FILE_ptr(n_output, output, 0);
7171 des_xmlNodePtr(n_node, node, 1);
7172 des_int(n_depth, depth, 2);
7173 xmlResetLastError();
7174 if (mem_base != xmlMemBlocks()) {
7175 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7176 xmlMemBlocks() - mem_base);
7177 test_ret++;
7178 printf(" %d", n_output);
7179 printf(" %d", n_node);
7180 printf(" %d", n_depth);
7181 printf("\n");
7182 }
7183 }
7184 }
7185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007186 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007187#endif
7188
Daniel Veillarda82b1822004-11-08 16:24:57 +00007189 return(test_ret);
7190}
7191
7192
7193static int
7194test_xmlDebugDumpString(void) {
7195 int test_ret = 0;
7196
William M. Brack21e4ef22005-01-02 09:53:13 +00007197#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007198 int mem_base;
7199 FILE * output; /* the FILE * for the output */
7200 int n_output;
7201 xmlChar * str; /* the string */
7202 int n_str;
7203
7204 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7205 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7206 mem_base = xmlMemBlocks();
7207 output = gen_debug_FILE_ptr(n_output, 0);
7208 str = gen_const_xmlChar_ptr(n_str, 1);
7209
William M. Brackf13f77f2004-11-12 16:03:48 +00007210 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007211 call_tests++;
7212 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007213 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007214 xmlResetLastError();
7215 if (mem_base != xmlMemBlocks()) {
7216 printf("Leak of %d blocks found in xmlDebugDumpString",
7217 xmlMemBlocks() - mem_base);
7218 test_ret++;
7219 printf(" %d", n_output);
7220 printf(" %d", n_str);
7221 printf("\n");
7222 }
7223 }
7224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007225 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007226#endif
7227
Daniel Veillarda82b1822004-11-08 16:24:57 +00007228 return(test_ret);
7229}
7230
7231
7232static int
7233test_xmlLsCountNode(void) {
7234 int test_ret = 0;
7235
William M. Brack21e4ef22005-01-02 09:53:13 +00007236#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007237 int mem_base;
7238 int ret_val;
7239 xmlNodePtr node; /* the node to count */
7240 int n_node;
7241
7242 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7243 mem_base = xmlMemBlocks();
7244 node = gen_xmlNodePtr(n_node, 0);
7245
7246 ret_val = xmlLsCountNode(node);
7247 desret_int(ret_val);
7248 call_tests++;
7249 des_xmlNodePtr(n_node, node, 0);
7250 xmlResetLastError();
7251 if (mem_base != xmlMemBlocks()) {
7252 printf("Leak of %d blocks found in xmlLsCountNode",
7253 xmlMemBlocks() - mem_base);
7254 test_ret++;
7255 printf(" %d", n_node);
7256 printf("\n");
7257 }
7258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007259 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007260#endif
7261
Daniel Veillarda82b1822004-11-08 16:24:57 +00007262 return(test_ret);
7263}
7264
7265
7266static int
7267test_xmlLsOneNode(void) {
7268 int test_ret = 0;
7269
William M. Brack21e4ef22005-01-02 09:53:13 +00007270#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007271 int mem_base;
7272 FILE * output; /* the FILE * for the output */
7273 int n_output;
7274 xmlNodePtr node; /* the node to dump */
7275 int n_node;
7276
7277 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7278 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7279 mem_base = xmlMemBlocks();
7280 output = gen_debug_FILE_ptr(n_output, 0);
7281 node = gen_xmlNodePtr(n_node, 1);
7282
7283 xmlLsOneNode(output, node);
7284 call_tests++;
7285 des_debug_FILE_ptr(n_output, output, 0);
7286 des_xmlNodePtr(n_node, node, 1);
7287 xmlResetLastError();
7288 if (mem_base != xmlMemBlocks()) {
7289 printf("Leak of %d blocks found in xmlLsOneNode",
7290 xmlMemBlocks() - mem_base);
7291 test_ret++;
7292 printf(" %d", n_output);
7293 printf(" %d", n_node);
7294 printf("\n");
7295 }
7296 }
7297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007298 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007299#endif
7300
Daniel Veillarda82b1822004-11-08 16:24:57 +00007301 return(test_ret);
7302}
7303
7304
7305#define gen_nb_char_ptr 1
7306static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7307 return(NULL);
7308}
7309static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7310}
7311
7312static int
7313test_xmlShell(void) {
7314 int test_ret = 0;
7315
7316
7317 /* missing type support */
7318 return(test_ret);
7319}
7320
7321
Daniel Veillarda82b1822004-11-08 16:24:57 +00007322static int
7323test_xmlShellBase(void) {
7324 int test_ret = 0;
7325
William M. Brack21e4ef22005-01-02 09:53:13 +00007326#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007327 int mem_base;
7328 int ret_val;
7329 xmlShellCtxtPtr ctxt; /* the shell context */
7330 int n_ctxt;
7331 char * arg; /* unused */
7332 int n_arg;
7333 xmlNodePtr node; /* a node */
7334 int n_node;
7335 xmlNodePtr node2; /* unused */
7336 int n_node2;
7337
7338 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7339 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7340 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7341 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7342 mem_base = xmlMemBlocks();
7343 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7344 arg = gen_char_ptr(n_arg, 1);
7345 node = gen_xmlNodePtr(n_node, 2);
7346 node2 = gen_xmlNodePtr(n_node2, 3);
7347
7348 ret_val = xmlShellBase(ctxt, arg, node, node2);
7349 desret_int(ret_val);
7350 call_tests++;
7351 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7352 des_char_ptr(n_arg, arg, 1);
7353 des_xmlNodePtr(n_node, node, 2);
7354 des_xmlNodePtr(n_node2, node2, 3);
7355 xmlResetLastError();
7356 if (mem_base != xmlMemBlocks()) {
7357 printf("Leak of %d blocks found in xmlShellBase",
7358 xmlMemBlocks() - mem_base);
7359 test_ret++;
7360 printf(" %d", n_ctxt);
7361 printf(" %d", n_arg);
7362 printf(" %d", n_node);
7363 printf(" %d", n_node2);
7364 printf("\n");
7365 }
7366 }
7367 }
7368 }
7369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007370 function_tests++;
7371#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007372
Daniel Veillarda82b1822004-11-08 16:24:57 +00007373 return(test_ret);
7374}
7375
7376
7377static int
7378test_xmlShellCat(void) {
7379 int test_ret = 0;
7380
William M. Brack21e4ef22005-01-02 09:53:13 +00007381#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007382 int mem_base;
7383 int ret_val;
7384 xmlShellCtxtPtr ctxt; /* the shell context */
7385 int n_ctxt;
7386 char * arg; /* unused */
7387 int n_arg;
7388 xmlNodePtr node; /* a node */
7389 int n_node;
7390 xmlNodePtr node2; /* unused */
7391 int n_node2;
7392
7393 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7394 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7395 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7396 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7397 mem_base = xmlMemBlocks();
7398 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7399 arg = gen_char_ptr(n_arg, 1);
7400 node = gen_xmlNodePtr(n_node, 2);
7401 node2 = gen_xmlNodePtr(n_node2, 3);
7402
7403 ret_val = xmlShellCat(ctxt, arg, node, node2);
7404 desret_int(ret_val);
7405 call_tests++;
7406 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7407 des_char_ptr(n_arg, arg, 1);
7408 des_xmlNodePtr(n_node, node, 2);
7409 des_xmlNodePtr(n_node2, node2, 3);
7410 xmlResetLastError();
7411 if (mem_base != xmlMemBlocks()) {
7412 printf("Leak of %d blocks found in xmlShellCat",
7413 xmlMemBlocks() - mem_base);
7414 test_ret++;
7415 printf(" %d", n_ctxt);
7416 printf(" %d", n_arg);
7417 printf(" %d", n_node);
7418 printf(" %d", n_node2);
7419 printf("\n");
7420 }
7421 }
7422 }
7423 }
7424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007425 function_tests++;
7426#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007427
Daniel Veillarda82b1822004-11-08 16:24:57 +00007428 return(test_ret);
7429}
7430
7431
7432static int
7433test_xmlShellDir(void) {
7434 int test_ret = 0;
7435
William M. Brack21e4ef22005-01-02 09:53:13 +00007436#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007437 int mem_base;
7438 int ret_val;
7439 xmlShellCtxtPtr ctxt; /* the shell context */
7440 int n_ctxt;
7441 char * arg; /* unused */
7442 int n_arg;
7443 xmlNodePtr node; /* a node */
7444 int n_node;
7445 xmlNodePtr node2; /* unused */
7446 int n_node2;
7447
7448 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7449 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7450 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7451 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7452 mem_base = xmlMemBlocks();
7453 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7454 arg = gen_char_ptr(n_arg, 1);
7455 node = gen_xmlNodePtr(n_node, 2);
7456 node2 = gen_xmlNodePtr(n_node2, 3);
7457
7458 ret_val = xmlShellDir(ctxt, arg, node, node2);
7459 desret_int(ret_val);
7460 call_tests++;
7461 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7462 des_char_ptr(n_arg, arg, 1);
7463 des_xmlNodePtr(n_node, node, 2);
7464 des_xmlNodePtr(n_node2, node2, 3);
7465 xmlResetLastError();
7466 if (mem_base != xmlMemBlocks()) {
7467 printf("Leak of %d blocks found in xmlShellDir",
7468 xmlMemBlocks() - mem_base);
7469 test_ret++;
7470 printf(" %d", n_ctxt);
7471 printf(" %d", n_arg);
7472 printf(" %d", n_node);
7473 printf(" %d", n_node2);
7474 printf("\n");
7475 }
7476 }
7477 }
7478 }
7479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007480 function_tests++;
7481#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007482
Daniel Veillarda82b1822004-11-08 16:24:57 +00007483 return(test_ret);
7484}
7485
7486
7487static int
7488test_xmlShellDu(void) {
7489 int test_ret = 0;
7490
William M. Brack21e4ef22005-01-02 09:53:13 +00007491#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007492 int mem_base;
7493 int ret_val;
7494 xmlShellCtxtPtr ctxt; /* the shell context */
7495 int n_ctxt;
7496 char * arg; /* unused */
7497 int n_arg;
7498 xmlNodePtr tree; /* a node defining a subtree */
7499 int n_tree;
7500 xmlNodePtr node2; /* unused */
7501 int n_node2;
7502
7503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7504 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7505 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7506 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7507 mem_base = xmlMemBlocks();
7508 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7509 arg = gen_char_ptr(n_arg, 1);
7510 tree = gen_xmlNodePtr(n_tree, 2);
7511 node2 = gen_xmlNodePtr(n_node2, 3);
7512
7513 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7514 desret_int(ret_val);
7515 call_tests++;
7516 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7517 des_char_ptr(n_arg, arg, 1);
7518 des_xmlNodePtr(n_tree, tree, 2);
7519 des_xmlNodePtr(n_node2, node2, 3);
7520 xmlResetLastError();
7521 if (mem_base != xmlMemBlocks()) {
7522 printf("Leak of %d blocks found in xmlShellDu",
7523 xmlMemBlocks() - mem_base);
7524 test_ret++;
7525 printf(" %d", n_ctxt);
7526 printf(" %d", n_arg);
7527 printf(" %d", n_tree);
7528 printf(" %d", n_node2);
7529 printf("\n");
7530 }
7531 }
7532 }
7533 }
7534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007535 function_tests++;
7536#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007537
Daniel Veillarda82b1822004-11-08 16:24:57 +00007538 return(test_ret);
7539}
7540
7541
7542static int
7543test_xmlShellList(void) {
7544 int test_ret = 0;
7545
William M. Brack21e4ef22005-01-02 09:53:13 +00007546#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007547 int mem_base;
7548 int ret_val;
7549 xmlShellCtxtPtr ctxt; /* the shell context */
7550 int n_ctxt;
7551 char * arg; /* unused */
7552 int n_arg;
7553 xmlNodePtr node; /* a node */
7554 int n_node;
7555 xmlNodePtr node2; /* unused */
7556 int n_node2;
7557
7558 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7559 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7560 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7561 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7562 mem_base = xmlMemBlocks();
7563 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7564 arg = gen_char_ptr(n_arg, 1);
7565 node = gen_xmlNodePtr(n_node, 2);
7566 node2 = gen_xmlNodePtr(n_node2, 3);
7567
7568 ret_val = xmlShellList(ctxt, arg, node, node2);
7569 desret_int(ret_val);
7570 call_tests++;
7571 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7572 des_char_ptr(n_arg, arg, 1);
7573 des_xmlNodePtr(n_node, node, 2);
7574 des_xmlNodePtr(n_node2, node2, 3);
7575 xmlResetLastError();
7576 if (mem_base != xmlMemBlocks()) {
7577 printf("Leak of %d blocks found in xmlShellList",
7578 xmlMemBlocks() - mem_base);
7579 test_ret++;
7580 printf(" %d", n_ctxt);
7581 printf(" %d", n_arg);
7582 printf(" %d", n_node);
7583 printf(" %d", n_node2);
7584 printf("\n");
7585 }
7586 }
7587 }
7588 }
7589 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007590 function_tests++;
7591#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007592
Daniel Veillarda82b1822004-11-08 16:24:57 +00007593 return(test_ret);
7594}
7595
7596
7597static int
7598test_xmlShellLoad(void) {
7599 int test_ret = 0;
7600
William M. Brack21e4ef22005-01-02 09:53:13 +00007601#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007602 int mem_base;
7603 int ret_val;
7604 xmlShellCtxtPtr ctxt; /* the shell context */
7605 int n_ctxt;
7606 char * filename; /* the file name */
7607 int n_filename;
7608 xmlNodePtr node; /* unused */
7609 int n_node;
7610 xmlNodePtr node2; /* unused */
7611 int n_node2;
7612
7613 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7614 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7615 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7616 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7617 mem_base = xmlMemBlocks();
7618 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7619 filename = gen_char_ptr(n_filename, 1);
7620 node = gen_xmlNodePtr(n_node, 2);
7621 node2 = gen_xmlNodePtr(n_node2, 3);
7622
7623 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7624 desret_int(ret_val);
7625 call_tests++;
7626 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7627 des_char_ptr(n_filename, filename, 1);
7628 des_xmlNodePtr(n_node, node, 2);
7629 des_xmlNodePtr(n_node2, node2, 3);
7630 xmlResetLastError();
7631 if (mem_base != xmlMemBlocks()) {
7632 printf("Leak of %d blocks found in xmlShellLoad",
7633 xmlMemBlocks() - mem_base);
7634 test_ret++;
7635 printf(" %d", n_ctxt);
7636 printf(" %d", n_filename);
7637 printf(" %d", n_node);
7638 printf(" %d", n_node2);
7639 printf("\n");
7640 }
7641 }
7642 }
7643 }
7644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007645 function_tests++;
7646#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007647
Daniel Veillarda82b1822004-11-08 16:24:57 +00007648 return(test_ret);
7649}
7650
7651
7652static int
7653test_xmlShellPrintXPathResult(void) {
7654 int test_ret = 0;
7655
William M. Brack21e4ef22005-01-02 09:53:13 +00007656#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007657 int mem_base;
7658 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7659 int n_list;
7660
7661 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7662 mem_base = xmlMemBlocks();
7663 list = gen_xmlXPathObjectPtr(n_list, 0);
7664
7665 xmlShellPrintXPathResult(list);
7666 call_tests++;
7667 des_xmlXPathObjectPtr(n_list, list, 0);
7668 xmlResetLastError();
7669 if (mem_base != xmlMemBlocks()) {
7670 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7671 xmlMemBlocks() - mem_base);
7672 test_ret++;
7673 printf(" %d", n_list);
7674 printf("\n");
7675 }
7676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007677 function_tests++;
7678#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007679
Daniel Veillarda82b1822004-11-08 16:24:57 +00007680 return(test_ret);
7681}
7682
7683
7684static int
7685test_xmlShellPwd(void) {
7686 int test_ret = 0;
7687
William M. Brack21e4ef22005-01-02 09:53:13 +00007688#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007689 int mem_base;
7690 int ret_val;
7691 xmlShellCtxtPtr ctxt; /* the shell context */
7692 int n_ctxt;
7693 char * buffer; /* the output buffer */
7694 int n_buffer;
7695 xmlNodePtr node; /* a node */
7696 int n_node;
7697 xmlNodePtr node2; /* unused */
7698 int n_node2;
7699
7700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7701 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7702 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7703 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7704 mem_base = xmlMemBlocks();
7705 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7706 buffer = gen_char_ptr(n_buffer, 1);
7707 node = gen_xmlNodePtr(n_node, 2);
7708 node2 = gen_xmlNodePtr(n_node2, 3);
7709
7710 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7711 desret_int(ret_val);
7712 call_tests++;
7713 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7714 des_char_ptr(n_buffer, buffer, 1);
7715 des_xmlNodePtr(n_node, node, 2);
7716 des_xmlNodePtr(n_node2, node2, 3);
7717 xmlResetLastError();
7718 if (mem_base != xmlMemBlocks()) {
7719 printf("Leak of %d blocks found in xmlShellPwd",
7720 xmlMemBlocks() - mem_base);
7721 test_ret++;
7722 printf(" %d", n_ctxt);
7723 printf(" %d", n_buffer);
7724 printf(" %d", n_node);
7725 printf(" %d", n_node2);
7726 printf("\n");
7727 }
7728 }
7729 }
7730 }
7731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007732 function_tests++;
7733#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007734
Daniel Veillarda82b1822004-11-08 16:24:57 +00007735 return(test_ret);
7736}
7737
7738
7739static int
7740test_xmlShellSave(void) {
7741 int test_ret = 0;
7742
William M. Brack21e4ef22005-01-02 09:53:13 +00007743#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007744 int mem_base;
7745 int ret_val;
7746 xmlShellCtxtPtr ctxt; /* the shell context */
7747 int n_ctxt;
7748 char * filename; /* the file name (optional) */
7749 int n_filename;
7750 xmlNodePtr node; /* unused */
7751 int n_node;
7752 xmlNodePtr node2; /* unused */
7753 int n_node2;
7754
7755 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7756 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7757 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7758 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7759 mem_base = xmlMemBlocks();
7760 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7761 filename = gen_char_ptr(n_filename, 1);
7762 node = gen_xmlNodePtr(n_node, 2);
7763 node2 = gen_xmlNodePtr(n_node2, 3);
7764
7765 ret_val = xmlShellSave(ctxt, filename, node, node2);
7766 desret_int(ret_val);
7767 call_tests++;
7768 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7769 des_char_ptr(n_filename, filename, 1);
7770 des_xmlNodePtr(n_node, node, 2);
7771 des_xmlNodePtr(n_node2, node2, 3);
7772 xmlResetLastError();
7773 if (mem_base != xmlMemBlocks()) {
7774 printf("Leak of %d blocks found in xmlShellSave",
7775 xmlMemBlocks() - mem_base);
7776 test_ret++;
7777 printf(" %d", n_ctxt);
7778 printf(" %d", n_filename);
7779 printf(" %d", n_node);
7780 printf(" %d", n_node2);
7781 printf("\n");
7782 }
7783 }
7784 }
7785 }
7786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007787 function_tests++;
7788#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007789
Daniel Veillarda82b1822004-11-08 16:24:57 +00007790 return(test_ret);
7791}
7792
7793
7794static int
7795test_xmlShellValidate(void) {
7796 int test_ret = 0;
7797
William M. Brack21e4ef22005-01-02 09:53:13 +00007798#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007799 int mem_base;
7800 int ret_val;
7801 xmlShellCtxtPtr ctxt; /* the shell context */
7802 int n_ctxt;
7803 char * dtd; /* the DTD URI (optional) */
7804 int n_dtd;
7805 xmlNodePtr node; /* unused */
7806 int n_node;
7807 xmlNodePtr node2; /* unused */
7808 int n_node2;
7809
7810 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7811 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7812 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7813 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7814 mem_base = xmlMemBlocks();
7815 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7816 dtd = gen_char_ptr(n_dtd, 1);
7817 node = gen_xmlNodePtr(n_node, 2);
7818 node2 = gen_xmlNodePtr(n_node2, 3);
7819
7820 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7821 desret_int(ret_val);
7822 call_tests++;
7823 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7824 des_char_ptr(n_dtd, dtd, 1);
7825 des_xmlNodePtr(n_node, node, 2);
7826 des_xmlNodePtr(n_node2, node2, 3);
7827 xmlResetLastError();
7828 if (mem_base != xmlMemBlocks()) {
7829 printf("Leak of %d blocks found in xmlShellValidate",
7830 xmlMemBlocks() - mem_base);
7831 test_ret++;
7832 printf(" %d", n_ctxt);
7833 printf(" %d", n_dtd);
7834 printf(" %d", n_node);
7835 printf(" %d", n_node2);
7836 printf("\n");
7837 }
7838 }
7839 }
7840 }
7841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007842 function_tests++;
7843#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007844
Daniel Veillarda82b1822004-11-08 16:24:57 +00007845 return(test_ret);
7846}
7847
7848
7849static int
7850test_xmlShellWrite(void) {
7851 int test_ret = 0;
7852
William M. Brack21e4ef22005-01-02 09:53:13 +00007853#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007854 int mem_base;
7855 int ret_val;
7856 xmlShellCtxtPtr ctxt; /* the shell context */
7857 int n_ctxt;
7858 char * filename; /* the file name */
7859 int n_filename;
7860 xmlNodePtr node; /* a node in the tree */
7861 int n_node;
7862 xmlNodePtr node2; /* unused */
7863 int n_node2;
7864
7865 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7866 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7867 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7868 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7869 mem_base = xmlMemBlocks();
7870 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7871 filename = gen_char_ptr(n_filename, 1);
7872 node = gen_xmlNodePtr(n_node, 2);
7873 node2 = gen_xmlNodePtr(n_node2, 3);
7874
7875 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7876 desret_int(ret_val);
7877 call_tests++;
7878 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7879 des_char_ptr(n_filename, filename, 1);
7880 des_xmlNodePtr(n_node, node, 2);
7881 des_xmlNodePtr(n_node2, node2, 3);
7882 xmlResetLastError();
7883 if (mem_base != xmlMemBlocks()) {
7884 printf("Leak of %d blocks found in xmlShellWrite",
7885 xmlMemBlocks() - mem_base);
7886 test_ret++;
7887 printf(" %d", n_ctxt);
7888 printf(" %d", n_filename);
7889 printf(" %d", n_node);
7890 printf(" %d", n_node2);
7891 printf("\n");
7892 }
7893 }
7894 }
7895 }
7896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007897 function_tests++;
7898#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007899
Daniel Veillarda82b1822004-11-08 16:24:57 +00007900 return(test_ret);
7901}
7902
7903static int
7904test_debugXML(void) {
7905 int test_ret = 0;
7906
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007907 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007908 test_ret += test_xmlBoolToText();
7909 test_ret += test_xmlDebugCheckDocument();
7910 test_ret += test_xmlDebugDumpAttr();
7911 test_ret += test_xmlDebugDumpAttrList();
7912 test_ret += test_xmlDebugDumpDTD();
7913 test_ret += test_xmlDebugDumpDocument();
7914 test_ret += test_xmlDebugDumpDocumentHead();
7915 test_ret += test_xmlDebugDumpEntities();
7916 test_ret += test_xmlDebugDumpNode();
7917 test_ret += test_xmlDebugDumpNodeList();
7918 test_ret += test_xmlDebugDumpOneNode();
7919 test_ret += test_xmlDebugDumpString();
7920 test_ret += test_xmlLsCountNode();
7921 test_ret += test_xmlLsOneNode();
7922 test_ret += test_xmlShell();
7923 test_ret += test_xmlShellBase();
7924 test_ret += test_xmlShellCat();
7925 test_ret += test_xmlShellDir();
7926 test_ret += test_xmlShellDu();
7927 test_ret += test_xmlShellList();
7928 test_ret += test_xmlShellLoad();
7929 test_ret += test_xmlShellPrintXPathResult();
7930 test_ret += test_xmlShellPwd();
7931 test_ret += test_xmlShellSave();
7932 test_ret += test_xmlShellValidate();
7933 test_ret += test_xmlShellWrite();
7934
7935 if (test_ret != 0)
7936 printf("Module debugXML: %d errors\n", test_ret);
7937 return(test_ret);
7938}
7939
7940static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00007941test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007943
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007944 int mem_base;
7945 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007946
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007947 mem_base = xmlMemBlocks();
7948
7949 ret_val = xmlDictCreate();
7950 desret_xmlDictPtr(ret_val);
7951 call_tests++;
7952 xmlResetLastError();
7953 if (mem_base != xmlMemBlocks()) {
7954 printf("Leak of %d blocks found in xmlDictCreate",
7955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007956 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007957 printf("\n");
7958 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007959 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007960
Daniel Veillard42595322004-11-08 10:52:06 +00007961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007962}
7963
7964
7965static int
7966test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007968
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007969 int mem_base;
7970 xmlDictPtr ret_val;
7971 xmlDictPtr sub; /* an existing dictionnary */
7972 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007973
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007974 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
7975 mem_base = xmlMemBlocks();
7976 sub = gen_xmlDictPtr(n_sub, 0);
7977
7978 ret_val = xmlDictCreateSub(sub);
7979 desret_xmlDictPtr(ret_val);
7980 call_tests++;
7981 des_xmlDictPtr(n_sub, sub, 0);
7982 xmlResetLastError();
7983 if (mem_base != xmlMemBlocks()) {
7984 printf("Leak of %d blocks found in xmlDictCreateSub",
7985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007986 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007987 printf(" %d", n_sub);
7988 printf("\n");
7989 }
7990 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007991 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007992
Daniel Veillard42595322004-11-08 10:52:06 +00007993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007994}
7995
7996
7997static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00007998test_xmlDictExists(void) {
7999 int test_ret = 0;
8000
8001 int mem_base;
8002 const xmlChar * ret_val;
8003 xmlDictPtr dict; /* the dictionnary */
8004 int n_dict;
8005 xmlChar * name; /* the name of the userdata */
8006 int n_name;
8007 int len; /* the length of the name, if -1 it is recomputed */
8008 int n_len;
8009
8010 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8011 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8012 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8013 mem_base = xmlMemBlocks();
8014 dict = gen_xmlDictPtr(n_dict, 0);
8015 name = gen_const_xmlChar_ptr(n_name, 1);
8016 len = gen_int(n_len, 2);
8017
8018 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8019 desret_const_xmlChar_ptr(ret_val);
8020 call_tests++;
8021 des_xmlDictPtr(n_dict, dict, 0);
8022 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8023 des_int(n_len, len, 2);
8024 xmlResetLastError();
8025 if (mem_base != xmlMemBlocks()) {
8026 printf("Leak of %d blocks found in xmlDictExists",
8027 xmlMemBlocks() - mem_base);
8028 test_ret++;
8029 printf(" %d", n_dict);
8030 printf(" %d", n_name);
8031 printf(" %d", n_len);
8032 printf("\n");
8033 }
8034 }
8035 }
8036 }
8037 function_tests++;
8038
8039 return(test_ret);
8040}
8041
8042
8043static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008044test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008046
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008047 int mem_base;
8048 const xmlChar * ret_val;
8049 xmlDictPtr dict; /* the dictionnary */
8050 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008051 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008052 int n_name;
8053 int len; /* the length of the name, if -1 it is recomputed */
8054 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008055
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008056 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8057 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8058 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8059 mem_base = xmlMemBlocks();
8060 dict = gen_xmlDictPtr(n_dict, 0);
8061 name = gen_const_xmlChar_ptr(n_name, 1);
8062 len = gen_int(n_len, 2);
8063
William M. Brackf13f77f2004-11-12 16:03:48 +00008064 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008065 desret_const_xmlChar_ptr(ret_val);
8066 call_tests++;
8067 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008068 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008069 des_int(n_len, len, 2);
8070 xmlResetLastError();
8071 if (mem_base != xmlMemBlocks()) {
8072 printf("Leak of %d blocks found in xmlDictLookup",
8073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008074 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008075 printf(" %d", n_dict);
8076 printf(" %d", n_name);
8077 printf(" %d", n_len);
8078 printf("\n");
8079 }
8080 }
8081 }
8082 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008083 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008084
Daniel Veillard42595322004-11-08 10:52:06 +00008085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008086}
8087
8088
8089static int
8090test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008092
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008093 int mem_base;
8094 int ret_val;
8095 xmlDictPtr dict; /* the dictionnary */
8096 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008097 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008098 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008099
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008100 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8101 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8102 mem_base = xmlMemBlocks();
8103 dict = gen_xmlDictPtr(n_dict, 0);
8104 str = gen_const_xmlChar_ptr(n_str, 1);
8105
William M. Brackf13f77f2004-11-12 16:03:48 +00008106 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008107 desret_int(ret_val);
8108 call_tests++;
8109 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008110 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008111 xmlResetLastError();
8112 if (mem_base != xmlMemBlocks()) {
8113 printf("Leak of %d blocks found in xmlDictOwns",
8114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008115 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008116 printf(" %d", n_dict);
8117 printf(" %d", n_str);
8118 printf("\n");
8119 }
8120 }
8121 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008122 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008123
Daniel Veillard42595322004-11-08 10:52:06 +00008124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008125}
8126
8127
8128static int
8129test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008131
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008132 int mem_base;
8133 const xmlChar * ret_val;
8134 xmlDictPtr dict; /* the dictionnary */
8135 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008136 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008137 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008138 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008139 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008140
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008141 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8142 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8143 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8144 mem_base = xmlMemBlocks();
8145 dict = gen_xmlDictPtr(n_dict, 0);
8146 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8147 name = gen_const_xmlChar_ptr(n_name, 2);
8148
William M. Brackf13f77f2004-11-12 16:03:48 +00008149 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008150 desret_const_xmlChar_ptr(ret_val);
8151 call_tests++;
8152 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008153 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8154 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008155 xmlResetLastError();
8156 if (mem_base != xmlMemBlocks()) {
8157 printf("Leak of %d blocks found in xmlDictQLookup",
8158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008159 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008160 printf(" %d", n_dict);
8161 printf(" %d", n_prefix);
8162 printf(" %d", n_name);
8163 printf("\n");
8164 }
8165 }
8166 }
8167 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008168 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008169
Daniel Veillard42595322004-11-08 10:52:06 +00008170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008171}
8172
8173
8174static int
8175test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008177
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008178 int mem_base;
8179 int ret_val;
8180 xmlDictPtr dict; /* the dictionnary */
8181 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008182
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008183 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8184 mem_base = xmlMemBlocks();
8185 dict = gen_xmlDictPtr(n_dict, 0);
8186
8187 ret_val = xmlDictReference(dict);
8188 xmlDictFree(dict);
8189 desret_int(ret_val);
8190 call_tests++;
8191 des_xmlDictPtr(n_dict, dict, 0);
8192 xmlResetLastError();
8193 if (mem_base != xmlMemBlocks()) {
8194 printf("Leak of %d blocks found in xmlDictReference",
8195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008196 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008197 printf(" %d", n_dict);
8198 printf("\n");
8199 }
8200 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008202
Daniel Veillard42595322004-11-08 10:52:06 +00008203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008204}
8205
8206
8207static int
8208test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008210
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008211 int mem_base;
8212 int ret_val;
8213 xmlDictPtr dict; /* the dictionnary */
8214 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008215
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008216 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8217 mem_base = xmlMemBlocks();
8218 dict = gen_xmlDictPtr(n_dict, 0);
8219
8220 ret_val = xmlDictSize(dict);
8221 desret_int(ret_val);
8222 call_tests++;
8223 des_xmlDictPtr(n_dict, dict, 0);
8224 xmlResetLastError();
8225 if (mem_base != xmlMemBlocks()) {
8226 printf("Leak of %d blocks found in xmlDictSize",
8227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008228 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008229 printf(" %d", n_dict);
8230 printf("\n");
8231 }
8232 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008233 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008234
Daniel Veillard42595322004-11-08 10:52:06 +00008235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008236}
8237
8238static int
8239test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008241
Daniel Veillard91b955c2004-12-10 10:26:42 +00008242 if (quiet == 0) printf("Testing dict : 8 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008243 test_ret += test_xmlDictCreate();
8244 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008245 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008246 test_ret += test_xmlDictLookup();
8247 test_ret += test_xmlDictOwns();
8248 test_ret += test_xmlDictQLookup();
8249 test_ret += test_xmlDictReference();
8250 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008251
Daniel Veillard42595322004-11-08 10:52:06 +00008252 if (test_ret != 0)
8253 printf("Module dict: %d errors\n", test_ret);
8254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008255}
8256
8257static int
8258test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008260
William M. Brack21e4ef22005-01-02 09:53:13 +00008261#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008262#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008263 int mem_base;
8264 int ret_val;
8265 unsigned char * out; /* a pointer to an array of bytes to store the result */
8266 int n_out;
8267 int * outlen; /* the length of @out */
8268 int n_outlen;
8269 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8270 int n_in;
8271 int * inlen; /* the length of @in */
8272 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008273
Daniel Veillardce682bc2004-11-05 17:22:25 +00008274 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8275 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8276 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8277 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8278 mem_base = xmlMemBlocks();
8279 out = gen_unsigned_char_ptr(n_out, 0);
8280 outlen = gen_int_ptr(n_outlen, 1);
8281 in = gen_const_unsigned_char_ptr(n_in, 2);
8282 inlen = gen_int_ptr(n_inlen, 3);
8283
William M. Brackf13f77f2004-11-12 16:03:48 +00008284 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008285 desret_int(ret_val);
8286 call_tests++;
8287 des_unsigned_char_ptr(n_out, out, 0);
8288 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008289 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008290 des_int_ptr(n_inlen, inlen, 3);
8291 xmlResetLastError();
8292 if (mem_base != xmlMemBlocks()) {
8293 printf("Leak of %d blocks found in UTF8Toisolat1",
8294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008295 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008296 printf(" %d", n_out);
8297 printf(" %d", n_outlen);
8298 printf(" %d", n_in);
8299 printf(" %d", n_inlen);
8300 printf("\n");
8301 }
8302 }
8303 }
8304 }
8305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008306 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008307#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008308#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008309
Daniel Veillard42595322004-11-08 10:52:06 +00008310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008311}
8312
8313
8314static int
8315test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008317
Daniel Veillardce682bc2004-11-05 17:22:25 +00008318 int mem_base;
8319 int ret_val;
8320 unsigned char * out; /* a pointer to an array of bytes to store the result */
8321 int n_out;
8322 int * outlen; /* the length of @out */
8323 int n_outlen;
8324 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8325 int n_in;
8326 int * inlen; /* the length of @in */
8327 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008328
Daniel Veillardce682bc2004-11-05 17:22:25 +00008329 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8330 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8331 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8332 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8333 mem_base = xmlMemBlocks();
8334 out = gen_unsigned_char_ptr(n_out, 0);
8335 outlen = gen_int_ptr(n_outlen, 1);
8336 in = gen_const_unsigned_char_ptr(n_in, 2);
8337 inlen = gen_int_ptr(n_inlen, 3);
8338
William M. Brackf13f77f2004-11-12 16:03:48 +00008339 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008340 desret_int(ret_val);
8341 call_tests++;
8342 des_unsigned_char_ptr(n_out, out, 0);
8343 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008344 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008345 des_int_ptr(n_inlen, inlen, 3);
8346 xmlResetLastError();
8347 if (mem_base != xmlMemBlocks()) {
8348 printf("Leak of %d blocks found in isolat1ToUTF8",
8349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008350 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008351 printf(" %d", n_out);
8352 printf(" %d", n_outlen);
8353 printf(" %d", n_in);
8354 printf(" %d", n_inlen);
8355 printf("\n");
8356 }
8357 }
8358 }
8359 }
8360 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008361 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008362
Daniel Veillard42595322004-11-08 10:52:06 +00008363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008364}
8365
8366
8367static int
8368test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008370
8371 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008372 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008373 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008374 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008375 int n_alias;
8376
8377 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8378 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008379 name = gen_const_char_ptr(n_name, 0);
8380 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008381
William M. Brackf13f77f2004-11-12 16:03:48 +00008382 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008383 desret_int(ret_val);
8384 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008385 des_const_char_ptr(n_name, (const char *)name, 0);
8386 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008387 xmlResetLastError();
8388 }
8389 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008391
Daniel Veillard42595322004-11-08 10:52:06 +00008392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008393}
8394
8395
Daniel Veillardce682bc2004-11-05 17:22:25 +00008396#define gen_nb_xmlCharEncodingHandler_ptr 1
8397static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8398 return(NULL);
8399}
8400static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8401}
8402
Daniel Veillardd93f6252004-11-02 15:53:51 +00008403static int
8404test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008406
Daniel Veillardce682bc2004-11-05 17:22:25 +00008407 int mem_base;
8408 int ret_val;
8409 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8410 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008411
Daniel Veillardce682bc2004-11-05 17:22:25 +00008412 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8413 mem_base = xmlMemBlocks();
8414 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8415
8416 ret_val = xmlCharEncCloseFunc(handler);
8417 desret_int(ret_val);
8418 call_tests++;
8419 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8420 xmlResetLastError();
8421 if (mem_base != xmlMemBlocks()) {
8422 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008424 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008425 printf(" %d", n_handler);
8426 printf("\n");
8427 }
8428 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008429 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008430
Daniel Veillard42595322004-11-08 10:52:06 +00008431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008432}
8433
8434
8435static int
8436test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008438
Daniel Veillardce682bc2004-11-05 17:22:25 +00008439 int mem_base;
8440 int ret_val;
8441 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8442 int n_handler;
8443 xmlBufferPtr out; /* an xmlBuffer for the output. */
8444 int n_out;
8445 xmlBufferPtr in; /* an xmlBuffer for the input */
8446 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008447
Daniel Veillardce682bc2004-11-05 17:22:25 +00008448 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8449 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8450 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8451 mem_base = xmlMemBlocks();
8452 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8453 out = gen_xmlBufferPtr(n_out, 1);
8454 in = gen_xmlBufferPtr(n_in, 2);
8455
8456 ret_val = xmlCharEncFirstLine(handler, out, in);
8457 desret_int(ret_val);
8458 call_tests++;
8459 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8460 des_xmlBufferPtr(n_out, out, 1);
8461 des_xmlBufferPtr(n_in, in, 2);
8462 xmlResetLastError();
8463 if (mem_base != xmlMemBlocks()) {
8464 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008466 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008467 printf(" %d", n_handler);
8468 printf(" %d", n_out);
8469 printf(" %d", n_in);
8470 printf("\n");
8471 }
8472 }
8473 }
8474 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008475 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008476
Daniel Veillard42595322004-11-08 10:52:06 +00008477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008478}
8479
8480
8481static int
8482test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008484
Daniel Veillardce682bc2004-11-05 17:22:25 +00008485 int mem_base;
8486 int ret_val;
8487 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8488 int n_handler;
8489 xmlBufferPtr out; /* an xmlBuffer for the output. */
8490 int n_out;
8491 xmlBufferPtr in; /* an xmlBuffer for the input */
8492 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008493
Daniel Veillardce682bc2004-11-05 17:22:25 +00008494 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8495 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8496 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8497 mem_base = xmlMemBlocks();
8498 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8499 out = gen_xmlBufferPtr(n_out, 1);
8500 in = gen_xmlBufferPtr(n_in, 2);
8501
8502 ret_val = xmlCharEncInFunc(handler, out, in);
8503 desret_int(ret_val);
8504 call_tests++;
8505 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8506 des_xmlBufferPtr(n_out, out, 1);
8507 des_xmlBufferPtr(n_in, in, 2);
8508 xmlResetLastError();
8509 if (mem_base != xmlMemBlocks()) {
8510 printf("Leak of %d blocks found in xmlCharEncInFunc",
8511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008512 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008513 printf(" %d", n_handler);
8514 printf(" %d", n_out);
8515 printf(" %d", n_in);
8516 printf("\n");
8517 }
8518 }
8519 }
8520 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008522
Daniel Veillard42595322004-11-08 10:52:06 +00008523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008524}
8525
8526
8527static int
8528test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008530
Daniel Veillardce682bc2004-11-05 17:22:25 +00008531 int mem_base;
8532 int ret_val;
8533 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8534 int n_handler;
8535 xmlBufferPtr out; /* an xmlBuffer for the output. */
8536 int n_out;
8537 xmlBufferPtr in; /* an xmlBuffer for the input */
8538 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008539
Daniel Veillardce682bc2004-11-05 17:22:25 +00008540 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8541 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8542 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8543 mem_base = xmlMemBlocks();
8544 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8545 out = gen_xmlBufferPtr(n_out, 1);
8546 in = gen_xmlBufferPtr(n_in, 2);
8547
8548 ret_val = xmlCharEncOutFunc(handler, out, in);
8549 desret_int(ret_val);
8550 call_tests++;
8551 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8552 des_xmlBufferPtr(n_out, out, 1);
8553 des_xmlBufferPtr(n_in, in, 2);
8554 xmlResetLastError();
8555 if (mem_base != xmlMemBlocks()) {
8556 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008558 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008559 printf(" %d", n_handler);
8560 printf(" %d", n_out);
8561 printf(" %d", n_in);
8562 printf("\n");
8563 }
8564 }
8565 }
8566 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008568
Daniel Veillard42595322004-11-08 10:52:06 +00008569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008570}
8571
8572
8573static int
8574test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008576
8577
8578
8579 xmlCleanupCharEncodingHandlers();
8580 call_tests++;
8581 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008582 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008583
Daniel Veillard42595322004-11-08 10:52:06 +00008584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008585}
8586
8587
8588static int
8589test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008591
8592 int mem_base;
8593
8594 mem_base = xmlMemBlocks();
8595
8596 xmlCleanupEncodingAliases();
8597 call_tests++;
8598 xmlResetLastError();
8599 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008600 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008602 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008603 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008604 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008605 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008606
Daniel Veillard42595322004-11-08 10:52:06 +00008607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008608}
8609
8610
8611static int
8612test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008614
8615 int mem_base;
8616 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008617 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008618 int n_alias;
8619
8620 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008622 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008623
William M. Brackf13f77f2004-11-12 16:03:48 +00008624 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008625 desret_int(ret_val);
8626 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008627 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008628 xmlResetLastError();
8629 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008630 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008632 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008633 printf(" %d", n_alias);
8634 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008635 }
8636 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008637 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008638
Daniel Veillard42595322004-11-08 10:52:06 +00008639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008640}
8641
8642
8643static int
8644test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008646
Daniel Veillardce682bc2004-11-05 17:22:25 +00008647 int mem_base;
8648 xmlCharEncoding ret_val;
8649 unsigned char * in; /* a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). */
8650 int n_in;
8651 int len; /* pointer to the length of the buffer */
8652 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008653
Daniel Veillardce682bc2004-11-05 17:22:25 +00008654 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8655 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8656 mem_base = xmlMemBlocks();
8657 in = gen_const_unsigned_char_ptr(n_in, 0);
8658 len = gen_int(n_len, 1);
8659
William M. Brackf13f77f2004-11-12 16:03:48 +00008660 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008661 desret_xmlCharEncoding(ret_val);
8662 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008663 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008664 des_int(n_len, len, 1);
8665 xmlResetLastError();
8666 if (mem_base != xmlMemBlocks()) {
8667 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008669 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008670 printf(" %d", n_in);
8671 printf(" %d", n_len);
8672 printf("\n");
8673 }
8674 }
8675 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008676 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008677
Daniel Veillard42595322004-11-08 10:52:06 +00008678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008679}
8680
8681
8682static int
8683test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008685
8686
8687 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008689}
8690
8691
8692static int
8693test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695
8696
8697 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008699}
8700
8701
8702static int
8703test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008705
Daniel Veillard3d97e662004-11-04 10:49:00 +00008706 int mem_base;
8707 const char * ret_val;
8708 xmlCharEncoding enc; /* the encoding */
8709 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008710
Daniel Veillard3d97e662004-11-04 10:49:00 +00008711 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8712 mem_base = xmlMemBlocks();
8713 enc = gen_xmlCharEncoding(n_enc, 0);
8714
8715 ret_val = xmlGetCharEncodingName(enc);
8716 desret_const_char_ptr(ret_val);
8717 call_tests++;
8718 des_xmlCharEncoding(n_enc, enc, 0);
8719 xmlResetLastError();
8720 if (mem_base != xmlMemBlocks()) {
8721 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008723 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008724 printf(" %d", n_enc);
8725 printf("\n");
8726 }
8727 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008728 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008729
Daniel Veillard42595322004-11-08 10:52:06 +00008730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008731}
8732
8733
8734static int
8735test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008737
8738 int mem_base;
8739 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008740 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008741 int n_alias;
8742
8743 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008745 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008746
William M. Brackf13f77f2004-11-12 16:03:48 +00008747 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008748 desret_const_char_ptr(ret_val);
8749 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008750 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008751 xmlResetLastError();
8752 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008753 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008755 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008756 printf(" %d", n_alias);
8757 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008758 }
8759 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008760 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008761
Daniel Veillard42595322004-11-08 10:52:06 +00008762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008763}
8764
8765
8766static int
8767test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008769
8770
8771
8772 xmlInitCharEncodingHandlers();
8773 call_tests++;
8774 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008776
Daniel Veillard42595322004-11-08 10:52:06 +00008777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008778}
8779
8780
8781static int
8782test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008784
8785
8786 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008788}
8789
8790
8791static int
8792test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008794
Daniel Veillard3d97e662004-11-04 10:49:00 +00008795 int mem_base;
8796 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008797 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008798 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008799
Daniel Veillard3d97e662004-11-04 10:49:00 +00008800 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8801 mem_base = xmlMemBlocks();
8802 name = gen_const_char_ptr(n_name, 0);
8803
William M. Brackf13f77f2004-11-12 16:03:48 +00008804 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 desret_xmlCharEncoding(ret_val);
8806 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008807 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008808 xmlResetLastError();
8809 if (mem_base != xmlMemBlocks()) {
8810 printf("Leak of %d blocks found in xmlParseCharEncoding",
8811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008812 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008813 printf(" %d", n_name);
8814 printf("\n");
8815 }
8816 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008817 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008818
Daniel Veillard42595322004-11-08 10:52:06 +00008819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008820}
8821
8822
Daniel Veillardce682bc2004-11-05 17:22:25 +00008823#define gen_nb_xmlCharEncodingHandlerPtr 1
8824static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8825 return(NULL);
8826}
8827static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8828}
8829
Daniel Veillardd93f6252004-11-02 15:53:51 +00008830static int
8831test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008833
Daniel Veillardce682bc2004-11-05 17:22:25 +00008834 int mem_base;
8835 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8836 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008837
Daniel Veillardce682bc2004-11-05 17:22:25 +00008838 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8839 mem_base = xmlMemBlocks();
8840 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8841
8842 xmlRegisterCharEncodingHandler(handler);
8843 call_tests++;
8844 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8845 xmlResetLastError();
8846 if (mem_base != xmlMemBlocks()) {
8847 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008849 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008850 printf(" %d", n_handler);
8851 printf("\n");
8852 }
8853 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008854 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008855
Daniel Veillard42595322004-11-08 10:52:06 +00008856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008857}
8858
8859static int
8860test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008862
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008863 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008864 test_ret += test_UTF8Toisolat1();
8865 test_ret += test_isolat1ToUTF8();
8866 test_ret += test_xmlAddEncodingAlias();
8867 test_ret += test_xmlCharEncCloseFunc();
8868 test_ret += test_xmlCharEncFirstLine();
8869 test_ret += test_xmlCharEncInFunc();
8870 test_ret += test_xmlCharEncOutFunc();
8871 test_ret += test_xmlCleanupCharEncodingHandlers();
8872 test_ret += test_xmlCleanupEncodingAliases();
8873 test_ret += test_xmlDelEncodingAlias();
8874 test_ret += test_xmlDetectCharEncoding();
8875 test_ret += test_xmlFindCharEncodingHandler();
8876 test_ret += test_xmlGetCharEncodingHandler();
8877 test_ret += test_xmlGetCharEncodingName();
8878 test_ret += test_xmlGetEncodingAlias();
8879 test_ret += test_xmlInitCharEncodingHandlers();
8880 test_ret += test_xmlNewCharEncodingHandler();
8881 test_ret += test_xmlParseCharEncoding();
8882 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008883
Daniel Veillard42595322004-11-08 10:52:06 +00008884 if (test_ret != 0)
8885 printf("Module encoding: %d errors\n", test_ret);
8886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008887}
8888
8889static int
8890test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008892
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008893 int mem_base;
8894 xmlEntityPtr ret_val;
8895 xmlDocPtr doc; /* the document */
8896 int n_doc;
8897 xmlChar * name; /* the entity name */
8898 int n_name;
8899 int type; /* the entity type XML_xxx_yyy_ENTITY */
8900 int n_type;
8901 xmlChar * ExternalID; /* the entity external ID if available */
8902 int n_ExternalID;
8903 xmlChar * SystemID; /* the entity system ID if available */
8904 int n_SystemID;
8905 xmlChar * content; /* the entity content */
8906 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008908 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8909 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8910 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8911 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8912 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8913 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8914 mem_base = xmlMemBlocks();
8915 doc = gen_xmlDocPtr(n_doc, 0);
8916 name = gen_const_xmlChar_ptr(n_name, 1);
8917 type = gen_int(n_type, 2);
8918 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8919 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8920 content = gen_const_xmlChar_ptr(n_content, 5);
8921
William M. Brackf13f77f2004-11-12 16:03:48 +00008922 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008923 desret_xmlEntityPtr(ret_val);
8924 call_tests++;
8925 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008926 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008927 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008928 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8929 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8930 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008931 xmlResetLastError();
8932 if (mem_base != xmlMemBlocks()) {
8933 printf("Leak of %d blocks found in xmlAddDocEntity",
8934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008935 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008936 printf(" %d", n_doc);
8937 printf(" %d", n_name);
8938 printf(" %d", n_type);
8939 printf(" %d", n_ExternalID);
8940 printf(" %d", n_SystemID);
8941 printf(" %d", n_content);
8942 printf("\n");
8943 }
8944 }
8945 }
8946 }
8947 }
8948 }
8949 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008950 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008951
Daniel Veillard42595322004-11-08 10:52:06 +00008952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008953}
8954
8955
8956static int
8957test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008959
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008960 int mem_base;
8961 xmlEntityPtr ret_val;
8962 xmlDocPtr doc; /* the document */
8963 int n_doc;
8964 xmlChar * name; /* the entity name */
8965 int n_name;
8966 int type; /* the entity type XML_xxx_yyy_ENTITY */
8967 int n_type;
8968 xmlChar * ExternalID; /* the entity external ID if available */
8969 int n_ExternalID;
8970 xmlChar * SystemID; /* the entity system ID if available */
8971 int n_SystemID;
8972 xmlChar * content; /* the entity content */
8973 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008974
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008975 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8976 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8977 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8978 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8979 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8980 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8981 mem_base = xmlMemBlocks();
8982 doc = gen_xmlDocPtr(n_doc, 0);
8983 name = gen_const_xmlChar_ptr(n_name, 1);
8984 type = gen_int(n_type, 2);
8985 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8986 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8987 content = gen_const_xmlChar_ptr(n_content, 5);
8988
William M. Brackf13f77f2004-11-12 16:03:48 +00008989 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008990 desret_xmlEntityPtr(ret_val);
8991 call_tests++;
8992 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008993 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008994 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008995 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8996 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8997 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008998 xmlResetLastError();
8999 if (mem_base != xmlMemBlocks()) {
9000 printf("Leak of %d blocks found in xmlAddDtdEntity",
9001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009002 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009003 printf(" %d", n_doc);
9004 printf(" %d", n_name);
9005 printf(" %d", n_type);
9006 printf(" %d", n_ExternalID);
9007 printf(" %d", n_SystemID);
9008 printf(" %d", n_content);
9009 printf("\n");
9010 }
9011 }
9012 }
9013 }
9014 }
9015 }
9016 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009018
Daniel Veillard42595322004-11-08 10:52:06 +00009019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009020}
9021
9022
9023static int
9024test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009026
William M. Brack21e4ef22005-01-02 09:53:13 +00009027#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009028#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009029 int mem_base;
9030
9031 mem_base = xmlMemBlocks();
9032
9033 xmlCleanupPredefinedEntities();
9034 call_tests++;
9035 xmlResetLastError();
9036 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009037 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009039 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009040 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009042 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009043#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009044#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009045
Daniel Veillard42595322004-11-08 10:52:06 +00009046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009047}
9048
9049
Daniel Veillardce682bc2004-11-05 17:22:25 +00009050#define gen_nb_xmlEntitiesTablePtr 1
9051static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9052 return(NULL);
9053}
9054static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9055}
9056
Daniel Veillardd93f6252004-11-02 15:53:51 +00009057static int
9058test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009060
9061
9062 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009064}
9065
9066
9067static int
9068test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009070
9071
9072 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009074}
9075
9076
9077static int
9078test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009080
William M. Brack21e4ef22005-01-02 09:53:13 +00009081#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009082 int mem_base;
9083 xmlBufferPtr buf; /* An XML buffer. */
9084 int n_buf;
9085 xmlEntitiesTablePtr table; /* An entity table */
9086 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009087
Daniel Veillardce682bc2004-11-05 17:22:25 +00009088 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9089 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9090 mem_base = xmlMemBlocks();
9091 buf = gen_xmlBufferPtr(n_buf, 0);
9092 table = gen_xmlEntitiesTablePtr(n_table, 1);
9093
9094 xmlDumpEntitiesTable(buf, table);
9095 call_tests++;
9096 des_xmlBufferPtr(n_buf, buf, 0);
9097 des_xmlEntitiesTablePtr(n_table, table, 1);
9098 xmlResetLastError();
9099 if (mem_base != xmlMemBlocks()) {
9100 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009102 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009103 printf(" %d", n_buf);
9104 printf(" %d", n_table);
9105 printf("\n");
9106 }
9107 }
9108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009109 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009110#endif
9111
Daniel Veillard42595322004-11-08 10:52:06 +00009112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009113}
9114
9115
Daniel Veillardce682bc2004-11-05 17:22:25 +00009116#define gen_nb_xmlEntityPtr 1
9117static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9118 return(NULL);
9119}
9120static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9121}
9122
Daniel Veillardd93f6252004-11-02 15:53:51 +00009123static int
9124test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009126
William M. Brack21e4ef22005-01-02 09:53:13 +00009127#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009128 int mem_base;
9129 xmlBufferPtr buf; /* An XML buffer. */
9130 int n_buf;
9131 xmlEntityPtr ent; /* An entity table */
9132 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009133
Daniel Veillardce682bc2004-11-05 17:22:25 +00009134 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9135 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9136 mem_base = xmlMemBlocks();
9137 buf = gen_xmlBufferPtr(n_buf, 0);
9138 ent = gen_xmlEntityPtr(n_ent, 1);
9139
9140 xmlDumpEntityDecl(buf, ent);
9141 call_tests++;
9142 des_xmlBufferPtr(n_buf, buf, 0);
9143 des_xmlEntityPtr(n_ent, ent, 1);
9144 xmlResetLastError();
9145 if (mem_base != xmlMemBlocks()) {
9146 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009148 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009149 printf(" %d", n_buf);
9150 printf(" %d", n_ent);
9151 printf("\n");
9152 }
9153 }
9154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009155 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009156#endif
9157
Daniel Veillard42595322004-11-08 10:52:06 +00009158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009159}
9160
9161
9162static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009163test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009165
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009166 int mem_base;
9167 xmlChar * ret_val;
9168 xmlDocPtr doc; /* the document containing the string */
9169 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009170 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009171 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009172
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009173 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9174 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009176 doc = gen_xmlDocPtr(n_doc, 0);
9177 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009178
William M. Brackf13f77f2004-11-12 16:03:48 +00009179 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009180 desret_xmlChar_ptr(ret_val);
9181 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009182 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009183 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009184 xmlResetLastError();
9185 if (mem_base != xmlMemBlocks()) {
9186 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009188 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009189 printf(" %d", n_doc);
9190 printf(" %d", n_input);
9191 printf("\n");
9192 }
9193 }
9194 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009195 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009196
Daniel Veillard42595322004-11-08 10:52:06 +00009197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009198}
9199
9200
9201static int
9202test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009204
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009205 int mem_base;
9206 xmlChar * ret_val;
9207 xmlDocPtr doc; /* the document containing the string */
9208 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009209 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009210 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009211
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009212 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9213 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009215 doc = gen_xmlDocPtr(n_doc, 0);
9216 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009217
William M. Brackf13f77f2004-11-12 16:03:48 +00009218 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009219 desret_xmlChar_ptr(ret_val);
9220 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009221 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009222 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009223 xmlResetLastError();
9224 if (mem_base != xmlMemBlocks()) {
9225 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009227 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009228 printf(" %d", n_doc);
9229 printf(" %d", n_input);
9230 printf("\n");
9231 }
9232 }
9233 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009234 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009235
Daniel Veillard42595322004-11-08 10:52:06 +00009236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009237}
9238
9239
9240static int
9241test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009243
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009244 int mem_base;
9245 xmlEntityPtr ret_val;
9246 xmlDocPtr doc; /* the document referencing the entity */
9247 int n_doc;
9248 xmlChar * name; /* the entity name */
9249 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009250
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009251 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9252 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9253 mem_base = xmlMemBlocks();
9254 doc = gen_xmlDocPtr(n_doc, 0);
9255 name = gen_const_xmlChar_ptr(n_name, 1);
9256
William M. Brackf13f77f2004-11-12 16:03:48 +00009257 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009258 desret_xmlEntityPtr(ret_val);
9259 call_tests++;
9260 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009261 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009262 xmlResetLastError();
9263 if (mem_base != xmlMemBlocks()) {
9264 printf("Leak of %d blocks found in xmlGetDocEntity",
9265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009266 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009267 printf(" %d", n_doc);
9268 printf(" %d", n_name);
9269 printf("\n");
9270 }
9271 }
9272 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009274
Daniel Veillard42595322004-11-08 10:52:06 +00009275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009276}
9277
9278
9279static int
9280test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009282
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009283 int mem_base;
9284 xmlEntityPtr ret_val;
9285 xmlDocPtr doc; /* the document referencing the entity */
9286 int n_doc;
9287 xmlChar * name; /* the entity name */
9288 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009289
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009290 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9291 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9292 mem_base = xmlMemBlocks();
9293 doc = gen_xmlDocPtr(n_doc, 0);
9294 name = gen_const_xmlChar_ptr(n_name, 1);
9295
William M. Brackf13f77f2004-11-12 16:03:48 +00009296 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009297 desret_xmlEntityPtr(ret_val);
9298 call_tests++;
9299 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009300 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009301 xmlResetLastError();
9302 if (mem_base != xmlMemBlocks()) {
9303 printf("Leak of %d blocks found in xmlGetDtdEntity",
9304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009305 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009306 printf(" %d", n_doc);
9307 printf(" %d", n_name);
9308 printf("\n");
9309 }
9310 }
9311 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009312 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009313
Daniel Veillard42595322004-11-08 10:52:06 +00009314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009315}
9316
9317
9318static int
9319test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009321
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009322 int mem_base;
9323 xmlEntityPtr ret_val;
9324 xmlDocPtr doc; /* the document referencing the entity */
9325 int n_doc;
9326 xmlChar * name; /* the entity name */
9327 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009328
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009329 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9330 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9331 mem_base = xmlMemBlocks();
9332 doc = gen_xmlDocPtr(n_doc, 0);
9333 name = gen_const_xmlChar_ptr(n_name, 1);
9334
William M. Brackf13f77f2004-11-12 16:03:48 +00009335 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009336 desret_xmlEntityPtr(ret_val);
9337 call_tests++;
9338 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009339 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009340 xmlResetLastError();
9341 if (mem_base != xmlMemBlocks()) {
9342 printf("Leak of %d blocks found in xmlGetParameterEntity",
9343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009344 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009345 printf(" %d", n_doc);
9346 printf(" %d", n_name);
9347 printf("\n");
9348 }
9349 }
9350 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009351 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009352
Daniel Veillard42595322004-11-08 10:52:06 +00009353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009354}
9355
9356
9357static int
9358test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009360
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009361 int mem_base;
9362 xmlEntityPtr ret_val;
9363 xmlChar * name; /* the entity name */
9364 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009365
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009366 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9367 mem_base = xmlMemBlocks();
9368 name = gen_const_xmlChar_ptr(n_name, 0);
9369
William M. Brackf13f77f2004-11-12 16:03:48 +00009370 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009371 desret_xmlEntityPtr(ret_val);
9372 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009373 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009374 xmlResetLastError();
9375 if (mem_base != xmlMemBlocks()) {
9376 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009378 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009379 printf(" %d", n_name);
9380 printf("\n");
9381 }
9382 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009383 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009384
Daniel Veillard42595322004-11-08 10:52:06 +00009385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009386}
9387
9388
9389static int
9390test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009392
William M. Brack21e4ef22005-01-02 09:53:13 +00009393#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009394#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009395 int mem_base;
9396
9397 mem_base = xmlMemBlocks();
9398
9399 xmlInitializePredefinedEntities();
9400 call_tests++;
9401 xmlResetLastError();
9402 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009403 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009405 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009406 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009408 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009409#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009410#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009411
Daniel Veillard42595322004-11-08 10:52:06 +00009412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009413}
9414
9415static int
9416test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009418
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009419 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009420 test_ret += test_xmlAddDocEntity();
9421 test_ret += test_xmlAddDtdEntity();
9422 test_ret += test_xmlCleanupPredefinedEntities();
9423 test_ret += test_xmlCopyEntitiesTable();
9424 test_ret += test_xmlCreateEntitiesTable();
9425 test_ret += test_xmlDumpEntitiesTable();
9426 test_ret += test_xmlDumpEntityDecl();
9427 test_ret += test_xmlEncodeEntitiesReentrant();
9428 test_ret += test_xmlEncodeSpecialChars();
9429 test_ret += test_xmlGetDocEntity();
9430 test_ret += test_xmlGetDtdEntity();
9431 test_ret += test_xmlGetParameterEntity();
9432 test_ret += test_xmlGetPredefinedEntity();
9433 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009434
Daniel Veillard42595322004-11-08 10:52:06 +00009435 if (test_ret != 0)
9436 printf("Module entities: %d errors\n", test_ret);
9437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009438}
9439
9440static int
9441test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009443
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009444 int mem_base;
9445 int ret_val;
9446 xmlHashTablePtr table; /* the hash table */
9447 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009448 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009449 int n_name;
9450 void * userdata; /* a pointer to the userdata */
9451 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009452
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009453 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9454 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9455 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9456 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009457 table = gen_xmlHashTablePtr(n_table, 0);
9458 name = gen_const_xmlChar_ptr(n_name, 1);
9459 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009460
William M. Brackf13f77f2004-11-12 16:03:48 +00009461 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009462 desret_int(ret_val);
9463 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009464 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009465 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009466 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009467 xmlResetLastError();
9468 if (mem_base != xmlMemBlocks()) {
9469 printf("Leak of %d blocks found in xmlHashAddEntry",
9470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009471 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009472 printf(" %d", n_table);
9473 printf(" %d", n_name);
9474 printf(" %d", n_userdata);
9475 printf("\n");
9476 }
9477 }
9478 }
9479 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009481
Daniel Veillard42595322004-11-08 10:52:06 +00009482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009483}
9484
9485
9486static int
9487test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009489
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009490 int mem_base;
9491 int ret_val;
9492 xmlHashTablePtr table; /* the hash table */
9493 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009494 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009495 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009496 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009497 int n_name2;
9498 void * userdata; /* a pointer to the userdata */
9499 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009500
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009501 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9503 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9504 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009506 table = gen_xmlHashTablePtr(n_table, 0);
9507 name = gen_const_xmlChar_ptr(n_name, 1);
9508 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9509 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009510
William M. Brackf13f77f2004-11-12 16:03:48 +00009511 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009512 desret_int(ret_val);
9513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009514 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009515 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9516 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009517 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009518 xmlResetLastError();
9519 if (mem_base != xmlMemBlocks()) {
9520 printf("Leak of %d blocks found in xmlHashAddEntry2",
9521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009522 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009523 printf(" %d", n_table);
9524 printf(" %d", n_name);
9525 printf(" %d", n_name2);
9526 printf(" %d", n_userdata);
9527 printf("\n");
9528 }
9529 }
9530 }
9531 }
9532 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009533 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009534
Daniel Veillard42595322004-11-08 10:52:06 +00009535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009536}
9537
9538
9539static int
9540test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009542
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009543 int mem_base;
9544 int ret_val;
9545 xmlHashTablePtr table; /* the hash table */
9546 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009547 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009548 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009549 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009550 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009551 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009552 int n_name3;
9553 void * userdata; /* a pointer to the userdata */
9554 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009555
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009556 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9557 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9558 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9559 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9560 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9561 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009562 table = gen_xmlHashTablePtr(n_table, 0);
9563 name = gen_const_xmlChar_ptr(n_name, 1);
9564 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9565 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9566 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009567
William M. Brackf13f77f2004-11-12 16:03:48 +00009568 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009569 desret_int(ret_val);
9570 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009571 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009572 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9573 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9574 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009575 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009576 xmlResetLastError();
9577 if (mem_base != xmlMemBlocks()) {
9578 printf("Leak of %d blocks found in xmlHashAddEntry3",
9579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009580 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009581 printf(" %d", n_table);
9582 printf(" %d", n_name);
9583 printf(" %d", n_name2);
9584 printf(" %d", n_name3);
9585 printf(" %d", n_userdata);
9586 printf("\n");
9587 }
9588 }
9589 }
9590 }
9591 }
9592 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009593 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009594
Daniel Veillard42595322004-11-08 10:52:06 +00009595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009596}
9597
9598
9599static int
9600test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009602
9603
9604 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009606}
9607
9608
9609static int
9610test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009612
9613
9614 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009616}
9617
9618
9619static int
9620test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009622
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009623 int mem_base;
9624 void * ret_val;
9625 xmlHashTablePtr table; /* the hash table */
9626 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009627 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009628 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009629
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009630 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9631 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9632 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009633 table = gen_xmlHashTablePtr(n_table, 0);
9634 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009635
William M. Brackf13f77f2004-11-12 16:03:48 +00009636 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009637 desret_void_ptr(ret_val);
9638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009639 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009640 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009641 xmlResetLastError();
9642 if (mem_base != xmlMemBlocks()) {
9643 printf("Leak of %d blocks found in xmlHashLookup",
9644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009645 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009646 printf(" %d", n_table);
9647 printf(" %d", n_name);
9648 printf("\n");
9649 }
9650 }
9651 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009652 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009653
Daniel Veillard42595322004-11-08 10:52:06 +00009654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009655}
9656
9657
9658static int
9659test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009661
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009662 int mem_base;
9663 void * ret_val;
9664 xmlHashTablePtr table; /* the hash table */
9665 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009666 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009667 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009668 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009669 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009670
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009671 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9672 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9673 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9674 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009675 table = gen_xmlHashTablePtr(n_table, 0);
9676 name = gen_const_xmlChar_ptr(n_name, 1);
9677 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009678
William M. Brackf13f77f2004-11-12 16:03:48 +00009679 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009680 desret_void_ptr(ret_val);
9681 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009682 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009683 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9684 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009685 xmlResetLastError();
9686 if (mem_base != xmlMemBlocks()) {
9687 printf("Leak of %d blocks found in xmlHashLookup2",
9688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009689 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009690 printf(" %d", n_table);
9691 printf(" %d", n_name);
9692 printf(" %d", n_name2);
9693 printf("\n");
9694 }
9695 }
9696 }
9697 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009699
Daniel Veillard42595322004-11-08 10:52:06 +00009700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009701}
9702
9703
9704static int
9705test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009707
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009708 int mem_base;
9709 void * ret_val;
9710 xmlHashTablePtr table; /* the hash table */
9711 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009712 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009713 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009714 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009715 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009716 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009717 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009718
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009719 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9720 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9721 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9722 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009724 table = gen_xmlHashTablePtr(n_table, 0);
9725 name = gen_const_xmlChar_ptr(n_name, 1);
9726 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9727 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009728
William M. Brackf13f77f2004-11-12 16:03:48 +00009729 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009730 desret_void_ptr(ret_val);
9731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009732 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009733 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9734 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9735 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009736 xmlResetLastError();
9737 if (mem_base != xmlMemBlocks()) {
9738 printf("Leak of %d blocks found in xmlHashLookup3",
9739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009740 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009741 printf(" %d", n_table);
9742 printf(" %d", n_name);
9743 printf(" %d", n_name2);
9744 printf(" %d", n_name3);
9745 printf("\n");
9746 }
9747 }
9748 }
9749 }
9750 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009752
Daniel Veillard42595322004-11-08 10:52:06 +00009753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009754}
9755
9756
9757static int
9758test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009760
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009761 int mem_base;
9762 void * ret_val;
9763 xmlHashTablePtr table; /* the hash table */
9764 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009765 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009766 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009767 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009768 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009769
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009770 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9771 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9772 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009774 table = gen_xmlHashTablePtr(n_table, 0);
9775 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9776 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009777
William M. Brackf13f77f2004-11-12 16:03:48 +00009778 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009779 desret_void_ptr(ret_val);
9780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009781 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009782 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9783 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009784 xmlResetLastError();
9785 if (mem_base != xmlMemBlocks()) {
9786 printf("Leak of %d blocks found in xmlHashQLookup",
9787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009788 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009789 printf(" %d", n_table);
9790 printf(" %d", n_prefix);
9791 printf(" %d", n_name);
9792 printf("\n");
9793 }
9794 }
9795 }
9796 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009797 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009798
Daniel Veillard42595322004-11-08 10:52:06 +00009799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009800}
9801
9802
9803static int
9804test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009806
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009807 int mem_base;
9808 void * ret_val;
9809 xmlHashTablePtr table; /* the hash table */
9810 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009811 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009812 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009813 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009814 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009815 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009816 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009817 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009818 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009819
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009820 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9821 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9822 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9823 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9824 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9825 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009826 table = gen_xmlHashTablePtr(n_table, 0);
9827 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9828 name = gen_const_xmlChar_ptr(n_name, 2);
9829 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9830 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009831
William M. Brackf13f77f2004-11-12 16:03:48 +00009832 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009833 desret_void_ptr(ret_val);
9834 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009835 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009836 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9837 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9838 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9839 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009840 xmlResetLastError();
9841 if (mem_base != xmlMemBlocks()) {
9842 printf("Leak of %d blocks found in xmlHashQLookup2",
9843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009844 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009845 printf(" %d", n_table);
9846 printf(" %d", n_prefix);
9847 printf(" %d", n_name);
9848 printf(" %d", n_prefix2);
9849 printf(" %d", n_name2);
9850 printf("\n");
9851 }
9852 }
9853 }
9854 }
9855 }
9856 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009857 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009858
Daniel Veillard42595322004-11-08 10:52:06 +00009859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009860}
9861
9862
9863static int
9864test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009866
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009867 int mem_base;
9868 void * ret_val;
9869 xmlHashTablePtr table; /* the hash table */
9870 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009871 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009872 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009873 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009874 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009875 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009876 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009877 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009878 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009879 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009880 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009881 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009882 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009883
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009884 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9885 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9886 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9887 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9888 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9889 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9890 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9891 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009892 table = gen_xmlHashTablePtr(n_table, 0);
9893 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9894 name = gen_const_xmlChar_ptr(n_name, 2);
9895 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9896 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9897 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9898 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009899
William M. Brackf13f77f2004-11-12 16:03:48 +00009900 ret_val = xmlHashQLookup3(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2, (const xmlChar *)prefix3, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009901 desret_void_ptr(ret_val);
9902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009903 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009904 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9905 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9906 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9907 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9908 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9909 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 xmlResetLastError();
9911 if (mem_base != xmlMemBlocks()) {
9912 printf("Leak of %d blocks found in xmlHashQLookup3",
9913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009914 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009915 printf(" %d", n_table);
9916 printf(" %d", n_prefix);
9917 printf(" %d", n_name);
9918 printf(" %d", n_prefix2);
9919 printf(" %d", n_name2);
9920 printf(" %d", n_prefix3);
9921 printf(" %d", n_name3);
9922 printf("\n");
9923 }
9924 }
9925 }
9926 }
9927 }
9928 }
9929 }
9930 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009932
Daniel Veillard42595322004-11-08 10:52:06 +00009933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009934}
9935
9936
9937static int
9938test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009940
Daniel Veillard42595322004-11-08 10:52:06 +00009941 int mem_base;
9942 int ret_val;
9943 xmlHashTablePtr table; /* the hash table */
9944 int n_table;
9945 xmlChar * name; /* the name of the userdata */
9946 int n_name;
9947 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9948 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009949
Daniel Veillard42595322004-11-08 10:52:06 +00009950 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9951 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9952 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9953 mem_base = xmlMemBlocks();
9954 table = gen_xmlHashTablePtr(n_table, 0);
9955 name = gen_const_xmlChar_ptr(n_name, 1);
9956 f = gen_xmlHashDeallocator(n_f, 2);
9957
William M. Brackf13f77f2004-11-12 16:03:48 +00009958 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +00009959 desret_int(ret_val);
9960 call_tests++;
9961 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009962 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00009963 des_xmlHashDeallocator(n_f, f, 2);
9964 xmlResetLastError();
9965 if (mem_base != xmlMemBlocks()) {
9966 printf("Leak of %d blocks found in xmlHashRemoveEntry",
9967 xmlMemBlocks() - mem_base);
9968 test_ret++;
9969 printf(" %d", n_table);
9970 printf(" %d", n_name);
9971 printf(" %d", n_f);
9972 printf("\n");
9973 }
9974 }
9975 }
9976 }
Daniel Veillard42595322004-11-08 10:52:06 +00009977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009978
Daniel Veillard42595322004-11-08 10:52:06 +00009979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009980}
9981
9982
9983static int
9984test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009986
Daniel Veillard42595322004-11-08 10:52:06 +00009987 int mem_base;
9988 int ret_val;
9989 xmlHashTablePtr table; /* the hash table */
9990 int n_table;
9991 xmlChar * name; /* the name of the userdata */
9992 int n_name;
9993 xmlChar * name2; /* a second name of the userdata */
9994 int n_name2;
9995 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9996 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009997
Daniel Veillard42595322004-11-08 10:52:06 +00009998 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9999 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10000 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10001 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10002 mem_base = xmlMemBlocks();
10003 table = gen_xmlHashTablePtr(n_table, 0);
10004 name = gen_const_xmlChar_ptr(n_name, 1);
10005 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10006 f = gen_xmlHashDeallocator(n_f, 3);
10007
William M. Brackf13f77f2004-11-12 16:03:48 +000010008 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010009 desret_int(ret_val);
10010 call_tests++;
10011 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010012 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10013 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010014 des_xmlHashDeallocator(n_f, f, 3);
10015 xmlResetLastError();
10016 if (mem_base != xmlMemBlocks()) {
10017 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10018 xmlMemBlocks() - mem_base);
10019 test_ret++;
10020 printf(" %d", n_table);
10021 printf(" %d", n_name);
10022 printf(" %d", n_name2);
10023 printf(" %d", n_f);
10024 printf("\n");
10025 }
10026 }
10027 }
10028 }
10029 }
Daniel Veillard42595322004-11-08 10:52:06 +000010030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010031
Daniel Veillard42595322004-11-08 10:52:06 +000010032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010033}
10034
10035
10036static int
10037test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010039
Daniel Veillard42595322004-11-08 10:52:06 +000010040 int mem_base;
10041 int ret_val;
10042 xmlHashTablePtr table; /* the hash table */
10043 int n_table;
10044 xmlChar * name; /* the name of the userdata */
10045 int n_name;
10046 xmlChar * name2; /* a second name of the userdata */
10047 int n_name2;
10048 xmlChar * name3; /* a third name of the userdata */
10049 int n_name3;
10050 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10051 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010052
Daniel Veillard42595322004-11-08 10:52:06 +000010053 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10054 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10055 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10056 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10057 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10058 mem_base = xmlMemBlocks();
10059 table = gen_xmlHashTablePtr(n_table, 0);
10060 name = gen_const_xmlChar_ptr(n_name, 1);
10061 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10062 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10063 f = gen_xmlHashDeallocator(n_f, 4);
10064
William M. Brackf13f77f2004-11-12 16:03:48 +000010065 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010066 desret_int(ret_val);
10067 call_tests++;
10068 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010069 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10070 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10071 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010072 des_xmlHashDeallocator(n_f, f, 4);
10073 xmlResetLastError();
10074 if (mem_base != xmlMemBlocks()) {
10075 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10076 xmlMemBlocks() - mem_base);
10077 test_ret++;
10078 printf(" %d", n_table);
10079 printf(" %d", n_name);
10080 printf(" %d", n_name2);
10081 printf(" %d", n_name3);
10082 printf(" %d", n_f);
10083 printf("\n");
10084 }
10085 }
10086 }
10087 }
10088 }
10089 }
Daniel Veillard42595322004-11-08 10:52:06 +000010090 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010091
Daniel Veillard42595322004-11-08 10:52:06 +000010092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010093}
10094
10095
10096static int
10097test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010099
10100
10101 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010103}
10104
10105
10106static int
10107test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010109
10110
10111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010113}
10114
10115
10116static int
10117test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010119
10120
10121 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010123}
10124
10125
10126static int
10127test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010129
10130
10131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010133}
10134
10135
10136static int
10137test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010139
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010140 int mem_base;
10141 int ret_val;
10142 xmlHashTablePtr table; /* the hash table */
10143 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010144
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010145 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010147 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010148
10149 ret_val = xmlHashSize(table);
10150 desret_int(ret_val);
10151 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010152 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010153 xmlResetLastError();
10154 if (mem_base != xmlMemBlocks()) {
10155 printf("Leak of %d blocks found in xmlHashSize",
10156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010157 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010158 printf(" %d", n_table);
10159 printf("\n");
10160 }
10161 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010162 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010163
Daniel Veillard42595322004-11-08 10:52:06 +000010164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010165}
10166
10167
10168static int
10169test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010171
Daniel Veillard42595322004-11-08 10:52:06 +000010172 int mem_base;
10173 int ret_val;
10174 xmlHashTablePtr table; /* the hash table */
10175 int n_table;
10176 xmlChar * name; /* the name of the userdata */
10177 int n_name;
10178 void * userdata; /* a pointer to the userdata */
10179 int n_userdata;
10180 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10181 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010182
Daniel Veillard42595322004-11-08 10:52:06 +000010183 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10184 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10185 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10186 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10187 mem_base = xmlMemBlocks();
10188 table = gen_xmlHashTablePtr(n_table, 0);
10189 name = gen_const_xmlChar_ptr(n_name, 1);
10190 userdata = gen_userdata(n_userdata, 2);
10191 f = gen_xmlHashDeallocator(n_f, 3);
10192
William M. Brackf13f77f2004-11-12 16:03:48 +000010193 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010194 desret_int(ret_val);
10195 call_tests++;
10196 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010197 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010198 des_userdata(n_userdata, userdata, 2);
10199 des_xmlHashDeallocator(n_f, f, 3);
10200 xmlResetLastError();
10201 if (mem_base != xmlMemBlocks()) {
10202 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10203 xmlMemBlocks() - mem_base);
10204 test_ret++;
10205 printf(" %d", n_table);
10206 printf(" %d", n_name);
10207 printf(" %d", n_userdata);
10208 printf(" %d", n_f);
10209 printf("\n");
10210 }
10211 }
10212 }
10213 }
10214 }
Daniel Veillard42595322004-11-08 10:52:06 +000010215 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010216
Daniel Veillard42595322004-11-08 10:52:06 +000010217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010218}
10219
10220
10221static int
10222test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010224
Daniel Veillard42595322004-11-08 10:52:06 +000010225 int mem_base;
10226 int ret_val;
10227 xmlHashTablePtr table; /* the hash table */
10228 int n_table;
10229 xmlChar * name; /* the name of the userdata */
10230 int n_name;
10231 xmlChar * name2; /* a second name of the userdata */
10232 int n_name2;
10233 void * userdata; /* a pointer to the userdata */
10234 int n_userdata;
10235 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10236 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010237
Daniel Veillard42595322004-11-08 10:52:06 +000010238 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10239 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10240 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10241 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10242 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10243 mem_base = xmlMemBlocks();
10244 table = gen_xmlHashTablePtr(n_table, 0);
10245 name = gen_const_xmlChar_ptr(n_name, 1);
10246 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10247 userdata = gen_userdata(n_userdata, 3);
10248 f = gen_xmlHashDeallocator(n_f, 4);
10249
William M. Brackf13f77f2004-11-12 16:03:48 +000010250 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010251 desret_int(ret_val);
10252 call_tests++;
10253 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010254 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10255 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010256 des_userdata(n_userdata, userdata, 3);
10257 des_xmlHashDeallocator(n_f, f, 4);
10258 xmlResetLastError();
10259 if (mem_base != xmlMemBlocks()) {
10260 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10261 xmlMemBlocks() - mem_base);
10262 test_ret++;
10263 printf(" %d", n_table);
10264 printf(" %d", n_name);
10265 printf(" %d", n_name2);
10266 printf(" %d", n_userdata);
10267 printf(" %d", n_f);
10268 printf("\n");
10269 }
10270 }
10271 }
10272 }
10273 }
10274 }
Daniel Veillard42595322004-11-08 10:52:06 +000010275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010276
Daniel Veillard42595322004-11-08 10:52:06 +000010277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010278}
10279
10280
10281static int
10282test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010284
Daniel Veillard42595322004-11-08 10:52:06 +000010285 int mem_base;
10286 int ret_val;
10287 xmlHashTablePtr table; /* the hash table */
10288 int n_table;
10289 xmlChar * name; /* the name of the userdata */
10290 int n_name;
10291 xmlChar * name2; /* a second name of the userdata */
10292 int n_name2;
10293 xmlChar * name3; /* a third name of the userdata */
10294 int n_name3;
10295 void * userdata; /* a pointer to the userdata */
10296 int n_userdata;
10297 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10298 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010299
Daniel Veillard42595322004-11-08 10:52:06 +000010300 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10301 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10302 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10303 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10304 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10305 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10306 mem_base = xmlMemBlocks();
10307 table = gen_xmlHashTablePtr(n_table, 0);
10308 name = gen_const_xmlChar_ptr(n_name, 1);
10309 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10310 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10311 userdata = gen_userdata(n_userdata, 4);
10312 f = gen_xmlHashDeallocator(n_f, 5);
10313
William M. Brackf13f77f2004-11-12 16:03:48 +000010314 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010315 desret_int(ret_val);
10316 call_tests++;
10317 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010318 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10319 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10320 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010321 des_userdata(n_userdata, userdata, 4);
10322 des_xmlHashDeallocator(n_f, f, 5);
10323 xmlResetLastError();
10324 if (mem_base != xmlMemBlocks()) {
10325 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10326 xmlMemBlocks() - mem_base);
10327 test_ret++;
10328 printf(" %d", n_table);
10329 printf(" %d", n_name);
10330 printf(" %d", n_name2);
10331 printf(" %d", n_name3);
10332 printf(" %d", n_userdata);
10333 printf(" %d", n_f);
10334 printf("\n");
10335 }
10336 }
10337 }
10338 }
10339 }
10340 }
10341 }
Daniel Veillard42595322004-11-08 10:52:06 +000010342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010343
Daniel Veillard42595322004-11-08 10:52:06 +000010344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010345}
10346
10347static int
10348test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010350
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010351 if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010352 test_ret += test_xmlHashAddEntry();
10353 test_ret += test_xmlHashAddEntry2();
10354 test_ret += test_xmlHashAddEntry3();
10355 test_ret += test_xmlHashCopy();
10356 test_ret += test_xmlHashCreate();
10357 test_ret += test_xmlHashLookup();
10358 test_ret += test_xmlHashLookup2();
10359 test_ret += test_xmlHashLookup3();
10360 test_ret += test_xmlHashQLookup();
10361 test_ret += test_xmlHashQLookup2();
10362 test_ret += test_xmlHashQLookup3();
10363 test_ret += test_xmlHashRemoveEntry();
10364 test_ret += test_xmlHashRemoveEntry2();
10365 test_ret += test_xmlHashRemoveEntry3();
10366 test_ret += test_xmlHashScan();
10367 test_ret += test_xmlHashScan3();
10368 test_ret += test_xmlHashScanFull();
10369 test_ret += test_xmlHashScanFull3();
10370 test_ret += test_xmlHashSize();
10371 test_ret += test_xmlHashUpdateEntry();
10372 test_ret += test_xmlHashUpdateEntry2();
10373 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010374
Daniel Veillard42595322004-11-08 10:52:06 +000010375 if (test_ret != 0)
10376 printf("Module hash: %d errors\n", test_ret);
10377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010378}
10379
Daniel Veillardce682bc2004-11-05 17:22:25 +000010380#define gen_nb_xmlLinkPtr 1
10381static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10382 return(NULL);
10383}
10384static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10385}
10386
Daniel Veillardd93f6252004-11-02 15:53:51 +000010387static int
10388test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010390
Daniel Veillardce682bc2004-11-05 17:22:25 +000010391 int mem_base;
10392 void * ret_val;
10393 xmlLinkPtr lk; /* a link */
10394 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010395
Daniel Veillardce682bc2004-11-05 17:22:25 +000010396 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10397 mem_base = xmlMemBlocks();
10398 lk = gen_xmlLinkPtr(n_lk, 0);
10399
10400 ret_val = xmlLinkGetData(lk);
10401 desret_void_ptr(ret_val);
10402 call_tests++;
10403 des_xmlLinkPtr(n_lk, lk, 0);
10404 xmlResetLastError();
10405 if (mem_base != xmlMemBlocks()) {
10406 printf("Leak of %d blocks found in xmlLinkGetData",
10407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010408 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010409 printf(" %d", n_lk);
10410 printf("\n");
10411 }
10412 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010413 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010414
Daniel Veillard42595322004-11-08 10:52:06 +000010415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010416}
10417
10418
10419static int
10420test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010422
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010423 int mem_base;
10424 int ret_val;
10425 xmlListPtr l; /* a list */
10426 int n_l;
10427 void * data; /* the data */
10428 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010429
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010430 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10431 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010433 l = gen_xmlListPtr(n_l, 0);
10434 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010435
10436 ret_val = xmlListAppend(l, data);
10437 desret_int(ret_val);
10438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010439 des_xmlListPtr(n_l, l, 0);
10440 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010441 xmlResetLastError();
10442 if (mem_base != xmlMemBlocks()) {
10443 printf("Leak of %d blocks found in xmlListAppend",
10444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010445 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010446 printf(" %d", n_l);
10447 printf(" %d", n_data);
10448 printf("\n");
10449 }
10450 }
10451 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010453
Daniel Veillard42595322004-11-08 10:52:06 +000010454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010455}
10456
10457
10458static int
10459test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010462 int mem_base;
10463 xmlListPtr l; /* a list */
10464 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010465
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010466 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010468 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010469
10470 xmlListClear(l);
10471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010472 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010473 xmlResetLastError();
10474 if (mem_base != xmlMemBlocks()) {
10475 printf("Leak of %d blocks found in xmlListClear",
10476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010477 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010478 printf(" %d", n_l);
10479 printf("\n");
10480 }
10481 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010482 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010483
Daniel Veillard42595322004-11-08 10:52:06 +000010484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010485}
10486
10487
Daniel Veillardce682bc2004-11-05 17:22:25 +000010488#define gen_nb_const_xmlListPtr 1
10489static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10490 return(NULL);
10491}
10492static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10493}
10494
Daniel Veillardd93f6252004-11-02 15:53:51 +000010495static int
10496test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010498
Daniel Veillardce682bc2004-11-05 17:22:25 +000010499 int mem_base;
10500 int ret_val;
10501 xmlListPtr cur; /* the new list */
10502 int n_cur;
10503 xmlListPtr old; /* the old list */
10504 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010505
Daniel Veillardce682bc2004-11-05 17:22:25 +000010506 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10507 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10508 mem_base = xmlMemBlocks();
10509 cur = gen_xmlListPtr(n_cur, 0);
10510 old = gen_const_xmlListPtr(n_old, 1);
10511
William M. Brackf13f77f2004-11-12 16:03:48 +000010512 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010513 desret_int(ret_val);
10514 call_tests++;
10515 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010516 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010517 xmlResetLastError();
10518 if (mem_base != xmlMemBlocks()) {
10519 printf("Leak of %d blocks found in xmlListCopy",
10520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010521 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010522 printf(" %d", n_cur);
10523 printf(" %d", n_old);
10524 printf("\n");
10525 }
10526 }
10527 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010528 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010529
Daniel Veillard42595322004-11-08 10:52:06 +000010530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010531}
10532
10533
10534static int
10535test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010537
10538
10539 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010541}
10542
10543
10544static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010545test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010547
10548
10549 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010551}
10552
10553
10554static int
10555test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010557
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010558 int mem_base;
10559 int ret_val;
10560 xmlListPtr l; /* a list */
10561 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010562
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010563 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10564 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010565 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010566
10567 ret_val = xmlListEmpty(l);
10568 desret_int(ret_val);
10569 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010570 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010571 xmlResetLastError();
10572 if (mem_base != xmlMemBlocks()) {
10573 printf("Leak of %d blocks found in xmlListEmpty",
10574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010575 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010576 printf(" %d", n_l);
10577 printf("\n");
10578 }
10579 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010581
Daniel Veillard42595322004-11-08 10:52:06 +000010582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010583}
10584
10585
10586static int
10587test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010589
10590
10591 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010593}
10594
10595
10596static int
10597test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010599
10600
10601 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010603}
10604
10605
10606static int
10607test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010609
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010610 int mem_base;
10611 int ret_val;
10612 xmlListPtr l; /* a list */
10613 int n_l;
10614 void * data; /* the data */
10615 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010616
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010617 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10618 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10619 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010620 l = gen_xmlListPtr(n_l, 0);
10621 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010622
10623 ret_val = xmlListInsert(l, data);
10624 desret_int(ret_val);
10625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010626 des_xmlListPtr(n_l, l, 0);
10627 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010628 xmlResetLastError();
10629 if (mem_base != xmlMemBlocks()) {
10630 printf("Leak of %d blocks found in xmlListInsert",
10631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010632 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010633 printf(" %d", n_l);
10634 printf(" %d", n_data);
10635 printf("\n");
10636 }
10637 }
10638 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010639 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010640
Daniel Veillard42595322004-11-08 10:52:06 +000010641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010642}
10643
10644
10645static int
10646test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010648
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010649 int mem_base;
10650 xmlListPtr l1; /* the original list */
10651 int n_l1;
10652 xmlListPtr l2; /* the new list */
10653 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010654
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010655 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10656 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010658 l1 = gen_xmlListPtr(n_l1, 0);
10659 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010660
10661 xmlListMerge(l1, l2);
10662 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010663 des_xmlListPtr(n_l1, l1, 0);
10664 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010665 xmlResetLastError();
10666 if (mem_base != xmlMemBlocks()) {
10667 printf("Leak of %d blocks found in xmlListMerge",
10668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010669 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010670 printf(" %d", n_l1);
10671 printf(" %d", n_l2);
10672 printf("\n");
10673 }
10674 }
10675 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010676 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010677
Daniel Veillard42595322004-11-08 10:52:06 +000010678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010679}
10680
10681
10682static int
10683test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010685
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010686 int mem_base;
10687 xmlListPtr l; /* a list */
10688 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010689
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010690 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010692 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010693
10694 xmlListPopBack(l);
10695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010696 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010697 xmlResetLastError();
10698 if (mem_base != xmlMemBlocks()) {
10699 printf("Leak of %d blocks found in xmlListPopBack",
10700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010701 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010702 printf(" %d", n_l);
10703 printf("\n");
10704 }
10705 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010706 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010707
Daniel Veillard42595322004-11-08 10:52:06 +000010708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010709}
10710
10711
10712static int
10713test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010715
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010716 int mem_base;
10717 xmlListPtr l; /* a list */
10718 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010719
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010720 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010722 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010723
10724 xmlListPopFront(l);
10725 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010726 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010727 xmlResetLastError();
10728 if (mem_base != xmlMemBlocks()) {
10729 printf("Leak of %d blocks found in xmlListPopFront",
10730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010731 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010732 printf(" %d", n_l);
10733 printf("\n");
10734 }
10735 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010737
Daniel Veillard42595322004-11-08 10:52:06 +000010738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010739}
10740
10741
10742static int
10743test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010745
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010746 int mem_base;
10747 int ret_val;
10748 xmlListPtr l; /* a list */
10749 int n_l;
10750 void * data; /* new data */
10751 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010752
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010753 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10754 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10755 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010756 l = gen_xmlListPtr(n_l, 0);
10757 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010758
10759 ret_val = xmlListPushBack(l, data);
10760 desret_int(ret_val);
10761 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010762 des_xmlListPtr(n_l, l, 0);
10763 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010764 xmlResetLastError();
10765 if (mem_base != xmlMemBlocks()) {
10766 printf("Leak of %d blocks found in xmlListPushBack",
10767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010768 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010769 printf(" %d", n_l);
10770 printf(" %d", n_data);
10771 printf("\n");
10772 }
10773 }
10774 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010776
Daniel Veillard42595322004-11-08 10:52:06 +000010777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010778}
10779
10780
10781static int
10782test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010784
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010785 int mem_base;
10786 int ret_val;
10787 xmlListPtr l; /* a list */
10788 int n_l;
10789 void * data; /* new data */
10790 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010791
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010792 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10793 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10794 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010795 l = gen_xmlListPtr(n_l, 0);
10796 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010797
10798 ret_val = xmlListPushFront(l, data);
10799 desret_int(ret_val);
10800 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010801 des_xmlListPtr(n_l, l, 0);
10802 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010803 xmlResetLastError();
10804 if (mem_base != xmlMemBlocks()) {
10805 printf("Leak of %d blocks found in xmlListPushFront",
10806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010807 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010808 printf(" %d", n_l);
10809 printf(" %d", n_data);
10810 printf("\n");
10811 }
10812 }
10813 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010814 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010815
Daniel Veillard42595322004-11-08 10:52:06 +000010816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010817}
10818
10819
10820static int
10821test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 int mem_base;
10825 int ret_val;
10826 xmlListPtr l; /* a list */
10827 int n_l;
10828 void * data; /* list data */
10829 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010830
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010831 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10832 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10833 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010834 l = gen_xmlListPtr(n_l, 0);
10835 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010836
10837 ret_val = xmlListRemoveAll(l, data);
10838 desret_int(ret_val);
10839 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010840 des_xmlListPtr(n_l, l, 0);
10841 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010842 xmlResetLastError();
10843 if (mem_base != xmlMemBlocks()) {
10844 printf("Leak of %d blocks found in xmlListRemoveAll",
10845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010846 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010847 printf(" %d", n_l);
10848 printf(" %d", n_data);
10849 printf("\n");
10850 }
10851 }
10852 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010853 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010854
Daniel Veillard42595322004-11-08 10:52:06 +000010855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010856}
10857
10858
10859static int
10860test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010862
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010863 int mem_base;
10864 int ret_val;
10865 xmlListPtr l; /* a list */
10866 int n_l;
10867 void * data; /* list data */
10868 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010869
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010870 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10871 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010873 l = gen_xmlListPtr(n_l, 0);
10874 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010875
10876 ret_val = xmlListRemoveFirst(l, data);
10877 desret_int(ret_val);
10878 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010879 des_xmlListPtr(n_l, l, 0);
10880 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010881 xmlResetLastError();
10882 if (mem_base != xmlMemBlocks()) {
10883 printf("Leak of %d blocks found in xmlListRemoveFirst",
10884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010885 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010886 printf(" %d", n_l);
10887 printf(" %d", n_data);
10888 printf("\n");
10889 }
10890 }
10891 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010892 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010893
Daniel Veillard42595322004-11-08 10:52:06 +000010894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010895}
10896
10897
10898static int
10899test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010902 int mem_base;
10903 int ret_val;
10904 xmlListPtr l; /* a list */
10905 int n_l;
10906 void * data; /* list data */
10907 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010908
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010909 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10910 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010912 l = gen_xmlListPtr(n_l, 0);
10913 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010914
10915 ret_val = xmlListRemoveLast(l, data);
10916 desret_int(ret_val);
10917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010918 des_xmlListPtr(n_l, l, 0);
10919 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010920 xmlResetLastError();
10921 if (mem_base != xmlMemBlocks()) {
10922 printf("Leak of %d blocks found in xmlListRemoveLast",
10923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010924 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010925 printf(" %d", n_l);
10926 printf(" %d", n_data);
10927 printf("\n");
10928 }
10929 }
10930 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010932
Daniel Veillard42595322004-11-08 10:52:06 +000010933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010934}
10935
10936
10937static int
10938test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010940
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010941 int mem_base;
10942 xmlListPtr l; /* a list */
10943 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010944
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010945 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010947 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010948
10949 xmlListReverse(l);
10950 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010951 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010952 xmlResetLastError();
10953 if (mem_base != xmlMemBlocks()) {
10954 printf("Leak of %d blocks found in xmlListReverse",
10955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010956 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010957 printf(" %d", n_l);
10958 printf("\n");
10959 }
10960 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010961 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010962
Daniel Veillard42595322004-11-08 10:52:06 +000010963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010964}
10965
10966
10967static int
10968test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010970
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010971 int mem_base;
10972 void * ret_val;
10973 xmlListPtr l; /* a list */
10974 int n_l;
10975 void * data; /* a search value */
10976 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010977
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010978 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10979 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010981 l = gen_xmlListPtr(n_l, 0);
10982 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010983
10984 ret_val = xmlListReverseSearch(l, data);
10985 desret_void_ptr(ret_val);
10986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010987 des_xmlListPtr(n_l, l, 0);
10988 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010989 xmlResetLastError();
10990 if (mem_base != xmlMemBlocks()) {
10991 printf("Leak of %d blocks found in xmlListReverseSearch",
10992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010993 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010994 printf(" %d", n_l);
10995 printf(" %d", n_data);
10996 printf("\n");
10997 }
10998 }
10999 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011000 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011001
Daniel Veillard42595322004-11-08 10:52:06 +000011002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011003}
11004
11005
11006static int
11007test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011009
11010
11011 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011013}
11014
11015
11016static int
11017test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011019
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011020 int mem_base;
11021 void * ret_val;
11022 xmlListPtr l; /* a list */
11023 int n_l;
11024 void * data; /* a search value */
11025 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011026
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011027 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11028 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11029 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011030 l = gen_xmlListPtr(n_l, 0);
11031 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011032
11033 ret_val = xmlListSearch(l, data);
11034 desret_void_ptr(ret_val);
11035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011036 des_xmlListPtr(n_l, l, 0);
11037 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011038 xmlResetLastError();
11039 if (mem_base != xmlMemBlocks()) {
11040 printf("Leak of %d blocks found in xmlListSearch",
11041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011042 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011043 printf(" %d", n_l);
11044 printf(" %d", n_data);
11045 printf("\n");
11046 }
11047 }
11048 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011049 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011050
Daniel Veillard42595322004-11-08 10:52:06 +000011051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011052}
11053
11054
11055static int
11056test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011058
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011059 int mem_base;
11060 int ret_val;
11061 xmlListPtr l; /* a list */
11062 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011063
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011064 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11065 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011066 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011067
11068 ret_val = xmlListSize(l);
11069 desret_int(ret_val);
11070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011071 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011072 xmlResetLastError();
11073 if (mem_base != xmlMemBlocks()) {
11074 printf("Leak of %d blocks found in xmlListSize",
11075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011076 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011077 printf(" %d", n_l);
11078 printf("\n");
11079 }
11080 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011081 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011082
Daniel Veillard42595322004-11-08 10:52:06 +000011083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011084}
11085
11086
11087static int
11088test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011090
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011091 int mem_base;
11092 xmlListPtr l; /* a list */
11093 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011094
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011095 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11096 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011097 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011098
11099 xmlListSort(l);
11100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011101 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011102 xmlResetLastError();
11103 if (mem_base != xmlMemBlocks()) {
11104 printf("Leak of %d blocks found in xmlListSort",
11105 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011106 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011107 printf(" %d", n_l);
11108 printf("\n");
11109 }
11110 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011111 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011112
Daniel Veillard42595322004-11-08 10:52:06 +000011113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011114}
11115
11116
11117static int
11118test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011120
11121
11122 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011124}
11125
11126static int
11127test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011130 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011131 test_ret += test_xmlLinkGetData();
11132 test_ret += test_xmlListAppend();
11133 test_ret += test_xmlListClear();
11134 test_ret += test_xmlListCopy();
11135 test_ret += test_xmlListCreate();
11136 test_ret += test_xmlListDup();
11137 test_ret += test_xmlListEmpty();
11138 test_ret += test_xmlListEnd();
11139 test_ret += test_xmlListFront();
11140 test_ret += test_xmlListInsert();
11141 test_ret += test_xmlListMerge();
11142 test_ret += test_xmlListPopBack();
11143 test_ret += test_xmlListPopFront();
11144 test_ret += test_xmlListPushBack();
11145 test_ret += test_xmlListPushFront();
11146 test_ret += test_xmlListRemoveAll();
11147 test_ret += test_xmlListRemoveFirst();
11148 test_ret += test_xmlListRemoveLast();
11149 test_ret += test_xmlListReverse();
11150 test_ret += test_xmlListReverseSearch();
11151 test_ret += test_xmlListReverseWalk();
11152 test_ret += test_xmlListSearch();
11153 test_ret += test_xmlListSize();
11154 test_ret += test_xmlListSort();
11155 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011156
Daniel Veillard42595322004-11-08 10:52:06 +000011157 if (test_ret != 0)
11158 printf("Module list: %d errors\n", test_ret);
11159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011160}
11161
11162static int
11163test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011165
William M. Brack21e4ef22005-01-02 09:53:13 +000011166#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011167 int mem_base;
11168 int ret_val;
11169 void * ctx; /* an FTP context */
11170 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011171
Daniel Veillard27f20102004-11-05 11:50:11 +000011172 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11173 mem_base = xmlMemBlocks();
11174 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11175
11176 ret_val = xmlNanoFTPCheckResponse(ctx);
11177 desret_int(ret_val);
11178 call_tests++;
11179 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11180 xmlResetLastError();
11181 if (mem_base != xmlMemBlocks()) {
11182 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011184 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011185 printf(" %d", n_ctx);
11186 printf("\n");
11187 }
11188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011189 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011190#endif
11191
Daniel Veillard42595322004-11-08 10:52:06 +000011192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011193}
11194
11195
11196static int
11197test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011199
William M. Brack21e4ef22005-01-02 09:53:13 +000011200#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011201 int mem_base;
11202
11203 mem_base = xmlMemBlocks();
11204
11205 xmlNanoFTPCleanup();
11206 call_tests++;
11207 xmlResetLastError();
11208 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011209 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011212 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011214 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011215#endif
11216
Daniel Veillard42595322004-11-08 10:52:06 +000011217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011218}
11219
11220
11221static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011222test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011224
William M. Brack21e4ef22005-01-02 09:53:13 +000011225#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011226 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011227 int ret_val;
11228 void * ctx; /* an FTP context */
11229 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011230
Daniel Veillard27f20102004-11-05 11:50:11 +000011231 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011232 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011233 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011234
Daniel Veillard27f20102004-11-05 11:50:11 +000011235 ret_val = xmlNanoFTPCloseConnection(ctx);
11236 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011237 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011238 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011239 xmlResetLastError();
11240 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011241 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011243 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011244 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011245 printf("\n");
11246 }
11247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011248 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011249#endif
11250
Daniel Veillard42595322004-11-08 10:52:06 +000011251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011252}
11253
11254
11255static int
11256test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011258
William M. Brack21e4ef22005-01-02 09:53:13 +000011259#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011260 int mem_base;
11261 int ret_val;
11262 void * ctx; /* an FTP context */
11263 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011264 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011265 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011266
Daniel Veillard27f20102004-11-05 11:50:11 +000011267 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11268 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11269 mem_base = xmlMemBlocks();
11270 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11271 directory = gen_const_char_ptr(n_directory, 1);
11272
William M. Brackf13f77f2004-11-12 16:03:48 +000011273 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011274 desret_int(ret_val);
11275 call_tests++;
11276 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011277 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011278 xmlResetLastError();
11279 if (mem_base != xmlMemBlocks()) {
11280 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011282 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011283 printf(" %d", n_ctx);
11284 printf(" %d", n_directory);
11285 printf("\n");
11286 }
11287 }
11288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011289 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011290#endif
11291
Daniel Veillard42595322004-11-08 10:52:06 +000011292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293}
11294
11295
11296static int
11297test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011299
William M. Brack21e4ef22005-01-02 09:53:13 +000011300#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011301 int mem_base;
11302 int ret_val;
11303 void * ctx; /* an FTP context */
11304 int n_ctx;
11305 const char * file; /* a file or directory on the server */
11306 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011307
Daniel Veillard27f20102004-11-05 11:50:11 +000011308 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11309 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11310 mem_base = xmlMemBlocks();
11311 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11312 file = gen_filepath(n_file, 1);
11313
11314 ret_val = xmlNanoFTPDele(ctx, file);
11315 desret_int(ret_val);
11316 call_tests++;
11317 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11318 des_filepath(n_file, file, 1);
11319 xmlResetLastError();
11320 if (mem_base != xmlMemBlocks()) {
11321 printf("Leak of %d blocks found in xmlNanoFTPDele",
11322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011323 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011324 printf(" %d", n_ctx);
11325 printf(" %d", n_file);
11326 printf("\n");
11327 }
11328 }
11329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011330 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011331#endif
11332
Daniel Veillard42595322004-11-08 10:52:06 +000011333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011334}
11335
11336
11337static int
11338test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011340
11341
11342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011344}
11345
11346
11347static int
11348test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011350
William M. Brack21e4ef22005-01-02 09:53:13 +000011351#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011352 int mem_base;
11353 int ret_val;
11354 void * ctx; /* an FTP context */
11355 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011356
Daniel Veillard27f20102004-11-05 11:50:11 +000011357 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11358 mem_base = xmlMemBlocks();
11359 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11360
11361 ret_val = xmlNanoFTPGetConnection(ctx);
11362 desret_int(ret_val);
11363 call_tests++;
11364 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11365 xmlResetLastError();
11366 if (mem_base != xmlMemBlocks()) {
11367 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011369 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011370 printf(" %d", n_ctx);
11371 printf("\n");
11372 }
11373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011374 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011375#endif
11376
Daniel Veillard42595322004-11-08 10:52:06 +000011377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011378}
11379
11380
11381static int
11382test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011384
William M. Brack21e4ef22005-01-02 09:53:13 +000011385#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011386 int mem_base;
11387 int ret_val;
11388 void * ctx; /* an FTP context */
11389 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011390
Daniel Veillard27f20102004-11-05 11:50:11 +000011391 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11392 mem_base = xmlMemBlocks();
11393 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11394
11395 ret_val = xmlNanoFTPGetResponse(ctx);
11396 desret_int(ret_val);
11397 call_tests++;
11398 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11399 xmlResetLastError();
11400 if (mem_base != xmlMemBlocks()) {
11401 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011403 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011404 printf(" %d", n_ctx);
11405 printf("\n");
11406 }
11407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011408 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011409#endif
11410
Daniel Veillard42595322004-11-08 10:52:06 +000011411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011412}
11413
11414
11415static int
11416test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011418
William M. Brack21e4ef22005-01-02 09:53:13 +000011419#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011420 int mem_base;
11421 int ret_val;
11422 void * ctx; /* an FTP context */
11423 int n_ctx;
11424 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11425 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011426
Daniel Veillard27f20102004-11-05 11:50:11 +000011427 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11428 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11429 mem_base = xmlMemBlocks();
11430 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11431 filename = gen_filepath(n_filename, 1);
11432
11433 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11434 desret_int(ret_val);
11435 call_tests++;
11436 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11437 des_filepath(n_filename, filename, 1);
11438 xmlResetLastError();
11439 if (mem_base != xmlMemBlocks()) {
11440 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011442 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011443 printf(" %d", n_ctx);
11444 printf(" %d", n_filename);
11445 printf("\n");
11446 }
11447 }
11448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011449 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011450#endif
11451
Daniel Veillard42595322004-11-08 10:52:06 +000011452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011453}
11454
11455
11456static int
11457test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011459
William M. Brack21e4ef22005-01-02 09:53:13 +000011460#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011461 int mem_base;
11462
11463 mem_base = xmlMemBlocks();
11464
11465 xmlNanoFTPInit();
11466 call_tests++;
11467 xmlResetLastError();
11468 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011469 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011471 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011472 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011474 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011475#endif
11476
Daniel Veillard42595322004-11-08 10:52:06 +000011477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011478}
11479
11480
11481static int
11482test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011484
11485
11486 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011488}
11489
11490
11491static int
11492test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011494
11495
11496 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011498}
11499
11500
11501static int
11502test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011504
William M. Brack21e4ef22005-01-02 09:53:13 +000011505#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011506 int mem_base;
11507 void * ret_val;
11508 const char * URL; /* the URL to the resource */
11509 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011510
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011511 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11512 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011513 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011514
11515 ret_val = xmlNanoFTPOpen(URL);
11516 desret_void_ptr(ret_val);
11517 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011518 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011519 xmlResetLastError();
11520 if (mem_base != xmlMemBlocks()) {
11521 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011523 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011524 printf(" %d", n_URL);
11525 printf("\n");
11526 }
11527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011528 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011529#endif
11530
Daniel Veillard42595322004-11-08 10:52:06 +000011531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011532}
11533
11534
11535static int
11536test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011538
William M. Brack21e4ef22005-01-02 09:53:13 +000011539#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011540 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011541 int n_host;
11542 int port; /* the proxy port */
11543 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011544 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011545 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011546 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011547 int n_passwd;
11548 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11549 int n_type;
11550
11551 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11552 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11553 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11554 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11555 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011556 host = gen_const_char_ptr(n_host, 0);
11557 port = gen_int(n_port, 1);
11558 user = gen_const_char_ptr(n_user, 2);
11559 passwd = gen_const_char_ptr(n_passwd, 3);
11560 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011561
William M. Brackf13f77f2004-11-12 16:03:48 +000011562 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011563 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011564 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011565 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011566 des_const_char_ptr(n_user, (const char *)user, 2);
11567 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011568 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011569 xmlResetLastError();
11570 }
11571 }
11572 }
11573 }
11574 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011575 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576#endif
11577
Daniel Veillard42595322004-11-08 10:52:06 +000011578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011579}
11580
11581
11582static int
11583test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011585
William M. Brack21e4ef22005-01-02 09:53:13 +000011586#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011587 int mem_base;
11588 int ret_val;
11589 void * ctx; /* an FTP context */
11590 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011591
Daniel Veillard27f20102004-11-05 11:50:11 +000011592 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11593 mem_base = xmlMemBlocks();
11594 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11595
11596 ret_val = xmlNanoFTPQuit(ctx);
11597 desret_int(ret_val);
11598 call_tests++;
11599 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11600 xmlResetLastError();
11601 if (mem_base != xmlMemBlocks()) {
11602 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011604 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011605 printf(" %d", n_ctx);
11606 printf("\n");
11607 }
11608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011609 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011610#endif
11611
Daniel Veillard42595322004-11-08 10:52:06 +000011612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011613}
11614
11615
11616static int
11617test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011619
William M. Brack21e4ef22005-01-02 09:53:13 +000011620#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011621 int mem_base;
11622 int ret_val;
11623 void * ctx; /* the FTP context */
11624 int n_ctx;
11625 void * dest; /* a buffer */
11626 int n_dest;
11627 int len; /* the buffer length */
11628 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011629
Daniel Veillard27f20102004-11-05 11:50:11 +000011630 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11631 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11632 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11633 mem_base = xmlMemBlocks();
11634 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11635 dest = gen_void_ptr(n_dest, 1);
11636 len = gen_int(n_len, 2);
11637
11638 ret_val = xmlNanoFTPRead(ctx, dest, len);
11639 desret_int(ret_val);
11640 call_tests++;
11641 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11642 des_void_ptr(n_dest, dest, 1);
11643 des_int(n_len, len, 2);
11644 xmlResetLastError();
11645 if (mem_base != xmlMemBlocks()) {
11646 printf("Leak of %d blocks found in xmlNanoFTPRead",
11647 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011648 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011649 printf(" %d", n_ctx);
11650 printf(" %d", n_dest);
11651 printf(" %d", n_len);
11652 printf("\n");
11653 }
11654 }
11655 }
11656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011657 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011658#endif
11659
Daniel Veillard42595322004-11-08 10:52:06 +000011660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011661}
11662
11663
11664static int
11665test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011667
William M. Brack21e4ef22005-01-02 09:53:13 +000011668#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011669 const char * URL; /* The proxy URL used to initialize the proxy context */
11670 int n_URL;
11671
11672 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011673 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011674
11675 xmlNanoFTPScanProxy(URL);
11676 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011677 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011678 xmlResetLastError();
11679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011680 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011681#endif
11682
Daniel Veillard42595322004-11-08 10:52:06 +000011683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011684}
11685
11686
11687static int
11688test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011690
William M. Brack21e4ef22005-01-02 09:53:13 +000011691#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011692 int mem_base;
11693 int ret_val;
11694 void * ctx; /* an FTP context */
11695 int n_ctx;
11696 const char * URL; /* The URL used to update the context */
11697 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011698
Daniel Veillard27f20102004-11-05 11:50:11 +000011699 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11700 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11701 mem_base = xmlMemBlocks();
11702 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11703 URL = gen_filepath(n_URL, 1);
11704
11705 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11706 desret_int(ret_val);
11707 call_tests++;
11708 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11709 des_filepath(n_URL, URL, 1);
11710 xmlResetLastError();
11711 if (mem_base != xmlMemBlocks()) {
11712 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011714 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011715 printf(" %d", n_ctx);
11716 printf(" %d", n_URL);
11717 printf("\n");
11718 }
11719 }
11720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011721 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011722#endif
11723
Daniel Veillard42595322004-11-08 10:52:06 +000011724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011725}
11726
11727static int
11728test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011730
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011731 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011732 test_ret += test_xmlNanoFTPCheckResponse();
11733 test_ret += test_xmlNanoFTPCleanup();
11734 test_ret += test_xmlNanoFTPCloseConnection();
11735 test_ret += test_xmlNanoFTPCwd();
11736 test_ret += test_xmlNanoFTPDele();
11737 test_ret += test_xmlNanoFTPGet();
11738 test_ret += test_xmlNanoFTPGetConnection();
11739 test_ret += test_xmlNanoFTPGetResponse();
11740 test_ret += test_xmlNanoFTPGetSocket();
11741 test_ret += test_xmlNanoFTPInit();
11742 test_ret += test_xmlNanoFTPList();
11743 test_ret += test_xmlNanoFTPNewCtxt();
11744 test_ret += test_xmlNanoFTPOpen();
11745 test_ret += test_xmlNanoFTPProxy();
11746 test_ret += test_xmlNanoFTPQuit();
11747 test_ret += test_xmlNanoFTPRead();
11748 test_ret += test_xmlNanoFTPScanProxy();
11749 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011750
Daniel Veillard42595322004-11-08 10:52:06 +000011751 if (test_ret != 0)
11752 printf("Module nanoftp: %d errors\n", test_ret);
11753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011754}
11755
11756static int
11757test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011759
William M. Brack21e4ef22005-01-02 09:53:13 +000011760#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011761 int mem_base;
11762 const char * ret_val;
11763 void * ctx; /* the HTTP context */
11764 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011765
Daniel Veillard27f20102004-11-05 11:50:11 +000011766 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11767 mem_base = xmlMemBlocks();
11768 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11769
11770 ret_val = xmlNanoHTTPAuthHeader(ctx);
11771 desret_const_char_ptr(ret_val);
11772 call_tests++;
11773 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11774 xmlResetLastError();
11775 if (mem_base != xmlMemBlocks()) {
11776 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011778 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011779 printf(" %d", n_ctx);
11780 printf("\n");
11781 }
11782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011783 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011784#endif
11785
Daniel Veillard42595322004-11-08 10:52:06 +000011786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011787}
11788
11789
11790static int
11791test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011793
William M. Brack21e4ef22005-01-02 09:53:13 +000011794#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011795 int mem_base;
11796
11797 mem_base = xmlMemBlocks();
11798
11799 xmlNanoHTTPCleanup();
11800 call_tests++;
11801 xmlResetLastError();
11802 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011803 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011805 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011806 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011808 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011809#endif
11810
Daniel Veillard42595322004-11-08 10:52:06 +000011811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011812}
11813
11814
11815static int
11816test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011818
William M. Brack21e4ef22005-01-02 09:53:13 +000011819#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011820 int mem_base;
11821 void * ctx; /* the HTTP context */
11822 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011823
Daniel Veillard27f20102004-11-05 11:50:11 +000011824 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11825 mem_base = xmlMemBlocks();
11826 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11827
11828 xmlNanoHTTPClose(ctx);
11829 call_tests++;
11830 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11831 xmlResetLastError();
11832 if (mem_base != xmlMemBlocks()) {
11833 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011835 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011836 printf(" %d", n_ctx);
11837 printf("\n");
11838 }
11839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011840 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011841#endif
11842
Daniel Veillard42595322004-11-08 10:52:06 +000011843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011844}
11845
11846
11847static int
11848test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011850
William M. Brack21e4ef22005-01-02 09:53:13 +000011851#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011852 int mem_base;
11853 int ret_val;
11854 void * ctx; /* the HTTP context */
11855 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011856
Daniel Veillard27f20102004-11-05 11:50:11 +000011857 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11858 mem_base = xmlMemBlocks();
11859 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11860
11861 ret_val = xmlNanoHTTPContentLength(ctx);
11862 desret_int(ret_val);
11863 call_tests++;
11864 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11865 xmlResetLastError();
11866 if (mem_base != xmlMemBlocks()) {
11867 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011869 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011870 printf(" %d", n_ctx);
11871 printf("\n");
11872 }
11873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011874 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011875#endif
11876
Daniel Veillard42595322004-11-08 10:52:06 +000011877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011878}
11879
11880
11881static int
11882test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011884
William M. Brack21e4ef22005-01-02 09:53:13 +000011885#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011886 int mem_base;
11887 const char * ret_val;
11888 void * ctx; /* the HTTP context */
11889 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011890
Daniel Veillard27f20102004-11-05 11:50:11 +000011891 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11892 mem_base = xmlMemBlocks();
11893 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11894
11895 ret_val = xmlNanoHTTPEncoding(ctx);
11896 desret_const_char_ptr(ret_val);
11897 call_tests++;
11898 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11899 xmlResetLastError();
11900 if (mem_base != xmlMemBlocks()) {
11901 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011903 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011904 printf(" %d", n_ctx);
11905 printf("\n");
11906 }
11907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011908 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011909#endif
11910
Daniel Veillard42595322004-11-08 10:52:06 +000011911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011912}
11913
11914
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011915#define gen_nb_char_ptr_ptr 1
11916static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11917 return(NULL);
11918}
11919static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11920}
11921
Daniel Veillardd93f6252004-11-02 15:53:51 +000011922static int
11923test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011925
William M. Brack21e4ef22005-01-02 09:53:13 +000011926#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011927 int mem_base;
11928 int ret_val;
11929 const char * URL; /* The URL to load */
11930 int n_URL;
11931 const char * filename; /* the filename where the content should be saved */
11932 int n_filename;
11933 char ** contentType; /* if available the Content-Type information will be returned at that location */
11934 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011936 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11937 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11938 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11939 mem_base = xmlMemBlocks();
11940 URL = gen_filepath(n_URL, 0);
11941 filename = gen_filepath(n_filename, 1);
11942 contentType = gen_char_ptr_ptr(n_contentType, 2);
11943
11944 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11945 desret_int(ret_val);
11946 call_tests++;
11947 des_filepath(n_URL, URL, 0);
11948 des_filepath(n_filename, filename, 1);
11949 des_char_ptr_ptr(n_contentType, contentType, 2);
11950 xmlResetLastError();
11951 if (mem_base != xmlMemBlocks()) {
11952 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011954 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011955 printf(" %d", n_URL);
11956 printf(" %d", n_filename);
11957 printf(" %d", n_contentType);
11958 printf("\n");
11959 }
11960 }
11961 }
11962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011963 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011964#endif
11965
Daniel Veillard42595322004-11-08 10:52:06 +000011966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011967}
11968
11969
11970static int
11971test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011973
William M. Brack21e4ef22005-01-02 09:53:13 +000011974#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011975 int mem_base;
11976
11977 mem_base = xmlMemBlocks();
11978
11979 xmlNanoHTTPInit();
11980 call_tests++;
11981 xmlResetLastError();
11982 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011983 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011985 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011986 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011988 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011989#endif
11990
Daniel Veillard42595322004-11-08 10:52:06 +000011991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011992}
11993
11994
11995static int
11996test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011998
William M. Brack21e4ef22005-01-02 09:53:13 +000011999#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012000 int mem_base;
12001 void * ret_val;
12002 const char * URL; /* The URL to load */
12003 int n_URL;
12004 char * method; /* the HTTP method to use */
12005 int n_method;
12006 char * input; /* the input string if any */
12007 int n_input;
12008 char ** contentType; /* the Content-Type information IN and OUT */
12009 int n_contentType;
12010 char * headers; /* the extra headers */
12011 int n_headers;
12012 int ilen; /* input length */
12013 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012014
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012015 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12016 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12017 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12018 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12019 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12020 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12021 mem_base = xmlMemBlocks();
12022 URL = gen_filepath(n_URL, 0);
12023 method = gen_const_char_ptr(n_method, 1);
12024 input = gen_const_char_ptr(n_input, 2);
12025 contentType = gen_char_ptr_ptr(n_contentType, 3);
12026 headers = gen_const_char_ptr(n_headers, 4);
12027 ilen = gen_int(n_ilen, 5);
12028
William M. Brackf13f77f2004-11-12 16:03:48 +000012029 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012030 desret_void_ptr(ret_val);
12031 call_tests++;
12032 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012033 des_const_char_ptr(n_method, (const char *)method, 1);
12034 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012035 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012036 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012037 des_int(n_ilen, ilen, 5);
12038 xmlResetLastError();
12039 if (mem_base != xmlMemBlocks()) {
12040 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012042 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012043 printf(" %d", n_URL);
12044 printf(" %d", n_method);
12045 printf(" %d", n_input);
12046 printf(" %d", n_contentType);
12047 printf(" %d", n_headers);
12048 printf(" %d", n_ilen);
12049 printf("\n");
12050 }
12051 }
12052 }
12053 }
12054 }
12055 }
12056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012057 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012058#endif
12059
Daniel Veillard42595322004-11-08 10:52:06 +000012060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012061}
12062
12063
12064static int
12065test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012067
William M. Brack21e4ef22005-01-02 09:53:13 +000012068#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012069 int mem_base;
12070 void * ret_val;
12071 const char * URL; /* The URL to load */
12072 int n_URL;
12073 char * method; /* the HTTP method to use */
12074 int n_method;
12075 char * input; /* the input string if any */
12076 int n_input;
12077 char ** contentType; /* the Content-Type information IN and OUT */
12078 int n_contentType;
12079 char ** redir; /* the redirected URL OUT */
12080 int n_redir;
12081 char * headers; /* the extra headers */
12082 int n_headers;
12083 int ilen; /* input length */
12084 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012085
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012086 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12087 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12088 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12089 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12090 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12091 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12092 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12093 mem_base = xmlMemBlocks();
12094 URL = gen_filepath(n_URL, 0);
12095 method = gen_const_char_ptr(n_method, 1);
12096 input = gen_const_char_ptr(n_input, 2);
12097 contentType = gen_char_ptr_ptr(n_contentType, 3);
12098 redir = gen_char_ptr_ptr(n_redir, 4);
12099 headers = gen_const_char_ptr(n_headers, 5);
12100 ilen = gen_int(n_ilen, 6);
12101
William M. Brackf13f77f2004-11-12 16:03:48 +000012102 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012103 desret_void_ptr(ret_val);
12104 call_tests++;
12105 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012106 des_const_char_ptr(n_method, (const char *)method, 1);
12107 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012108 des_char_ptr_ptr(n_contentType, contentType, 3);
12109 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012110 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012111 des_int(n_ilen, ilen, 6);
12112 xmlResetLastError();
12113 if (mem_base != xmlMemBlocks()) {
12114 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012116 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012117 printf(" %d", n_URL);
12118 printf(" %d", n_method);
12119 printf(" %d", n_input);
12120 printf(" %d", n_contentType);
12121 printf(" %d", n_redir);
12122 printf(" %d", n_headers);
12123 printf(" %d", n_ilen);
12124 printf("\n");
12125 }
12126 }
12127 }
12128 }
12129 }
12130 }
12131 }
12132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012133 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012134#endif
12135
Daniel Veillard42595322004-11-08 10:52:06 +000012136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012137}
12138
12139
12140static int
12141test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012143
William M. Brack21e4ef22005-01-02 09:53:13 +000012144#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012145 int mem_base;
12146 const char * ret_val;
12147 void * ctx; /* the HTTP context */
12148 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012149
Daniel Veillard27f20102004-11-05 11:50:11 +000012150 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12151 mem_base = xmlMemBlocks();
12152 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12153
12154 ret_val = xmlNanoHTTPMimeType(ctx);
12155 desret_const_char_ptr(ret_val);
12156 call_tests++;
12157 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12158 xmlResetLastError();
12159 if (mem_base != xmlMemBlocks()) {
12160 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012162 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012163 printf(" %d", n_ctx);
12164 printf("\n");
12165 }
12166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012167 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012168#endif
12169
Daniel Veillard42595322004-11-08 10:52:06 +000012170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012171}
12172
12173
12174static int
12175test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012177
William M. Brack21e4ef22005-01-02 09:53:13 +000012178#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012179 int mem_base;
12180 void * ret_val;
12181 const char * URL; /* The URL to load */
12182 int n_URL;
12183 char ** contentType; /* if available the Content-Type information will be returned at that location */
12184 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012185
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012186 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12187 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12188 mem_base = xmlMemBlocks();
12189 URL = gen_filepath(n_URL, 0);
12190 contentType = gen_char_ptr_ptr(n_contentType, 1);
12191
12192 ret_val = xmlNanoHTTPOpen(URL, contentType);
12193 desret_void_ptr(ret_val);
12194 call_tests++;
12195 des_filepath(n_URL, URL, 0);
12196 des_char_ptr_ptr(n_contentType, contentType, 1);
12197 xmlResetLastError();
12198 if (mem_base != xmlMemBlocks()) {
12199 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012201 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012202 printf(" %d", n_URL);
12203 printf(" %d", n_contentType);
12204 printf("\n");
12205 }
12206 }
12207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012208 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012209#endif
12210
Daniel Veillard42595322004-11-08 10:52:06 +000012211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012212}
12213
12214
12215static int
12216test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012218
William M. Brack21e4ef22005-01-02 09:53:13 +000012219#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012220 int mem_base;
12221 void * ret_val;
12222 const char * URL; /* The URL to load */
12223 int n_URL;
12224 char ** contentType; /* if available the Content-Type information will be returned at that location */
12225 int n_contentType;
12226 char ** redir; /* if available the redirected URL will be returned */
12227 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012228
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012229 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12230 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12231 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12232 mem_base = xmlMemBlocks();
12233 URL = gen_filepath(n_URL, 0);
12234 contentType = gen_char_ptr_ptr(n_contentType, 1);
12235 redir = gen_char_ptr_ptr(n_redir, 2);
12236
12237 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12238 desret_void_ptr(ret_val);
12239 call_tests++;
12240 des_filepath(n_URL, URL, 0);
12241 des_char_ptr_ptr(n_contentType, contentType, 1);
12242 des_char_ptr_ptr(n_redir, redir, 2);
12243 xmlResetLastError();
12244 if (mem_base != xmlMemBlocks()) {
12245 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012247 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012248 printf(" %d", n_URL);
12249 printf(" %d", n_contentType);
12250 printf(" %d", n_redir);
12251 printf("\n");
12252 }
12253 }
12254 }
12255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012256 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012257#endif
12258
Daniel Veillard42595322004-11-08 10:52:06 +000012259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012260}
12261
12262
12263static int
12264test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012266
William M. Brack21e4ef22005-01-02 09:53:13 +000012267#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012268 int mem_base;
12269 int ret_val;
12270 void * ctx; /* the HTTP context */
12271 int n_ctx;
12272 void * dest; /* a buffer */
12273 int n_dest;
12274 int len; /* the buffer length */
12275 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012276
Daniel Veillard27f20102004-11-05 11:50:11 +000012277 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12278 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12279 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12280 mem_base = xmlMemBlocks();
12281 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12282 dest = gen_void_ptr(n_dest, 1);
12283 len = gen_int(n_len, 2);
12284
12285 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12286 desret_int(ret_val);
12287 call_tests++;
12288 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12289 des_void_ptr(n_dest, dest, 1);
12290 des_int(n_len, len, 2);
12291 xmlResetLastError();
12292 if (mem_base != xmlMemBlocks()) {
12293 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012295 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012296 printf(" %d", n_ctx);
12297 printf(" %d", n_dest);
12298 printf(" %d", n_len);
12299 printf("\n");
12300 }
12301 }
12302 }
12303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012304 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012305#endif
12306
Daniel Veillard42595322004-11-08 10:52:06 +000012307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012308}
12309
12310
12311static int
12312test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012314
12315
12316 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012318}
12319
12320
12321static int
12322test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
William M. Brack21e4ef22005-01-02 09:53:13 +000012325#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012326 int mem_base;
12327 int ret_val;
12328 void * ctx; /* the HTTP context */
12329 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012330
Daniel Veillard27f20102004-11-05 11:50:11 +000012331 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12332 mem_base = xmlMemBlocks();
12333 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12334
12335 ret_val = xmlNanoHTTPReturnCode(ctx);
12336 desret_int(ret_val);
12337 call_tests++;
12338 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12339 xmlResetLastError();
12340 if (mem_base != xmlMemBlocks()) {
12341 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012343 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012344 printf(" %d", n_ctx);
12345 printf("\n");
12346 }
12347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012348 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012349#endif
12350
Daniel Veillard42595322004-11-08 10:52:06 +000012351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012352}
12353
12354
12355static int
12356test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012358
William M. Brack21e4ef22005-01-02 09:53:13 +000012359#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012360 int mem_base;
12361 int ret_val;
12362 void * ctxt; /* the HTTP context */
12363 int n_ctxt;
12364 const char * filename; /* the filename where the content should be saved */
12365 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012366
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012367 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12368 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012370 ctxt = gen_void_ptr(n_ctxt, 0);
12371 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012372
12373 ret_val = xmlNanoHTTPSave(ctxt, filename);
12374 desret_int(ret_val);
12375 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012376 des_void_ptr(n_ctxt, ctxt, 0);
12377 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012378 xmlResetLastError();
12379 if (mem_base != xmlMemBlocks()) {
12380 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012382 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012383 printf(" %d", n_ctxt);
12384 printf(" %d", n_filename);
12385 printf("\n");
12386 }
12387 }
12388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012389 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012390#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012391
Daniel Veillard42595322004-11-08 10:52:06 +000012392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012393}
12394
12395
12396static int
12397test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012399
William M. Brack21e4ef22005-01-02 09:53:13 +000012400#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012401 const char * URL; /* The proxy URL used to initialize the proxy context */
12402 int n_URL;
12403
12404 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012405 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012406
12407 xmlNanoHTTPScanProxy(URL);
12408 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012409 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012410 xmlResetLastError();
12411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012412 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012413#endif
12414
Daniel Veillard42595322004-11-08 10:52:06 +000012415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012416}
12417
12418static int
12419test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012421
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012422 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012423 test_ret += test_xmlNanoHTTPAuthHeader();
12424 test_ret += test_xmlNanoHTTPCleanup();
12425 test_ret += test_xmlNanoHTTPClose();
12426 test_ret += test_xmlNanoHTTPContentLength();
12427 test_ret += test_xmlNanoHTTPEncoding();
12428 test_ret += test_xmlNanoHTTPFetch();
12429 test_ret += test_xmlNanoHTTPInit();
12430 test_ret += test_xmlNanoHTTPMethod();
12431 test_ret += test_xmlNanoHTTPMethodRedir();
12432 test_ret += test_xmlNanoHTTPMimeType();
12433 test_ret += test_xmlNanoHTTPOpen();
12434 test_ret += test_xmlNanoHTTPOpenRedir();
12435 test_ret += test_xmlNanoHTTPRead();
12436 test_ret += test_xmlNanoHTTPRedir();
12437 test_ret += test_xmlNanoHTTPReturnCode();
12438 test_ret += test_xmlNanoHTTPSave();
12439 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012440
Daniel Veillard42595322004-11-08 10:52:06 +000012441 if (test_ret != 0)
12442 printf("Module nanohttp: %d errors\n", test_ret);
12443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012444}
12445
12446static int
12447test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012449
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012450 int mem_base;
12451 long ret_val;
12452 xmlParserCtxtPtr ctxt; /* an XML parser context */
12453 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012454
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012455 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12456 mem_base = xmlMemBlocks();
12457 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12458
12459 ret_val = xmlByteConsumed(ctxt);
12460 desret_long(ret_val);
12461 call_tests++;
12462 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12463 xmlResetLastError();
12464 if (mem_base != xmlMemBlocks()) {
12465 printf("Leak of %d blocks found in xmlByteConsumed",
12466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012467 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012468 printf(" %d", n_ctxt);
12469 printf("\n");
12470 }
12471 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012472 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012473
Daniel Veillard42595322004-11-08 10:52:06 +000012474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012475}
12476
12477
12478static int
12479test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012481
Daniel Veillardce682bc2004-11-05 17:22:25 +000012482 int mem_base;
12483 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12484 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012485
Daniel Veillardce682bc2004-11-05 17:22:25 +000012486 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12487 mem_base = xmlMemBlocks();
12488 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12489
12490 xmlClearNodeInfoSeq(seq);
12491 call_tests++;
12492 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12493 xmlResetLastError();
12494 if (mem_base != xmlMemBlocks()) {
12495 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012497 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012498 printf(" %d", n_seq);
12499 printf("\n");
12500 }
12501 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012502 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012503
Daniel Veillard42595322004-11-08 10:52:06 +000012504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012505}
12506
12507
12508static int
12509test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012511
12512 int mem_base;
12513 xmlParserCtxtPtr ctxt; /* an XML parser context */
12514 int n_ctxt;
12515
12516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12517 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012518 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012519
12520 xmlClearParserCtxt(ctxt);
12521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012522 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012523 xmlResetLastError();
12524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012525 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012528 printf(" %d", n_ctxt);
12529 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012530 }
12531 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012532 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012533
Daniel Veillard42595322004-11-08 10:52:06 +000012534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012535}
12536
12537
12538static int
12539test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012541
Daniel Veillard34099b42004-11-04 17:34:35 +000012542 int mem_base;
12543 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012544 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012545 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012546
Daniel Veillard34099b42004-11-04 17:34:35 +000012547 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12548 mem_base = xmlMemBlocks();
12549 cur = gen_const_xmlChar_ptr(n_cur, 0);
12550
William M. Brackf13f77f2004-11-12 16:03:48 +000012551 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012552 desret_xmlParserCtxtPtr(ret_val);
12553 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012554 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012555 xmlResetLastError();
12556 if (mem_base != xmlMemBlocks()) {
12557 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012559 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012560 printf(" %d", n_cur);
12561 printf("\n");
12562 }
12563 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012564 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012565
Daniel Veillard42595322004-11-08 10:52:06 +000012566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012567}
12568
12569
12570static int
12571test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012573
William M. Brack21e4ef22005-01-02 09:53:13 +000012574#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012575 int mem_base;
12576 xmlParserCtxtPtr ret_val;
12577 xmlSAXHandlerPtr sax; /* a SAX handler */
12578 int n_sax;
12579 void * user_data; /* The user data returned on SAX callbacks */
12580 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012581 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012582 int n_chunk;
12583 int size; /* number of chars in the array */
12584 int n_size;
12585 const char * filename; /* an optional file name or URI */
12586 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012587
Daniel Veillard34099b42004-11-04 17:34:35 +000012588 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12589 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12590 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12591 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012592 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012593 mem_base = xmlMemBlocks();
12594 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12595 user_data = gen_userdata(n_user_data, 1);
12596 chunk = gen_const_char_ptr(n_chunk, 2);
12597 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012598 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012599
William M. Brackf13f77f2004-11-12 16:03:48 +000012600 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012601 desret_xmlParserCtxtPtr(ret_val);
12602 call_tests++;
12603 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12604 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012605 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012606 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012607 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012608 xmlResetLastError();
12609 if (mem_base != xmlMemBlocks()) {
12610 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012612 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012613 printf(" %d", n_sax);
12614 printf(" %d", n_user_data);
12615 printf(" %d", n_chunk);
12616 printf(" %d", n_size);
12617 printf(" %d", n_filename);
12618 printf("\n");
12619 }
12620 }
12621 }
12622 }
12623 }
12624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012625 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012626#endif
12627
Daniel Veillard42595322004-11-08 10:52:06 +000012628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012629}
12630
12631
12632static int
12633test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012635
12636 int mem_base;
12637 xmlDocPtr ret_val;
12638 xmlParserCtxtPtr ctxt; /* an XML parser context */
12639 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012640 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012641 int n_cur;
12642 const char * URL; /* the base URL to use for the document */
12643 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012644 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012645 int n_encoding;
12646 int options; /* a combination of xmlParserOption */
12647 int n_options;
12648
12649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12650 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12651 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12652 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012653 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012654 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012655 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12656 cur = gen_const_xmlChar_ptr(n_cur, 1);
12657 URL = gen_filepath(n_URL, 2);
12658 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012659 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012660
William M. Brackf13f77f2004-11-12 16:03:48 +000012661 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012662 desret_xmlDocPtr(ret_val);
12663 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012664 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012665 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012666 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012667 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012668 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669 xmlResetLastError();
12670 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012671 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012673 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012674 printf(" %d", n_ctxt);
12675 printf(" %d", n_cur);
12676 printf(" %d", n_URL);
12677 printf(" %d", n_encoding);
12678 printf(" %d", n_options);
12679 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012680 }
12681 }
12682 }
12683 }
12684 }
12685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012687
Daniel Veillard42595322004-11-08 10:52:06 +000012688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012689}
12690
12691
12692static int
12693test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012695
12696 int mem_base;
12697 xmlDocPtr ret_val;
12698 xmlParserCtxtPtr ctxt; /* an XML parser context */
12699 int n_ctxt;
12700 const char * filename; /* a file or URL */
12701 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012702 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012703 int n_encoding;
12704 int options; /* a combination of xmlParserOption */
12705 int n_options;
12706
12707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12708 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12709 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012710 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012712 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12713 filename = gen_filepath(n_filename, 1);
12714 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012715 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012716
William M. Brackf13f77f2004-11-12 16:03:48 +000012717 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012718 desret_xmlDocPtr(ret_val);
12719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012720 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12721 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012722 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012723 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012724 xmlResetLastError();
12725 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012726 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012728 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012729 printf(" %d", n_ctxt);
12730 printf(" %d", n_filename);
12731 printf(" %d", n_encoding);
12732 printf(" %d", n_options);
12733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012734 }
12735 }
12736 }
12737 }
12738 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012739 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012740
Daniel Veillard42595322004-11-08 10:52:06 +000012741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012742}
12743
12744
12745static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012746test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012748
12749 int mem_base;
12750 xmlDocPtr ret_val;
12751 xmlParserCtxtPtr ctxt; /* an XML parser context */
12752 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012753 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012754 int n_buffer;
12755 int size; /* the size of the array */
12756 int n_size;
12757 const char * URL; /* the base URL to use for the document */
12758 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012759 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760 int n_encoding;
12761 int options; /* a combination of xmlParserOption */
12762 int n_options;
12763
12764 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12765 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12766 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12767 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12768 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012769 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012770 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012771 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12772 buffer = gen_const_char_ptr(n_buffer, 1);
12773 size = gen_int(n_size, 2);
12774 URL = gen_filepath(n_URL, 3);
12775 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012776 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012777
William M. Brackf13f77f2004-11-12 16:03:48 +000012778 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012779 desret_xmlDocPtr(ret_val);
12780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012781 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012782 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012783 des_int(n_size, size, 2);
12784 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012785 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012786 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012787 xmlResetLastError();
12788 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012789 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012791 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012792 printf(" %d", n_ctxt);
12793 printf(" %d", n_buffer);
12794 printf(" %d", n_size);
12795 printf(" %d", n_URL);
12796 printf(" %d", n_encoding);
12797 printf(" %d", n_options);
12798 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012799 }
12800 }
12801 }
12802 }
12803 }
12804 }
12805 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012806 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012807
Daniel Veillard42595322004-11-08 10:52:06 +000012808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012809}
12810
12811
12812static int
12813test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012815
12816 int mem_base;
12817 xmlParserCtxtPtr ctxt; /* an XML parser context */
12818 int n_ctxt;
12819
12820 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12821 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012822 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012823
12824 xmlCtxtReset(ctxt);
12825 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012826 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012827 xmlResetLastError();
12828 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012829 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012831 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012832 printf(" %d", n_ctxt);
12833 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012834 }
12835 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012836 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012837
Daniel Veillard42595322004-11-08 10:52:06 +000012838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012839}
12840
12841
12842static int
12843test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012845
12846 int mem_base;
12847 int ret_val;
12848 xmlParserCtxtPtr ctxt; /* an XML parser context */
12849 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012850 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012851 int n_chunk;
12852 int size; /* number of chars in the array */
12853 int n_size;
12854 const char * filename; /* an optional file name or URI */
12855 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012856 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012857 int n_encoding;
12858
12859 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12860 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12861 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12862 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12863 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012865 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12866 chunk = gen_const_char_ptr(n_chunk, 1);
12867 size = gen_int(n_size, 2);
12868 filename = gen_filepath(n_filename, 3);
12869 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012870
William M. Brackf13f77f2004-11-12 16:03:48 +000012871 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012872 desret_int(ret_val);
12873 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012874 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012875 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012876 des_int(n_size, size, 2);
12877 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012878 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012879 xmlResetLastError();
12880 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012881 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012883 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012884 printf(" %d", n_ctxt);
12885 printf(" %d", n_chunk);
12886 printf(" %d", n_size);
12887 printf(" %d", n_filename);
12888 printf(" %d", n_encoding);
12889 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012890 }
12891 }
12892 }
12893 }
12894 }
12895 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012897
Daniel Veillard42595322004-11-08 10:52:06 +000012898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012899}
12900
12901
12902static int
12903test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012905
12906 int mem_base;
12907 int ret_val;
12908 xmlParserCtxtPtr ctxt; /* an XML parser context */
12909 int n_ctxt;
12910 int options; /* a combination of xmlParserOption */
12911 int n_options;
12912
12913 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012914 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012916 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012917 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012918
12919 ret_val = xmlCtxtUseOptions(ctxt, options);
12920 desret_int(ret_val);
12921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012922 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012923 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012924 xmlResetLastError();
12925 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012926 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012928 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012929 printf(" %d", n_ctxt);
12930 printf(" %d", n_options);
12931 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012932 }
12933 }
12934 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012935 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012936
Daniel Veillard42595322004-11-08 10:52:06 +000012937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012938}
12939
12940
12941static int
12942test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012944
12945
12946 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012948}
12949
12950
12951static int
12952test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012954
William M. Brack21e4ef22005-01-02 09:53:13 +000012955#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012956#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012957 int mem_base;
12958 int ret_val;
12959 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12960 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012961 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012962 int n_name;
12963 void * result; /* location to store the result */
12964 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012965
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012966 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12967 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12968 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12969 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012970 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12971 name = gen_const_char_ptr(n_name, 1);
12972 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012973
William M. Brackf13f77f2004-11-12 16:03:48 +000012974 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012975 desret_int(ret_val);
12976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012977 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012978 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012979 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012980 xmlResetLastError();
12981 if (mem_base != xmlMemBlocks()) {
12982 printf("Leak of %d blocks found in xmlGetFeature",
12983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012984 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012985 printf(" %d", n_ctxt);
12986 printf(" %d", n_name);
12987 printf(" %d", n_result);
12988 printf("\n");
12989 }
12990 }
12991 }
12992 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012993 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012994#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012995#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012996
Daniel Veillard42595322004-11-08 10:52:06 +000012997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012998}
12999
13000
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013001#define gen_nb_const_char_ptr_ptr 1
13002static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13003 return(NULL);
13004}
13005static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13006}
13007
Daniel Veillardd93f6252004-11-02 15:53:51 +000013008static int
13009test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013011
William M. Brack21e4ef22005-01-02 09:53:13 +000013012#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013013#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013014 int mem_base;
13015 int ret_val;
13016 int * len; /* the length of the features name array (input/output) */
13017 int n_len;
13018 char ** result; /* an array of string to be filled with the features name. */
13019 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013020
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013021 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13022 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13023 mem_base = xmlMemBlocks();
13024 len = gen_int_ptr(n_len, 0);
13025 result = gen_const_char_ptr_ptr(n_result, 1);
13026
William M. Brackf13f77f2004-11-12 16:03:48 +000013027 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013028 desret_int(ret_val);
13029 call_tests++;
13030 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013031 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013032 xmlResetLastError();
13033 if (mem_base != xmlMemBlocks()) {
13034 printf("Leak of %d blocks found in xmlGetFeaturesList",
13035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013036 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013037 printf(" %d", n_len);
13038 printf(" %d", n_result);
13039 printf("\n");
13040 }
13041 }
13042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013043 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013044#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013045#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013046
Daniel Veillard42595322004-11-08 10:52:06 +000013047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013048}
13049
13050
13051static int
13052test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013054
William M. Brack21e4ef22005-01-02 09:53:13 +000013055#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013056#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013057 int mem_base;
13058 xmlDtdPtr ret_val;
13059 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13060 int n_sax;
13061 xmlParserInputBufferPtr input; /* an Input Buffer */
13062 int n_input;
13063 xmlCharEncoding enc; /* the charset encoding if known */
13064 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013065
Daniel Veillard34099b42004-11-04 17:34:35 +000013066 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13067 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13068 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13069 mem_base = xmlMemBlocks();
13070 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13071 input = gen_xmlParserInputBufferPtr(n_input, 1);
13072 enc = gen_xmlCharEncoding(n_enc, 2);
13073
13074 ret_val = xmlIOParseDTD(sax, input, enc);
13075 input = NULL;
13076 desret_xmlDtdPtr(ret_val);
13077 call_tests++;
13078 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13079 des_xmlParserInputBufferPtr(n_input, input, 1);
13080 des_xmlCharEncoding(n_enc, enc, 2);
13081 xmlResetLastError();
13082 if (mem_base != xmlMemBlocks()) {
13083 printf("Leak of %d blocks found in xmlIOParseDTD",
13084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013085 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013086 printf(" %d", n_sax);
13087 printf(" %d", n_input);
13088 printf(" %d", n_enc);
13089 printf("\n");
13090 }
13091 }
13092 }
13093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013094 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013095#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013096#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013097
Daniel Veillard42595322004-11-08 10:52:06 +000013098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013099}
13100
13101
13102static int
13103test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013105
Daniel Veillardce682bc2004-11-05 17:22:25 +000013106 int mem_base;
13107 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13108 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013109
Daniel Veillardce682bc2004-11-05 17:22:25 +000013110 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13111 mem_base = xmlMemBlocks();
13112 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13113
13114 xmlInitNodeInfoSeq(seq);
13115 call_tests++;
13116 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13117 xmlResetLastError();
13118 if (mem_base != xmlMemBlocks()) {
13119 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013121 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013122 printf(" %d", n_seq);
13123 printf("\n");
13124 }
13125 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013126 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013127
Daniel Veillard42595322004-11-08 10:52:06 +000013128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013129}
13130
13131
13132static int
13133test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013135
13136 int mem_base;
13137
13138 mem_base = xmlMemBlocks();
13139
13140 xmlInitParser();
13141 call_tests++;
13142 xmlResetLastError();
13143 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013144 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013146 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013147 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013148 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013149 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013150
Daniel Veillard42595322004-11-08 10:52:06 +000013151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013152}
13153
13154
13155static int
13156test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158
13159 int mem_base;
13160 int ret_val;
13161 xmlParserCtxtPtr ctxt; /* an XML parser context */
13162 int n_ctxt;
13163
13164 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013166 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013167
13168 ret_val = xmlInitParserCtxt(ctxt);
13169 desret_int(ret_val);
13170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013171 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013172 xmlResetLastError();
13173 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013174 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013177 printf(" %d", n_ctxt);
13178 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013179 }
13180 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013182
Daniel Veillard42595322004-11-08 10:52:06 +000013183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013184}
13185
13186
13187static int
13188test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013190
13191 int mem_base;
13192 int ret_val;
13193 int val; /* int 0 or 1 */
13194 int n_val;
13195
13196 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013198 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013199
13200 ret_val = xmlKeepBlanksDefault(val);
13201 desret_int(ret_val);
13202 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013203 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013204 xmlResetLastError();
13205 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013206 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013208 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013209 printf(" %d", n_val);
13210 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013211 }
13212 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013214
Daniel Veillard42595322004-11-08 10:52:06 +000013215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013216}
13217
13218
13219static int
13220test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013222
13223 int mem_base;
13224 int ret_val;
13225 int val; /* int 0 or 1 */
13226 int n_val;
13227
13228 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13229 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013230 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013231
13232 ret_val = xmlLineNumbersDefault(val);
13233 desret_int(ret_val);
13234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013235 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013236 xmlResetLastError();
13237 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013238 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013240 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013241 printf(" %d", n_val);
13242 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013243 }
13244 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013245 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013246
Daniel Veillard42595322004-11-08 10:52:06 +000013247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013248}
13249
13250
13251static int
13252test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013254
Daniel Veillard42595322004-11-08 10:52:06 +000013255 int mem_base;
13256 xmlParserInputPtr ret_val;
13257 const char * URL; /* the URL for the entity to load */
13258 int n_URL;
13259 char * ID; /* the Public ID for the entity to load */
13260 int n_ID;
13261 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13262 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013263
Daniel Veillard42595322004-11-08 10:52:06 +000013264 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13265 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13266 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13267 mem_base = xmlMemBlocks();
13268 URL = gen_filepath(n_URL, 0);
13269 ID = gen_const_char_ptr(n_ID, 1);
13270 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13271
William M. Brackf13f77f2004-11-12 16:03:48 +000013272 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013273 desret_xmlParserInputPtr(ret_val);
13274 call_tests++;
13275 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013276 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013277 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13278 xmlResetLastError();
13279 if (mem_base != xmlMemBlocks()) {
13280 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13281 xmlMemBlocks() - mem_base);
13282 test_ret++;
13283 printf(" %d", n_URL);
13284 printf(" %d", n_ID);
13285 printf(" %d", n_ctxt);
13286 printf("\n");
13287 }
13288 }
13289 }
13290 }
Daniel Veillard42595322004-11-08 10:52:06 +000013291 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013292
Daniel Veillard42595322004-11-08 10:52:06 +000013293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013294}
13295
13296
13297static int
13298test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013300
Daniel Veillard42595322004-11-08 10:52:06 +000013301 int mem_base;
13302 xmlParserInputPtr ret_val;
13303 xmlParserCtxtPtr ctxt; /* an XML parser context */
13304 int n_ctxt;
13305 xmlParserInputBufferPtr input; /* an I/O Input */
13306 int n_input;
13307 xmlCharEncoding enc; /* the charset encoding if known */
13308 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013309
Daniel Veillard42595322004-11-08 10:52:06 +000013310 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13311 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13312 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13313 mem_base = xmlMemBlocks();
13314 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13315 input = gen_xmlParserInputBufferPtr(n_input, 1);
13316 enc = gen_xmlCharEncoding(n_enc, 2);
13317
13318 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13319 if (ret_val != NULL) input = NULL;
13320 desret_xmlParserInputPtr(ret_val);
13321 call_tests++;
13322 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13323 des_xmlParserInputBufferPtr(n_input, input, 1);
13324 des_xmlCharEncoding(n_enc, enc, 2);
13325 xmlResetLastError();
13326 if (mem_base != xmlMemBlocks()) {
13327 printf("Leak of %d blocks found in xmlNewIOInputStream",
13328 xmlMemBlocks() - mem_base);
13329 test_ret++;
13330 printf(" %d", n_ctxt);
13331 printf(" %d", n_input);
13332 printf(" %d", n_enc);
13333 printf("\n");
13334 }
13335 }
13336 }
13337 }
Daniel Veillard42595322004-11-08 10:52:06 +000013338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013339
Daniel Veillard42595322004-11-08 10:52:06 +000013340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013341}
13342
13343
13344static int
13345test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013347
Daniel Veillard34099b42004-11-04 17:34:35 +000013348 int mem_base;
13349 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013350
Daniel Veillard34099b42004-11-04 17:34:35 +000013351 mem_base = xmlMemBlocks();
13352
13353 ret_val = xmlNewParserCtxt();
13354 desret_xmlParserCtxtPtr(ret_val);
13355 call_tests++;
13356 xmlResetLastError();
13357 if (mem_base != xmlMemBlocks()) {
13358 printf("Leak of %d blocks found in xmlNewParserCtxt",
13359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013360 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013361 printf("\n");
13362 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013363 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013364
Daniel Veillard42595322004-11-08 10:52:06 +000013365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013366}
13367
13368
Daniel Veillardce682bc2004-11-05 17:22:25 +000013369#define gen_nb_xmlNodePtr_ptr 1
13370static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13371 return(NULL);
13372}
13373static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13374}
13375
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376static int
13377test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013379
William M. Brack21e4ef22005-01-02 09:53:13 +000013380#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013381#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013382 int mem_base;
13383 int ret_val;
13384 xmlDocPtr doc; /* the document the chunk pertains to */
13385 int n_doc;
13386 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13387 int n_sax;
13388 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13389 int n_user_data;
13390 int depth; /* Used for loop detection, use 0 */
13391 int n_depth;
13392 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13393 int n_string;
13394 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13395 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013396
Daniel Veillardce682bc2004-11-05 17:22:25 +000013397 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13398 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13399 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13400 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13401 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13402 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13403 mem_base = xmlMemBlocks();
13404 doc = gen_xmlDocPtr(n_doc, 0);
13405 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13406 user_data = gen_userdata(n_user_data, 2);
13407 depth = gen_int(n_depth, 3);
13408 string = gen_const_xmlChar_ptr(n_string, 4);
13409 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013410
13411#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013412 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013413#endif
13414
Daniel Veillardce682bc2004-11-05 17:22:25 +000013415
William M. Brackf13f77f2004-11-12 16:03:48 +000013416 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013417 desret_int(ret_val);
13418 call_tests++;
13419 des_xmlDocPtr(n_doc, doc, 0);
13420 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13421 des_userdata(n_user_data, user_data, 2);
13422 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013423 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013424 des_xmlNodePtr_ptr(n_lst, lst, 5);
13425 xmlResetLastError();
13426 if (mem_base != xmlMemBlocks()) {
13427 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013429 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013430 printf(" %d", n_doc);
13431 printf(" %d", n_sax);
13432 printf(" %d", n_user_data);
13433 printf(" %d", n_depth);
13434 printf(" %d", n_string);
13435 printf(" %d", n_lst);
13436 printf("\n");
13437 }
13438 }
13439 }
13440 }
13441 }
13442 }
13443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013444 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013445#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013446#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013447
Daniel Veillard42595322004-11-08 10:52:06 +000013448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013449}
13450
13451
13452static int
13453test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013455
William M. Brack21e4ef22005-01-02 09:53:13 +000013456#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013457#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013458 int mem_base;
13459 int ret_val;
13460 xmlDocPtr doc; /* the document the chunk pertains to */
13461 int n_doc;
13462 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13463 int n_sax;
13464 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13465 int n_user_data;
13466 int depth; /* Used for loop detection, use 0 */
13467 int n_depth;
13468 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13469 int n_string;
13470 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13471 int n_lst;
13472 int recover; /* return nodes even if the data is broken (use 0) */
13473 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013474
Daniel Veillardce682bc2004-11-05 17:22:25 +000013475 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13476 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13477 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13478 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13479 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13480 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13481 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13482 mem_base = xmlMemBlocks();
13483 doc = gen_xmlDocPtr(n_doc, 0);
13484 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13485 user_data = gen_userdata(n_user_data, 2);
13486 depth = gen_int(n_depth, 3);
13487 string = gen_const_xmlChar_ptr(n_string, 4);
13488 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13489 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013490
13491#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013492 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013493#endif
13494
Daniel Veillardce682bc2004-11-05 17:22:25 +000013495
William M. Brackf13f77f2004-11-12 16:03:48 +000013496 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013497 desret_int(ret_val);
13498 call_tests++;
13499 des_xmlDocPtr(n_doc, doc, 0);
13500 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13501 des_userdata(n_user_data, user_data, 2);
13502 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013503 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013504 des_xmlNodePtr_ptr(n_lst, lst, 5);
13505 des_int(n_recover, recover, 6);
13506 xmlResetLastError();
13507 if (mem_base != xmlMemBlocks()) {
13508 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013511 printf(" %d", n_doc);
13512 printf(" %d", n_sax);
13513 printf(" %d", n_user_data);
13514 printf(" %d", n_depth);
13515 printf(" %d", n_string);
13516 printf(" %d", n_lst);
13517 printf(" %d", n_recover);
13518 printf("\n");
13519 }
13520 }
13521 }
13522 }
13523 }
13524 }
13525 }
13526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013527 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013528#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013529#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013530
Daniel Veillard42595322004-11-08 10:52:06 +000013531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013532}
13533
13534
13535static int
13536test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013538
William M. Brack21e4ef22005-01-02 09:53:13 +000013539#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013540 int mem_base;
13541 int ret_val;
13542 xmlParserCtxtPtr ctxt; /* an XML parser context */
13543 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013544 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013545 int n_chunk;
13546 int size; /* the size in byte of the chunk */
13547 int n_size;
13548 int terminate; /* last chunk indicator */
13549 int n_terminate;
13550
13551 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13552 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13553 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13554 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013556 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13557 chunk = gen_const_char_ptr(n_chunk, 1);
13558 size = gen_int(n_size, 2);
13559 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013560
William M. Brackf13f77f2004-11-12 16:03:48 +000013561 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013562 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013563 desret_int(ret_val);
13564 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013565 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013566 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013567 des_int(n_size, size, 2);
13568 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013569 xmlResetLastError();
13570 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013571 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013573 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013574 printf(" %d", n_ctxt);
13575 printf(" %d", n_chunk);
13576 printf(" %d", n_size);
13577 printf(" %d", n_terminate);
13578 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013579 }
13580 }
13581 }
13582 }
13583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013584 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013585#endif
13586
Daniel Veillard42595322004-11-08 10:52:06 +000013587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013588}
13589
13590
13591static int
13592test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013594
Daniel Veillardce682bc2004-11-05 17:22:25 +000013595 int mem_base;
13596 int ret_val;
13597 xmlParserCtxtPtr ctx; /* the existing parsing context */
13598 int n_ctx;
13599 xmlChar * URL; /* the URL for the entity to load */
13600 int n_URL;
13601 xmlChar * ID; /* the System ID for the entity to load */
13602 int n_ID;
13603 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13604 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013605
Daniel Veillardce682bc2004-11-05 17:22:25 +000013606 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13607 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13608 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13609 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13610 mem_base = xmlMemBlocks();
13611 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13612 URL = gen_const_xmlChar_ptr(n_URL, 1);
13613 ID = gen_const_xmlChar_ptr(n_ID, 2);
13614 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13615
William M. Brackf13f77f2004-11-12 16:03:48 +000013616 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013617 desret_int(ret_val);
13618 call_tests++;
13619 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013620 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13621 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013622 des_xmlNodePtr_ptr(n_lst, lst, 3);
13623 xmlResetLastError();
13624 if (mem_base != xmlMemBlocks()) {
13625 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013627 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013628 printf(" %d", n_ctx);
13629 printf(" %d", n_URL);
13630 printf(" %d", n_ID);
13631 printf(" %d", n_lst);
13632 printf("\n");
13633 }
13634 }
13635 }
13636 }
13637 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013638 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013639
Daniel Veillard42595322004-11-08 10:52:06 +000013640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013641}
13642
13643
13644static int
13645test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013647
William M. Brack21e4ef22005-01-02 09:53:13 +000013648#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013649#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013650 int mem_base;
13651 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013652 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013653 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013654 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013655 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013656
Daniel Veillard34099b42004-11-04 17:34:35 +000013657 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13658 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13659 mem_base = xmlMemBlocks();
13660 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13661 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13662
William M. Brackf13f77f2004-11-12 16:03:48 +000013663 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013664 desret_xmlDtdPtr(ret_val);
13665 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013666 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13667 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013668 xmlResetLastError();
13669 if (mem_base != xmlMemBlocks()) {
13670 printf("Leak of %d blocks found in xmlParseDTD",
13671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013672 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013673 printf(" %d", n_ExternalID);
13674 printf(" %d", n_SystemID);
13675 printf("\n");
13676 }
13677 }
13678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013679 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013680#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013681#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013682
Daniel Veillard42595322004-11-08 10:52:06 +000013683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013684}
13685
13686
13687static int
13688test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013690
William M. Brack21e4ef22005-01-02 09:53:13 +000013691#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013692#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013693 int mem_base;
13694 xmlDocPtr ret_val;
13695 xmlChar * cur; /* a pointer to an array of xmlChar */
13696 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013698 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13699 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013700 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013701
13702 ret_val = xmlParseDoc(cur);
13703 desret_xmlDocPtr(ret_val);
13704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013705 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013706 xmlResetLastError();
13707 if (mem_base != xmlMemBlocks()) {
13708 printf("Leak of %d blocks found in xmlParseDoc",
13709 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013710 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013711 printf(" %d", n_cur);
13712 printf("\n");
13713 }
13714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013715 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013716#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013717#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013718
Daniel Veillard42595322004-11-08 10:52:06 +000013719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013720}
13721
13722
13723static int
13724test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013726
13727 int mem_base;
13728 int ret_val;
13729 xmlParserCtxtPtr ctxt; /* an XML parser context */
13730 int n_ctxt;
13731
13732 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013734 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013735
13736 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013737 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013738 desret_int(ret_val);
13739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013740 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013741 xmlResetLastError();
13742 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013743 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013745 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013746 printf(" %d", n_ctxt);
13747 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013748 }
13749 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013750 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013751
Daniel Veillard42595322004-11-08 10:52:06 +000013752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013753}
13754
13755
13756static int
13757test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013759
William M. Brack21e4ef22005-01-02 09:53:13 +000013760#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013761#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013762 int mem_base;
13763 xmlDocPtr ret_val;
13764 const char * filename; /* the filename */
13765 int n_filename;
13766
13767 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013769 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013770
13771 ret_val = xmlParseEntity(filename);
13772 desret_xmlDocPtr(ret_val);
13773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013774 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013775 xmlResetLastError();
13776 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013777 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013779 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013780 printf(" %d", n_filename);
13781 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013782 }
13783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013784 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013785#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013786#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013787
Daniel Veillard42595322004-11-08 10:52:06 +000013788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013789}
13790
13791
13792static int
13793test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013795
13796 int mem_base;
13797 int ret_val;
13798 xmlParserCtxtPtr ctxt; /* an XML parser context */
13799 int n_ctxt;
13800
13801 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13802 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013803 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013804
13805 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013806 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013807 desret_int(ret_val);
13808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013809 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013810 xmlResetLastError();
13811 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013812 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013814 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013815 printf(" %d", n_ctxt);
13816 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013817 }
13818 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013819 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013820
Daniel Veillard42595322004-11-08 10:52:06 +000013821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013822}
13823
13824
13825static int
13826test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013828
William M. Brack21e4ef22005-01-02 09:53:13 +000013829#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013830#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013831 int mem_base;
13832 int ret_val;
13833 xmlDocPtr doc; /* the document the chunk pertains to */
13834 int n_doc;
13835 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13836 int n_sax;
13837 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13838 int n_user_data;
13839 int depth; /* Used for loop detection, use 0 */
13840 int n_depth;
13841 xmlChar * URL; /* the URL for the entity to load */
13842 int n_URL;
13843 xmlChar * ID; /* the System ID for the entity to load */
13844 int n_ID;
13845 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13846 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013847
Daniel Veillardce682bc2004-11-05 17:22:25 +000013848 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13849 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13850 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13851 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13852 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13853 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13854 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13855 mem_base = xmlMemBlocks();
13856 doc = gen_xmlDocPtr(n_doc, 0);
13857 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13858 user_data = gen_userdata(n_user_data, 2);
13859 depth = gen_int(n_depth, 3);
13860 URL = gen_const_xmlChar_ptr(n_URL, 4);
13861 ID = gen_const_xmlChar_ptr(n_ID, 5);
13862 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13863
William M. Brackf13f77f2004-11-12 16:03:48 +000013864 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013865 desret_int(ret_val);
13866 call_tests++;
13867 des_xmlDocPtr(n_doc, doc, 0);
13868 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13869 des_userdata(n_user_data, user_data, 2);
13870 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013871 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13872 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013873 des_xmlNodePtr_ptr(n_lst, lst, 6);
13874 xmlResetLastError();
13875 if (mem_base != xmlMemBlocks()) {
13876 printf("Leak of %d blocks found in xmlParseExternalEntity",
13877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013878 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013879 printf(" %d", n_doc);
13880 printf(" %d", n_sax);
13881 printf(" %d", n_user_data);
13882 printf(" %d", n_depth);
13883 printf(" %d", n_URL);
13884 printf(" %d", n_ID);
13885 printf(" %d", n_lst);
13886 printf("\n");
13887 }
13888 }
13889 }
13890 }
13891 }
13892 }
13893 }
13894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013895 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013896#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013897#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013898
Daniel Veillard42595322004-11-08 10:52:06 +000013899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013900}
13901
13902
13903static int
13904test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013906
William M. Brack21e4ef22005-01-02 09:53:13 +000013907#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013908#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013909 int mem_base;
13910 xmlDocPtr ret_val;
13911 const char * filename; /* the filename */
13912 int n_filename;
13913
13914 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013916 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013917
13918 ret_val = xmlParseFile(filename);
13919 desret_xmlDocPtr(ret_val);
13920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013921 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013922 xmlResetLastError();
13923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013924 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013927 printf(" %d", n_filename);
13928 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013929 }
13930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013931 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013932#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013933#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013934
Daniel Veillard42595322004-11-08 10:52:06 +000013935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013936}
13937
13938
13939static int
13940test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013942
Daniel Veillard57b25162004-11-06 14:50:18 +000013943 int mem_base;
13944 xmlParserErrors ret_val;
13945 xmlNodePtr node; /* the context node */
13946 int n_node;
13947 char * data; /* the input string */
13948 int n_data;
13949 int datalen; /* the input string length in bytes */
13950 int n_datalen;
13951 int options; /* a combination of xmlParserOption */
13952 int n_options;
13953 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13954 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013955
Daniel Veillard57b25162004-11-06 14:50:18 +000013956 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13957 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13958 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013959 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013960 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13961 mem_base = xmlMemBlocks();
13962 node = gen_xmlNodePtr(n_node, 0);
13963 data = gen_const_char_ptr(n_data, 1);
13964 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013965 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013966 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13967
William M. Brackf13f77f2004-11-12 16:03:48 +000013968 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013969 desret_xmlParserErrors(ret_val);
13970 call_tests++;
13971 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013972 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013973 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013974 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013975 des_xmlNodePtr_ptr(n_lst, lst, 4);
13976 xmlResetLastError();
13977 if (mem_base != xmlMemBlocks()) {
13978 printf("Leak of %d blocks found in xmlParseInNodeContext",
13979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013980 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013981 printf(" %d", n_node);
13982 printf(" %d", n_data);
13983 printf(" %d", n_datalen);
13984 printf(" %d", n_options);
13985 printf(" %d", n_lst);
13986 printf("\n");
13987 }
13988 }
13989 }
13990 }
13991 }
13992 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013993 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013994
Daniel Veillard42595322004-11-08 10:52:06 +000013995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013996}
13997
13998
13999static int
14000test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014002
William M. Brack21e4ef22005-01-02 09:53:13 +000014003#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014004#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014005 int mem_base;
14006 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014007 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014008 int n_buffer;
14009 int size; /* the size of the array */
14010 int n_size;
14011
14012 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14013 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14014 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014015 buffer = gen_const_char_ptr(n_buffer, 0);
14016 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014017
William M. Brackf13f77f2004-11-12 16:03:48 +000014018 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014019 desret_xmlDocPtr(ret_val);
14020 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014021 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014022 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014023 xmlResetLastError();
14024 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014025 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014027 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014028 printf(" %d", n_buffer);
14029 printf(" %d", n_size);
14030 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014031 }
14032 }
14033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014034 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014035#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014036#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014037
Daniel Veillard42595322004-11-08 10:52:06 +000014038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039}
14040
14041
Daniel Veillardce682bc2004-11-05 17:22:25 +000014042#define gen_nb_const_xmlParserNodeInfoPtr 1
14043static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14044 return(NULL);
14045}
14046static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14047}
14048
Daniel Veillardd93f6252004-11-02 15:53:51 +000014049static int
14050test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014052
Daniel Veillardce682bc2004-11-05 17:22:25 +000014053 int mem_base;
14054 xmlParserCtxtPtr ctxt; /* an XML parser context */
14055 int n_ctxt;
14056 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14057 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014058
Daniel Veillardce682bc2004-11-05 17:22:25 +000014059 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14060 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14061 mem_base = xmlMemBlocks();
14062 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14063 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14064
William M. Brackf13f77f2004-11-12 16:03:48 +000014065 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014066 call_tests++;
14067 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014068 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014069 xmlResetLastError();
14070 if (mem_base != xmlMemBlocks()) {
14071 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014073 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014074 printf(" %d", n_ctxt);
14075 printf(" %d", n_info);
14076 printf("\n");
14077 }
14078 }
14079 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014080 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014081
Daniel Veillard42595322004-11-08 10:52:06 +000014082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014083}
14084
14085
Daniel Veillardce682bc2004-11-05 17:22:25 +000014086#define gen_nb_const_xmlParserCtxtPtr 1
14087static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14088 return(NULL);
14089}
14090static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14091}
14092
Daniel Veillarda521d282004-11-09 14:59:59 +000014093#define gen_nb_const_xmlNodePtr 1
14094static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14095 return(NULL);
14096}
14097static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14098}
14099
Daniel Veillardd93f6252004-11-02 15:53:51 +000014100static int
14101test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014103
William M. Brack094dd862004-11-14 14:28:34 +000014104 int mem_base;
14105 const xmlParserNodeInfo * ret_val;
14106 xmlParserCtxtPtr ctx; /* an XML parser context */
14107 int n_ctx;
14108 xmlNodePtr node; /* an XML node within the tree */
14109 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014110
William M. Brack094dd862004-11-14 14:28:34 +000014111 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14112 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14113 mem_base = xmlMemBlocks();
14114 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14115 node = gen_const_xmlNodePtr(n_node, 1);
14116
14117 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14118 desret_const_xmlParserNodeInfo_ptr(ret_val);
14119 call_tests++;
14120 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14121 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14122 xmlResetLastError();
14123 if (mem_base != xmlMemBlocks()) {
14124 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14125 xmlMemBlocks() - mem_base);
14126 test_ret++;
14127 printf(" %d", n_ctx);
14128 printf(" %d", n_node);
14129 printf("\n");
14130 }
14131 }
14132 }
14133 function_tests++;
14134
Daniel Veillard42595322004-11-08 10:52:06 +000014135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014136}
14137
14138
Daniel Veillardce682bc2004-11-05 17:22:25 +000014139#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14140static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14141 return(NULL);
14142}
14143static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14144}
14145
Daniel Veillardd93f6252004-11-02 15:53:51 +000014146static int
14147test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014149
William M. Brack094dd862004-11-14 14:28:34 +000014150 int mem_base;
14151 unsigned long ret_val;
14152 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14153 int n_seq;
14154 xmlNodePtr node; /* an XML node pointer */
14155 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014156
William M. Brack094dd862004-11-14 14:28:34 +000014157 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14158 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14159 mem_base = xmlMemBlocks();
14160 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14161 node = gen_const_xmlNodePtr(n_node, 1);
14162
14163 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14164 desret_unsigned_long(ret_val);
14165 call_tests++;
14166 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14167 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14168 xmlResetLastError();
14169 if (mem_base != xmlMemBlocks()) {
14170 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14171 xmlMemBlocks() - mem_base);
14172 test_ret++;
14173 printf(" %d", n_seq);
14174 printf(" %d", n_node);
14175 printf("\n");
14176 }
14177 }
14178 }
14179 function_tests++;
14180
Daniel Veillard42595322004-11-08 10:52:06 +000014181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182}
14183
14184
Daniel Veillardce682bc2004-11-05 17:22:25 +000014185#define gen_nb_xmlParserInputPtr 1
14186static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14187 return(NULL);
14188}
14189static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14190}
14191
Daniel Veillardd93f6252004-11-02 15:53:51 +000014192static int
14193test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014195
Daniel Veillardce682bc2004-11-05 17:22:25 +000014196 int mem_base;
14197 int ret_val;
14198 xmlParserInputPtr in; /* an XML parser input */
14199 int n_in;
14200 int len; /* an indicative size for the lookahead */
14201 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014202
Daniel Veillardce682bc2004-11-05 17:22:25 +000014203 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14204 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14205 mem_base = xmlMemBlocks();
14206 in = gen_xmlParserInputPtr(n_in, 0);
14207 len = gen_int(n_len, 1);
14208
14209 ret_val = xmlParserInputGrow(in, len);
14210 desret_int(ret_val);
14211 call_tests++;
14212 des_xmlParserInputPtr(n_in, in, 0);
14213 des_int(n_len, len, 1);
14214 xmlResetLastError();
14215 if (mem_base != xmlMemBlocks()) {
14216 printf("Leak of %d blocks found in xmlParserInputGrow",
14217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014218 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014219 printf(" %d", n_in);
14220 printf(" %d", n_len);
14221 printf("\n");
14222 }
14223 }
14224 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014225 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014226
Daniel Veillard42595322004-11-08 10:52:06 +000014227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014228}
14229
14230
14231static int
14232test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014234
Daniel Veillardce682bc2004-11-05 17:22:25 +000014235 int mem_base;
14236 int ret_val;
14237 xmlParserInputPtr in; /* an XML parser input */
14238 int n_in;
14239 int len; /* an indicative size for the lookahead */
14240 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014241
Daniel Veillardce682bc2004-11-05 17:22:25 +000014242 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14243 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14244 mem_base = xmlMemBlocks();
14245 in = gen_xmlParserInputPtr(n_in, 0);
14246 len = gen_int(n_len, 1);
14247
14248 ret_val = xmlParserInputRead(in, len);
14249 desret_int(ret_val);
14250 call_tests++;
14251 des_xmlParserInputPtr(n_in, in, 0);
14252 des_int(n_len, len, 1);
14253 xmlResetLastError();
14254 if (mem_base != xmlMemBlocks()) {
14255 printf("Leak of %d blocks found in xmlParserInputRead",
14256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014257 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014258 printf(" %d", n_in);
14259 printf(" %d", n_len);
14260 printf("\n");
14261 }
14262 }
14263 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014265
Daniel Veillard42595322004-11-08 10:52:06 +000014266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014267}
14268
14269
14270static int
14271test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014273
14274 int mem_base;
14275 int ret_val;
14276 int val; /* int 0 or 1 */
14277 int n_val;
14278
14279 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014281 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014282
14283 ret_val = xmlPedanticParserDefault(val);
14284 desret_int(ret_val);
14285 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014286 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014287 xmlResetLastError();
14288 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014289 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014291 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014292 printf(" %d", n_val);
14293 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014294 }
14295 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014296 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014297
Daniel Veillard42595322004-11-08 10:52:06 +000014298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014299}
14300
14301
14302static int
14303test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014305
14306 int mem_base;
14307 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014308 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014309 int n_cur;
14310 const char * URL; /* the base URL to use for the document */
14311 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014312 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014313 int n_encoding;
14314 int options; /* a combination of xmlParserOption */
14315 int n_options;
14316
14317 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14318 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14319 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014320 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014321 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014322 cur = gen_const_xmlChar_ptr(n_cur, 0);
14323 URL = gen_filepath(n_URL, 1);
14324 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014325 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014326
William M. Brackf13f77f2004-11-12 16:03:48 +000014327 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014328 desret_xmlDocPtr(ret_val);
14329 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014330 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014331 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014332 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014333 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334 xmlResetLastError();
14335 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014336 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014338 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014339 printf(" %d", n_cur);
14340 printf(" %d", n_URL);
14341 printf(" %d", n_encoding);
14342 printf(" %d", n_options);
14343 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344 }
14345 }
14346 }
14347 }
14348 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014349 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014350
Daniel Veillard42595322004-11-08 10:52:06 +000014351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014352}
14353
14354
14355static int
14356test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014358
14359 int mem_base;
14360 xmlDocPtr ret_val;
14361 const char * filename; /* a file or URL */
14362 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014363 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014364 int n_encoding;
14365 int options; /* a combination of xmlParserOption */
14366 int n_options;
14367
14368 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14369 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014370 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014372 filename = gen_filepath(n_filename, 0);
14373 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014374 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014375
William M. Brackf13f77f2004-11-12 16:03:48 +000014376 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014377 desret_xmlDocPtr(ret_val);
14378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014379 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014380 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014381 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014382 xmlResetLastError();
14383 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014384 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014386 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014387 printf(" %d", n_filename);
14388 printf(" %d", n_encoding);
14389 printf(" %d", n_options);
14390 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014391 }
14392 }
14393 }
14394 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014396
Daniel Veillard42595322004-11-08 10:52:06 +000014397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014398}
14399
14400
14401static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014402test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014404
14405 int mem_base;
14406 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014407 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014408 int n_buffer;
14409 int size; /* the size of the array */
14410 int n_size;
14411 const char * URL; /* the base URL to use for the document */
14412 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014413 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014414 int n_encoding;
14415 int options; /* a combination of xmlParserOption */
14416 int n_options;
14417
14418 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14419 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14420 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14421 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014422 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014423 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014424 buffer = gen_const_char_ptr(n_buffer, 0);
14425 size = gen_int(n_size, 1);
14426 URL = gen_filepath(n_URL, 2);
14427 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014428 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014429
William M. Brackf13f77f2004-11-12 16:03:48 +000014430 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014431 desret_xmlDocPtr(ret_val);
14432 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014433 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014434 des_int(n_size, size, 1);
14435 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014436 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014437 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438 xmlResetLastError();
14439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014440 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014443 printf(" %d", n_buffer);
14444 printf(" %d", n_size);
14445 printf(" %d", n_URL);
14446 printf(" %d", n_encoding);
14447 printf(" %d", n_options);
14448 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014449 }
14450 }
14451 }
14452 }
14453 }
14454 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014456
Daniel Veillard42595322004-11-08 10:52:06 +000014457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014458}
14459
14460
14461static int
14462test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014464
William M. Brack21e4ef22005-01-02 09:53:13 +000014465#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014466#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014467 int mem_base;
14468 xmlDocPtr ret_val;
14469 xmlChar * cur; /* a pointer to an array of xmlChar */
14470 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014471
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014472 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14473 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014474 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014475
14476 ret_val = xmlRecoverDoc(cur);
14477 desret_xmlDocPtr(ret_val);
14478 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014479 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014480 xmlResetLastError();
14481 if (mem_base != xmlMemBlocks()) {
14482 printf("Leak of %d blocks found in xmlRecoverDoc",
14483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014484 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014485 printf(" %d", n_cur);
14486 printf("\n");
14487 }
14488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014489 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014490#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014491#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014492
Daniel Veillard42595322004-11-08 10:52:06 +000014493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014494}
14495
14496
14497static int
14498test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014500
William M. Brack21e4ef22005-01-02 09:53:13 +000014501#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014502#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014503 int mem_base;
14504 xmlDocPtr ret_val;
14505 const char * filename; /* the filename */
14506 int n_filename;
14507
14508 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14509 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014510 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014511
14512 ret_val = xmlRecoverFile(filename);
14513 desret_xmlDocPtr(ret_val);
14514 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014515 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014516 xmlResetLastError();
14517 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014518 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014520 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014521 printf(" %d", n_filename);
14522 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014523 }
14524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014525 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014526#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014527#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014528
Daniel Veillard42595322004-11-08 10:52:06 +000014529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014530}
14531
14532
14533static int
14534test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014536
William M. Brack21e4ef22005-01-02 09:53:13 +000014537#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014538#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014539 int mem_base;
14540 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014541 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014542 int n_buffer;
14543 int size; /* the size of the array */
14544 int n_size;
14545
14546 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14547 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014549 buffer = gen_const_char_ptr(n_buffer, 0);
14550 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014551
William M. Brackf13f77f2004-11-12 16:03:48 +000014552 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014553 desret_xmlDocPtr(ret_val);
14554 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014555 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014556 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014557 xmlResetLastError();
14558 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014559 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014561 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014562 printf(" %d", n_buffer);
14563 printf(" %d", n_size);
14564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014565 }
14566 }
14567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014568 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014569#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014570#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014571
Daniel Veillard42595322004-11-08 10:52:06 +000014572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014573}
14574
14575
14576static int
14577test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014579
William M. Brack21e4ef22005-01-02 09:53:13 +000014580#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014581#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014582 int mem_base;
14583 xmlDtdPtr ret_val;
14584 xmlSAXHandlerPtr sax; /* the SAX handler block */
14585 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014586 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014587 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014588 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014589 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014590
Daniel Veillard34099b42004-11-04 17:34:35 +000014591 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14592 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14593 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14594 mem_base = xmlMemBlocks();
14595 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14596 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14597 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14598
William M. Brackf13f77f2004-11-12 16:03:48 +000014599 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014600 desret_xmlDtdPtr(ret_val);
14601 call_tests++;
14602 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014603 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14604 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014605 xmlResetLastError();
14606 if (mem_base != xmlMemBlocks()) {
14607 printf("Leak of %d blocks found in xmlSAXParseDTD",
14608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014609 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014610 printf(" %d", n_sax);
14611 printf(" %d", n_ExternalID);
14612 printf(" %d", n_SystemID);
14613 printf("\n");
14614 }
14615 }
14616 }
14617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014618 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014619#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014620#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014621
Daniel Veillard42595322004-11-08 10:52:06 +000014622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014623}
14624
14625
14626static int
14627test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014629
William M. Brack21e4ef22005-01-02 09:53:13 +000014630#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014631#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014632 int mem_base;
14633 xmlDocPtr ret_val;
14634 xmlSAXHandlerPtr sax; /* the SAX handler block */
14635 int n_sax;
14636 xmlChar * cur; /* a pointer to an array of xmlChar */
14637 int n_cur;
14638 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14639 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014640
Daniel Veillard34099b42004-11-04 17:34:35 +000014641 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14642 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14643 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14644 mem_base = xmlMemBlocks();
14645 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14646 cur = gen_xmlChar_ptr(n_cur, 1);
14647 recovery = gen_int(n_recovery, 2);
14648
14649 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14650 desret_xmlDocPtr(ret_val);
14651 call_tests++;
14652 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14653 des_xmlChar_ptr(n_cur, cur, 1);
14654 des_int(n_recovery, recovery, 2);
14655 xmlResetLastError();
14656 if (mem_base != xmlMemBlocks()) {
14657 printf("Leak of %d blocks found in xmlSAXParseDoc",
14658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014659 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014660 printf(" %d", n_sax);
14661 printf(" %d", n_cur);
14662 printf(" %d", n_recovery);
14663 printf("\n");
14664 }
14665 }
14666 }
14667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014668 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014669#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014670#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014671
Daniel Veillard42595322004-11-08 10:52:06 +000014672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014673}
14674
14675
14676static int
14677test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014679
William M. Brack21e4ef22005-01-02 09:53:13 +000014680#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014681#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014682 int mem_base;
14683 xmlDocPtr ret_val;
14684 xmlSAXHandlerPtr sax; /* the SAX handler block */
14685 int n_sax;
14686 const char * filename; /* the filename */
14687 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014688
Daniel Veillard34099b42004-11-04 17:34:35 +000014689 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14690 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14691 mem_base = xmlMemBlocks();
14692 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14693 filename = gen_filepath(n_filename, 1);
14694
14695 ret_val = xmlSAXParseEntity(sax, filename);
14696 desret_xmlDocPtr(ret_val);
14697 call_tests++;
14698 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14699 des_filepath(n_filename, filename, 1);
14700 xmlResetLastError();
14701 if (mem_base != xmlMemBlocks()) {
14702 printf("Leak of %d blocks found in xmlSAXParseEntity",
14703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014704 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014705 printf(" %d", n_sax);
14706 printf(" %d", n_filename);
14707 printf("\n");
14708 }
14709 }
14710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014711 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014712#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014713#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014714
Daniel Veillard42595322004-11-08 10:52:06 +000014715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014716}
14717
14718
14719static int
14720test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014722
William M. Brack21e4ef22005-01-02 09:53:13 +000014723#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014724#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014725 int mem_base;
14726 xmlDocPtr ret_val;
14727 xmlSAXHandlerPtr sax; /* the SAX handler block */
14728 int n_sax;
14729 const char * filename; /* the filename */
14730 int n_filename;
14731 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14732 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014733
Daniel Veillard34099b42004-11-04 17:34:35 +000014734 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14735 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14736 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14737 mem_base = xmlMemBlocks();
14738 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14739 filename = gen_filepath(n_filename, 1);
14740 recovery = gen_int(n_recovery, 2);
14741
14742 ret_val = xmlSAXParseFile(sax, filename, recovery);
14743 desret_xmlDocPtr(ret_val);
14744 call_tests++;
14745 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14746 des_filepath(n_filename, filename, 1);
14747 des_int(n_recovery, recovery, 2);
14748 xmlResetLastError();
14749 if (mem_base != xmlMemBlocks()) {
14750 printf("Leak of %d blocks found in xmlSAXParseFile",
14751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014752 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014753 printf(" %d", n_sax);
14754 printf(" %d", n_filename);
14755 printf(" %d", n_recovery);
14756 printf("\n");
14757 }
14758 }
14759 }
14760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014761 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014762#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014763#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014764
Daniel Veillard42595322004-11-08 10:52:06 +000014765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014766}
14767
14768
14769static int
14770test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014772
William M. Brack21e4ef22005-01-02 09:53:13 +000014773#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014774#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014775 int mem_base;
14776 xmlDocPtr ret_val;
14777 xmlSAXHandlerPtr sax; /* the SAX handler block */
14778 int n_sax;
14779 const char * filename; /* the filename */
14780 int n_filename;
14781 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14782 int n_recovery;
14783 void * data; /* the userdata */
14784 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014785
Daniel Veillard34099b42004-11-04 17:34:35 +000014786 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14787 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14788 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14789 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14790 mem_base = xmlMemBlocks();
14791 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14792 filename = gen_filepath(n_filename, 1);
14793 recovery = gen_int(n_recovery, 2);
14794 data = gen_userdata(n_data, 3);
14795
14796 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14797 desret_xmlDocPtr(ret_val);
14798 call_tests++;
14799 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14800 des_filepath(n_filename, filename, 1);
14801 des_int(n_recovery, recovery, 2);
14802 des_userdata(n_data, data, 3);
14803 xmlResetLastError();
14804 if (mem_base != xmlMemBlocks()) {
14805 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014807 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014808 printf(" %d", n_sax);
14809 printf(" %d", n_filename);
14810 printf(" %d", n_recovery);
14811 printf(" %d", n_data);
14812 printf("\n");
14813 }
14814 }
14815 }
14816 }
14817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014818 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014819#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014820#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014821
Daniel Veillard42595322004-11-08 10:52:06 +000014822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014823}
14824
14825
14826static int
14827test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014829
William M. Brack21e4ef22005-01-02 09:53:13 +000014830#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014831#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014832 int mem_base;
14833 xmlDocPtr ret_val;
14834 xmlSAXHandlerPtr sax; /* the SAX handler block */
14835 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014836 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014837 int n_buffer;
14838 int size; /* the size of the array */
14839 int n_size;
14840 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14841 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014842
Daniel Veillard34099b42004-11-04 17:34:35 +000014843 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14844 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14845 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14846 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14847 mem_base = xmlMemBlocks();
14848 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14849 buffer = gen_const_char_ptr(n_buffer, 1);
14850 size = gen_int(n_size, 2);
14851 recovery = gen_int(n_recovery, 3);
14852
William M. Brackf13f77f2004-11-12 16:03:48 +000014853 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014854 desret_xmlDocPtr(ret_val);
14855 call_tests++;
14856 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014857 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014858 des_int(n_size, size, 2);
14859 des_int(n_recovery, recovery, 3);
14860 xmlResetLastError();
14861 if (mem_base != xmlMemBlocks()) {
14862 printf("Leak of %d blocks found in xmlSAXParseMemory",
14863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014864 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014865 printf(" %d", n_sax);
14866 printf(" %d", n_buffer);
14867 printf(" %d", n_size);
14868 printf(" %d", n_recovery);
14869 printf("\n");
14870 }
14871 }
14872 }
14873 }
14874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014875 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014876#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014877#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014878
Daniel Veillard42595322004-11-08 10:52:06 +000014879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014880}
14881
14882
14883static int
14884test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014886
William M. Brack21e4ef22005-01-02 09:53:13 +000014887#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014888#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014889 int mem_base;
14890 xmlDocPtr ret_val;
14891 xmlSAXHandlerPtr sax; /* the SAX handler block */
14892 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014893 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014894 int n_buffer;
14895 int size; /* the size of the array */
14896 int n_size;
14897 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14898 int n_recovery;
14899 void * data; /* the userdata */
14900 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014901
Daniel Veillard34099b42004-11-04 17:34:35 +000014902 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14903 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14904 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14905 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14906 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14907 mem_base = xmlMemBlocks();
14908 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14909 buffer = gen_const_char_ptr(n_buffer, 1);
14910 size = gen_int(n_size, 2);
14911 recovery = gen_int(n_recovery, 3);
14912 data = gen_userdata(n_data, 4);
14913
William M. Brackf13f77f2004-11-12 16:03:48 +000014914 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014915 desret_xmlDocPtr(ret_val);
14916 call_tests++;
14917 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014918 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014919 des_int(n_size, size, 2);
14920 des_int(n_recovery, recovery, 3);
14921 des_userdata(n_data, data, 4);
14922 xmlResetLastError();
14923 if (mem_base != xmlMemBlocks()) {
14924 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014926 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014927 printf(" %d", n_sax);
14928 printf(" %d", n_buffer);
14929 printf(" %d", n_size);
14930 printf(" %d", n_recovery);
14931 printf(" %d", n_data);
14932 printf("\n");
14933 }
14934 }
14935 }
14936 }
14937 }
14938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014939 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014940#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014941#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014942
Daniel Veillard42595322004-11-08 10:52:06 +000014943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014944}
14945
14946
14947static int
14948test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014950
William M. Brack21e4ef22005-01-02 09:53:13 +000014951#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014952#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014953 int mem_base;
14954 int ret_val;
14955 xmlSAXHandlerPtr sax; /* a SAX handler */
14956 int n_sax;
14957 void * user_data; /* The user data returned on SAX callbacks */
14958 int n_user_data;
14959 const char * filename; /* a file name */
14960 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014961
Daniel Veillard34099b42004-11-04 17:34:35 +000014962 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14963 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14964 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14965 mem_base = xmlMemBlocks();
14966 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14967 user_data = gen_userdata(n_user_data, 1);
14968 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014969
14970#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014971 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014972#endif
14973
Daniel Veillard34099b42004-11-04 17:34:35 +000014974
14975 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14976 desret_int(ret_val);
14977 call_tests++;
14978 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14979 des_userdata(n_user_data, user_data, 1);
14980 des_filepath(n_filename, filename, 2);
14981 xmlResetLastError();
14982 if (mem_base != xmlMemBlocks()) {
14983 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014985 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014986 printf(" %d", n_sax);
14987 printf(" %d", n_user_data);
14988 printf(" %d", n_filename);
14989 printf("\n");
14990 }
14991 }
14992 }
14993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014994 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014995#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014996#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014997
Daniel Veillard42595322004-11-08 10:52:06 +000014998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014999}
15000
15001
15002static int
15003test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015005
William M. Brack21e4ef22005-01-02 09:53:13 +000015006#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015007#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015008 int mem_base;
15009 int ret_val;
15010 xmlSAXHandlerPtr sax; /* a SAX handler */
15011 int n_sax;
15012 void * user_data; /* The user data returned on SAX callbacks */
15013 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015014 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015015 int n_buffer;
15016 int size; /* the length of the XML document in bytes */
15017 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015018
Daniel Veillard34099b42004-11-04 17:34:35 +000015019 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15020 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15021 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15022 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15023 mem_base = xmlMemBlocks();
15024 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15025 user_data = gen_userdata(n_user_data, 1);
15026 buffer = gen_const_char_ptr(n_buffer, 2);
15027 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015028
15029#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015030 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015031#endif
15032
Daniel Veillard34099b42004-11-04 17:34:35 +000015033
William M. Brackf13f77f2004-11-12 16:03:48 +000015034 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015035 desret_int(ret_val);
15036 call_tests++;
15037 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15038 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015039 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015040 des_int(n_size, size, 3);
15041 xmlResetLastError();
15042 if (mem_base != xmlMemBlocks()) {
15043 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015045 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015046 printf(" %d", n_sax);
15047 printf(" %d", n_user_data);
15048 printf(" %d", n_buffer);
15049 printf(" %d", n_size);
15050 printf("\n");
15051 }
15052 }
15053 }
15054 }
15055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015056 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015057#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015058#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015059
Daniel Veillard42595322004-11-08 10:52:06 +000015060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015061}
15062
15063
15064static int
15065test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015067
15068
15069 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015071}
15072
15073
15074static int
15075test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015077
William M. Brack21e4ef22005-01-02 09:53:13 +000015078#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015079#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015080 int mem_base;
15081 int ret_val;
15082 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15083 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015084 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015085 int n_name;
15086 void * value; /* pointer to the location of the new value */
15087 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015088
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015089 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15090 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15091 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15092 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015093 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15094 name = gen_const_char_ptr(n_name, 1);
15095 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015096
William M. Brackf13f77f2004-11-12 16:03:48 +000015097 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015098 desret_int(ret_val);
15099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015100 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015101 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015102 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015103 xmlResetLastError();
15104 if (mem_base != xmlMemBlocks()) {
15105 printf("Leak of %d blocks found in xmlSetFeature",
15106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015107 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015108 printf(" %d", n_ctxt);
15109 printf(" %d", n_name);
15110 printf(" %d", n_value);
15111 printf("\n");
15112 }
15113 }
15114 }
15115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015116 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015117#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015118#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015119
Daniel Veillard42595322004-11-08 10:52:06 +000015120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015121}
15122
15123
15124static int
15125test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015127
William M. Brack21e4ef22005-01-02 09:53:13 +000015128#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015129#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015130 int mem_base;
15131 xmlParserCtxtPtr ctxt; /* an XML parser context */
15132 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015133 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015134 int n_buffer;
15135 const char * filename; /* a file name */
15136 int n_filename;
15137
15138 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15139 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15140 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015142 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15143 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15144 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145
William M. Brackf13f77f2004-11-12 16:03:48 +000015146 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015147 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015148 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015149 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015150 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015151 xmlResetLastError();
15152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015153 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015156 printf(" %d", n_ctxt);
15157 printf(" %d", n_buffer);
15158 printf(" %d", n_filename);
15159 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015160 }
15161 }
15162 }
15163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015164 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015165#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015166#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015167
Daniel Veillard42595322004-11-08 10:52:06 +000015168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169}
15170
15171
15172static int
15173test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015175
William M. Brack21e4ef22005-01-02 09:53:13 +000015176#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015177#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015178 int mem_base;
15179 xmlParserCtxtPtr ctxt; /* an XML parser context */
15180 int n_ctxt;
15181
15182 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15183 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015184 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015185
15186 xmlStopParser(ctxt);
15187 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015188 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015189 xmlResetLastError();
15190 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015191 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015193 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015194 printf(" %d", n_ctxt);
15195 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015196 }
15197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015198 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015199#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015200#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015201
Daniel Veillard42595322004-11-08 10:52:06 +000015202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015203}
15204
15205
15206static int
15207test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015209
15210 int mem_base;
15211 int ret_val;
15212 int val; /* int 0 or 1 */
15213 int n_val;
15214
15215 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015217 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015218
15219 ret_val = xmlSubstituteEntitiesDefault(val);
15220 desret_int(ret_val);
15221 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015222 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015223 xmlResetLastError();
15224 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015225 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015227 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015228 printf(" %d", n_val);
15229 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015230 }
15231 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015233
Daniel Veillard42595322004-11-08 10:52:06 +000015234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015235}
15236
15237static int
15238test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015240
William M. Brack094dd862004-11-14 14:28:34 +000015241 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015242 test_ret += test_xmlByteConsumed();
15243 test_ret += test_xmlClearNodeInfoSeq();
15244 test_ret += test_xmlClearParserCtxt();
15245 test_ret += test_xmlCreateDocParserCtxt();
15246 test_ret += test_xmlCreatePushParserCtxt();
15247 test_ret += test_xmlCtxtReadDoc();
15248 test_ret += test_xmlCtxtReadFile();
15249 test_ret += test_xmlCtxtReadMemory();
15250 test_ret += test_xmlCtxtReset();
15251 test_ret += test_xmlCtxtResetPush();
15252 test_ret += test_xmlCtxtUseOptions();
15253 test_ret += test_xmlGetExternalEntityLoader();
15254 test_ret += test_xmlGetFeature();
15255 test_ret += test_xmlGetFeaturesList();
15256 test_ret += test_xmlIOParseDTD();
15257 test_ret += test_xmlInitNodeInfoSeq();
15258 test_ret += test_xmlInitParser();
15259 test_ret += test_xmlInitParserCtxt();
15260 test_ret += test_xmlKeepBlanksDefault();
15261 test_ret += test_xmlLineNumbersDefault();
15262 test_ret += test_xmlLoadExternalEntity();
15263 test_ret += test_xmlNewIOInputStream();
15264 test_ret += test_xmlNewParserCtxt();
15265 test_ret += test_xmlParseBalancedChunkMemory();
15266 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15267 test_ret += test_xmlParseChunk();
15268 test_ret += test_xmlParseCtxtExternalEntity();
15269 test_ret += test_xmlParseDTD();
15270 test_ret += test_xmlParseDoc();
15271 test_ret += test_xmlParseDocument();
15272 test_ret += test_xmlParseEntity();
15273 test_ret += test_xmlParseExtParsedEnt();
15274 test_ret += test_xmlParseExternalEntity();
15275 test_ret += test_xmlParseFile();
15276 test_ret += test_xmlParseInNodeContext();
15277 test_ret += test_xmlParseMemory();
15278 test_ret += test_xmlParserAddNodeInfo();
15279 test_ret += test_xmlParserFindNodeInfo();
15280 test_ret += test_xmlParserFindNodeInfoIndex();
15281 test_ret += test_xmlParserInputGrow();
15282 test_ret += test_xmlParserInputRead();
15283 test_ret += test_xmlPedanticParserDefault();
15284 test_ret += test_xmlReadDoc();
15285 test_ret += test_xmlReadFile();
15286 test_ret += test_xmlReadMemory();
15287 test_ret += test_xmlRecoverDoc();
15288 test_ret += test_xmlRecoverFile();
15289 test_ret += test_xmlRecoverMemory();
15290 test_ret += test_xmlSAXParseDTD();
15291 test_ret += test_xmlSAXParseDoc();
15292 test_ret += test_xmlSAXParseEntity();
15293 test_ret += test_xmlSAXParseFile();
15294 test_ret += test_xmlSAXParseFileWithData();
15295 test_ret += test_xmlSAXParseMemory();
15296 test_ret += test_xmlSAXParseMemoryWithData();
15297 test_ret += test_xmlSAXUserParseFile();
15298 test_ret += test_xmlSAXUserParseMemory();
15299 test_ret += test_xmlSetExternalEntityLoader();
15300 test_ret += test_xmlSetFeature();
15301 test_ret += test_xmlSetupParserForBuffer();
15302 test_ret += test_xmlStopParser();
15303 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015304
Daniel Veillard42595322004-11-08 10:52:06 +000015305 if (test_ret != 0)
15306 printf("Module parser: %d errors\n", test_ret);
15307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015308}
15309
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015310static int
15311test_htmlCreateFileParserCtxt(void) {
15312 int test_ret = 0;
15313
William M. Brack21e4ef22005-01-02 09:53:13 +000015314#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015315 int mem_base;
15316 htmlParserCtxtPtr ret_val;
15317 const char * filename; /* the filename */
15318 int n_filename;
15319 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15320 int n_encoding;
15321
15322 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15323 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15324 mem_base = xmlMemBlocks();
15325 filename = gen_fileoutput(n_filename, 0);
15326 encoding = gen_const_char_ptr(n_encoding, 1);
15327
William M. Brackf13f77f2004-11-12 16:03:48 +000015328 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015329 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015330 call_tests++;
15331 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015332 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015333 xmlResetLastError();
15334 if (mem_base != xmlMemBlocks()) {
15335 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15336 xmlMemBlocks() - mem_base);
15337 test_ret++;
15338 printf(" %d", n_filename);
15339 printf(" %d", n_encoding);
15340 printf("\n");
15341 }
15342 }
15343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015344 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015345#endif
15346
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015347 return(test_ret);
15348}
15349
15350
15351static int
15352test_htmlInitAutoClose(void) {
15353 int test_ret = 0;
15354
William M. Brack21e4ef22005-01-02 09:53:13 +000015355#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015356 int mem_base;
15357
15358 mem_base = xmlMemBlocks();
15359
15360 htmlInitAutoClose();
15361 call_tests++;
15362 xmlResetLastError();
15363 if (mem_base != xmlMemBlocks()) {
15364 printf("Leak of %d blocks found in htmlInitAutoClose",
15365 xmlMemBlocks() - mem_base);
15366 test_ret++;
15367 printf("\n");
15368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015369 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015370#endif
15371
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015372 return(test_ret);
15373}
15374
15375
15376static int
15377test_inputPop(void) {
15378 int test_ret = 0;
15379
15380 int mem_base;
15381 xmlParserInputPtr ret_val;
15382 xmlParserCtxtPtr ctxt; /* an XML parser context */
15383 int n_ctxt;
15384
15385 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15386 mem_base = xmlMemBlocks();
15387 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15388
15389 ret_val = inputPop(ctxt);
15390 desret_xmlParserInputPtr(ret_val);
15391 call_tests++;
15392 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15393 xmlResetLastError();
15394 if (mem_base != xmlMemBlocks()) {
15395 printf("Leak of %d blocks found in inputPop",
15396 xmlMemBlocks() - mem_base);
15397 test_ret++;
15398 printf(" %d", n_ctxt);
15399 printf("\n");
15400 }
15401 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015403
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015404 return(test_ret);
15405}
15406
15407
15408static int
15409test_inputPush(void) {
15410 int test_ret = 0;
15411
15412 int mem_base;
15413 int ret_val;
15414 xmlParserCtxtPtr ctxt; /* an XML parser context */
15415 int n_ctxt;
15416 xmlParserInputPtr value; /* the parser input */
15417 int n_value;
15418
15419 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15420 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15421 mem_base = xmlMemBlocks();
15422 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15423 value = gen_xmlParserInputPtr(n_value, 1);
15424
15425 ret_val = inputPush(ctxt, value);
15426 desret_int(ret_val);
15427 call_tests++;
15428 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15429 des_xmlParserInputPtr(n_value, value, 1);
15430 xmlResetLastError();
15431 if (mem_base != xmlMemBlocks()) {
15432 printf("Leak of %d blocks found in inputPush",
15433 xmlMemBlocks() - mem_base);
15434 test_ret++;
15435 printf(" %d", n_ctxt);
15436 printf(" %d", n_value);
15437 printf("\n");
15438 }
15439 }
15440 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015441 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015442
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015443 return(test_ret);
15444}
15445
15446
15447static int
15448test_namePop(void) {
15449 int test_ret = 0;
15450
15451 int mem_base;
15452 const xmlChar * ret_val;
15453 xmlParserCtxtPtr ctxt; /* an XML parser context */
15454 int n_ctxt;
15455
15456 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15457 mem_base = xmlMemBlocks();
15458 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15459
15460 ret_val = namePop(ctxt);
15461 desret_const_xmlChar_ptr(ret_val);
15462 call_tests++;
15463 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15464 xmlResetLastError();
15465 if (mem_base != xmlMemBlocks()) {
15466 printf("Leak of %d blocks found in namePop",
15467 xmlMemBlocks() - mem_base);
15468 test_ret++;
15469 printf(" %d", n_ctxt);
15470 printf("\n");
15471 }
15472 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015473 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015474
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015475 return(test_ret);
15476}
15477
15478
15479static int
15480test_namePush(void) {
15481 int test_ret = 0;
15482
15483 int mem_base;
15484 int ret_val;
15485 xmlParserCtxtPtr ctxt; /* an XML parser context */
15486 int n_ctxt;
15487 xmlChar * value; /* the element name */
15488 int n_value;
15489
15490 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15491 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15492 mem_base = xmlMemBlocks();
15493 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15494 value = gen_const_xmlChar_ptr(n_value, 1);
15495
William M. Brackf13f77f2004-11-12 16:03:48 +000015496 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015497 desret_int(ret_val);
15498 call_tests++;
15499 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015500 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015501 xmlResetLastError();
15502 if (mem_base != xmlMemBlocks()) {
15503 printf("Leak of %d blocks found in namePush",
15504 xmlMemBlocks() - mem_base);
15505 test_ret++;
15506 printf(" %d", n_ctxt);
15507 printf(" %d", n_value);
15508 printf("\n");
15509 }
15510 }
15511 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015513
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015514 return(test_ret);
15515}
15516
15517
15518static int
15519test_nodePop(void) {
15520 int test_ret = 0;
15521
15522 int mem_base;
15523 xmlNodePtr ret_val;
15524 xmlParserCtxtPtr ctxt; /* an XML parser context */
15525 int n_ctxt;
15526
15527 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15528 mem_base = xmlMemBlocks();
15529 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15530
15531 ret_val = nodePop(ctxt);
15532 desret_xmlNodePtr(ret_val);
15533 call_tests++;
15534 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15535 xmlResetLastError();
15536 if (mem_base != xmlMemBlocks()) {
15537 printf("Leak of %d blocks found in nodePop",
15538 xmlMemBlocks() - mem_base);
15539 test_ret++;
15540 printf(" %d", n_ctxt);
15541 printf("\n");
15542 }
15543 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015545
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015546 return(test_ret);
15547}
15548
15549
15550static int
15551test_nodePush(void) {
15552 int test_ret = 0;
15553
15554 int mem_base;
15555 int ret_val;
15556 xmlParserCtxtPtr ctxt; /* an XML parser context */
15557 int n_ctxt;
15558 xmlNodePtr value; /* the element node */
15559 int n_value;
15560
15561 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15562 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15563 mem_base = xmlMemBlocks();
15564 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15565 value = gen_xmlNodePtr(n_value, 1);
15566
15567 ret_val = nodePush(ctxt, value);
15568 desret_int(ret_val);
15569 call_tests++;
15570 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15571 des_xmlNodePtr(n_value, value, 1);
15572 xmlResetLastError();
15573 if (mem_base != xmlMemBlocks()) {
15574 printf("Leak of %d blocks found in nodePush",
15575 xmlMemBlocks() - mem_base);
15576 test_ret++;
15577 printf(" %d", n_ctxt);
15578 printf(" %d", n_value);
15579 printf("\n");
15580 }
15581 }
15582 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015584
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015585 return(test_ret);
15586}
15587
15588
15589static int
15590test_xmlCheckLanguageID(void) {
15591 int test_ret = 0;
15592
15593 int mem_base;
15594 int ret_val;
15595 xmlChar * lang; /* pointer to the string value */
15596 int n_lang;
15597
15598 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15599 mem_base = xmlMemBlocks();
15600 lang = gen_const_xmlChar_ptr(n_lang, 0);
15601
William M. Brackf13f77f2004-11-12 16:03:48 +000015602 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015603 desret_int(ret_val);
15604 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015605 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015606 xmlResetLastError();
15607 if (mem_base != xmlMemBlocks()) {
15608 printf("Leak of %d blocks found in xmlCheckLanguageID",
15609 xmlMemBlocks() - mem_base);
15610 test_ret++;
15611 printf(" %d", n_lang);
15612 printf("\n");
15613 }
15614 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015616
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015617 return(test_ret);
15618}
15619
15620
15621static int
15622test_xmlCopyChar(void) {
15623 int test_ret = 0;
15624
15625 int mem_base;
15626 int ret_val;
15627 int len; /* Ignored, compatibility */
15628 int n_len;
15629 xmlChar * out; /* pointer to an array of xmlChar */
15630 int n_out;
15631 int val; /* the char value */
15632 int n_val;
15633
15634 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15635 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15636 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15637 mem_base = xmlMemBlocks();
15638 len = gen_int(n_len, 0);
15639 out = gen_xmlChar_ptr(n_out, 1);
15640 val = gen_int(n_val, 2);
15641
15642 ret_val = xmlCopyChar(len, out, val);
15643 desret_int(ret_val);
15644 call_tests++;
15645 des_int(n_len, len, 0);
15646 des_xmlChar_ptr(n_out, out, 1);
15647 des_int(n_val, val, 2);
15648 xmlResetLastError();
15649 if (mem_base != xmlMemBlocks()) {
15650 printf("Leak of %d blocks found in xmlCopyChar",
15651 xmlMemBlocks() - mem_base);
15652 test_ret++;
15653 printf(" %d", n_len);
15654 printf(" %d", n_out);
15655 printf(" %d", n_val);
15656 printf("\n");
15657 }
15658 }
15659 }
15660 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015662
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015663 return(test_ret);
15664}
15665
15666
15667static int
15668test_xmlCopyCharMultiByte(void) {
15669 int test_ret = 0;
15670
15671 int mem_base;
15672 int ret_val;
15673 xmlChar * out; /* pointer to an array of xmlChar */
15674 int n_out;
15675 int val; /* the char value */
15676 int n_val;
15677
15678 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15679 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15680 mem_base = xmlMemBlocks();
15681 out = gen_xmlChar_ptr(n_out, 0);
15682 val = gen_int(n_val, 1);
15683
15684 ret_val = xmlCopyCharMultiByte(out, val);
15685 desret_int(ret_val);
15686 call_tests++;
15687 des_xmlChar_ptr(n_out, out, 0);
15688 des_int(n_val, val, 1);
15689 xmlResetLastError();
15690 if (mem_base != xmlMemBlocks()) {
15691 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15692 xmlMemBlocks() - mem_base);
15693 test_ret++;
15694 printf(" %d", n_out);
15695 printf(" %d", n_val);
15696 printf("\n");
15697 }
15698 }
15699 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015701
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015702 return(test_ret);
15703}
15704
15705
15706static int
15707test_xmlCreateEntityParserCtxt(void) {
15708 int test_ret = 0;
15709
15710 int mem_base;
15711 xmlParserCtxtPtr ret_val;
15712 xmlChar * URL; /* the entity URL */
15713 int n_URL;
15714 xmlChar * ID; /* the entity PUBLIC ID */
15715 int n_ID;
15716 xmlChar * base; /* a possible base for the target URI */
15717 int n_base;
15718
15719 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15720 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15721 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15722 mem_base = xmlMemBlocks();
15723 URL = gen_const_xmlChar_ptr(n_URL, 0);
15724 ID = gen_const_xmlChar_ptr(n_ID, 1);
15725 base = gen_const_xmlChar_ptr(n_base, 2);
15726
William M. Brackf13f77f2004-11-12 16:03:48 +000015727 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015728 desret_xmlParserCtxtPtr(ret_val);
15729 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015730 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15731 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15732 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015733 xmlResetLastError();
15734 if (mem_base != xmlMemBlocks()) {
15735 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15736 xmlMemBlocks() - mem_base);
15737 test_ret++;
15738 printf(" %d", n_URL);
15739 printf(" %d", n_ID);
15740 printf(" %d", n_base);
15741 printf("\n");
15742 }
15743 }
15744 }
15745 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015747
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015748 return(test_ret);
15749}
15750
15751
15752static int
15753test_xmlCreateFileParserCtxt(void) {
15754 int test_ret = 0;
15755
15756 int mem_base;
15757 xmlParserCtxtPtr ret_val;
15758 const char * filename; /* the filename */
15759 int n_filename;
15760
15761 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15762 mem_base = xmlMemBlocks();
15763 filename = gen_fileoutput(n_filename, 0);
15764
15765 ret_val = xmlCreateFileParserCtxt(filename);
15766 desret_xmlParserCtxtPtr(ret_val);
15767 call_tests++;
15768 des_fileoutput(n_filename, filename, 0);
15769 xmlResetLastError();
15770 if (mem_base != xmlMemBlocks()) {
15771 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15772 xmlMemBlocks() - mem_base);
15773 test_ret++;
15774 printf(" %d", n_filename);
15775 printf("\n");
15776 }
15777 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015778 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015779
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015780 return(test_ret);
15781}
15782
15783
15784static int
15785test_xmlCreateMemoryParserCtxt(void) {
15786 int test_ret = 0;
15787
15788 int mem_base;
15789 xmlParserCtxtPtr ret_val;
15790 char * buffer; /* a pointer to a char array */
15791 int n_buffer;
15792 int size; /* the size of the array */
15793 int n_size;
15794
15795 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15796 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15797 mem_base = xmlMemBlocks();
15798 buffer = gen_const_char_ptr(n_buffer, 0);
15799 size = gen_int(n_size, 1);
15800
William M. Brackf13f77f2004-11-12 16:03:48 +000015801 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015802 desret_xmlParserCtxtPtr(ret_val);
15803 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015804 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015805 des_int(n_size, size, 1);
15806 xmlResetLastError();
15807 if (mem_base != xmlMemBlocks()) {
15808 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15809 xmlMemBlocks() - mem_base);
15810 test_ret++;
15811 printf(" %d", n_buffer);
15812 printf(" %d", n_size);
15813 printf("\n");
15814 }
15815 }
15816 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015817 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015818
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015819 return(test_ret);
15820}
15821
15822
15823static int
15824test_xmlCreateURLParserCtxt(void) {
15825 int test_ret = 0;
15826
15827 int mem_base;
15828 xmlParserCtxtPtr ret_val;
15829 const char * filename; /* the filename or URL */
15830 int n_filename;
15831 int options; /* a combination of xmlParserOption */
15832 int n_options;
15833
15834 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15835 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15836 mem_base = xmlMemBlocks();
15837 filename = gen_fileoutput(n_filename, 0);
15838 options = gen_int(n_options, 1);
15839
15840 ret_val = xmlCreateURLParserCtxt(filename, options);
15841 desret_xmlParserCtxtPtr(ret_val);
15842 call_tests++;
15843 des_fileoutput(n_filename, filename, 0);
15844 des_int(n_options, options, 1);
15845 xmlResetLastError();
15846 if (mem_base != xmlMemBlocks()) {
15847 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15848 xmlMemBlocks() - mem_base);
15849 test_ret++;
15850 printf(" %d", n_filename);
15851 printf(" %d", n_options);
15852 printf("\n");
15853 }
15854 }
15855 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015856 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015857
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015858 return(test_ret);
15859}
15860
15861
15862static int
15863test_xmlCurrentChar(void) {
15864 int test_ret = 0;
15865
15866 int mem_base;
15867 int ret_val;
15868 xmlParserCtxtPtr ctxt; /* the XML parser context */
15869 int n_ctxt;
15870 int * len; /* pointer to the length of the char read */
15871 int n_len;
15872
15873 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15874 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15875 mem_base = xmlMemBlocks();
15876 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15877 len = gen_int_ptr(n_len, 1);
15878
15879 ret_val = xmlCurrentChar(ctxt, len);
15880 desret_int(ret_val);
15881 call_tests++;
15882 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15883 des_int_ptr(n_len, len, 1);
15884 xmlResetLastError();
15885 if (mem_base != xmlMemBlocks()) {
15886 printf("Leak of %d blocks found in xmlCurrentChar",
15887 xmlMemBlocks() - mem_base);
15888 test_ret++;
15889 printf(" %d", n_ctxt);
15890 printf(" %d", n_len);
15891 printf("\n");
15892 }
15893 }
15894 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015895 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015896
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015897 return(test_ret);
15898}
15899
15900
15901static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015902test_xmlErrMemory(void) {
15903 int test_ret = 0;
15904
15905 int mem_base;
15906 xmlParserCtxtPtr ctxt; /* an XML parser context */
15907 int n_ctxt;
15908 char * extra; /* extra informations */
15909 int n_extra;
15910
15911 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15912 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15913 mem_base = xmlMemBlocks();
15914 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15915 extra = gen_const_char_ptr(n_extra, 1);
15916
William M. Brackf13f77f2004-11-12 16:03:48 +000015917 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015918 call_tests++;
15919 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015920 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015921 xmlResetLastError();
15922 if (mem_base != xmlMemBlocks()) {
15923 printf("Leak of %d blocks found in xmlErrMemory",
15924 xmlMemBlocks() - mem_base);
15925 test_ret++;
15926 printf(" %d", n_ctxt);
15927 printf(" %d", n_extra);
15928 printf("\n");
15929 }
15930 }
15931 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015932 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015933
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015934 return(test_ret);
15935}
15936
15937
15938static int
15939test_xmlIsLetter(void) {
15940 int test_ret = 0;
15941
15942 int mem_base;
15943 int ret_val;
15944 int c; /* an unicode character (int) */
15945 int n_c;
15946
15947 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15948 mem_base = xmlMemBlocks();
15949 c = gen_int(n_c, 0);
15950
15951 ret_val = xmlIsLetter(c);
15952 desret_int(ret_val);
15953 call_tests++;
15954 des_int(n_c, c, 0);
15955 xmlResetLastError();
15956 if (mem_base != xmlMemBlocks()) {
15957 printf("Leak of %d blocks found in xmlIsLetter",
15958 xmlMemBlocks() - mem_base);
15959 test_ret++;
15960 printf(" %d", n_c);
15961 printf("\n");
15962 }
15963 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015964 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015965
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015966 return(test_ret);
15967}
15968
15969
15970static int
15971test_xmlNewEntityInputStream(void) {
15972 int test_ret = 0;
15973
15974 int mem_base;
15975 xmlParserInputPtr ret_val;
15976 xmlParserCtxtPtr ctxt; /* an XML parser context */
15977 int n_ctxt;
15978 xmlEntityPtr entity; /* an Entity pointer */
15979 int n_entity;
15980
15981 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15982 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15983 mem_base = xmlMemBlocks();
15984 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15985 entity = gen_xmlEntityPtr(n_entity, 1);
15986
15987 ret_val = xmlNewEntityInputStream(ctxt, entity);
15988 desret_xmlParserInputPtr(ret_val);
15989 call_tests++;
15990 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15991 des_xmlEntityPtr(n_entity, entity, 1);
15992 xmlResetLastError();
15993 if (mem_base != xmlMemBlocks()) {
15994 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15995 xmlMemBlocks() - mem_base);
15996 test_ret++;
15997 printf(" %d", n_ctxt);
15998 printf(" %d", n_entity);
15999 printf("\n");
16000 }
16001 }
16002 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016003 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016004
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016005 return(test_ret);
16006}
16007
16008
16009static int
16010test_xmlNewInputFromFile(void) {
16011 int test_ret = 0;
16012
16013 int mem_base;
16014 xmlParserInputPtr ret_val;
16015 xmlParserCtxtPtr ctxt; /* an XML parser context */
16016 int n_ctxt;
16017 const char * filename; /* the filename to use as entity */
16018 int n_filename;
16019
16020 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16021 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16022 mem_base = xmlMemBlocks();
16023 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16024 filename = gen_filepath(n_filename, 1);
16025
16026 ret_val = xmlNewInputFromFile(ctxt, filename);
16027 desret_xmlParserInputPtr(ret_val);
16028 call_tests++;
16029 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16030 des_filepath(n_filename, filename, 1);
16031 xmlResetLastError();
16032 if (mem_base != xmlMemBlocks()) {
16033 printf("Leak of %d blocks found in xmlNewInputFromFile",
16034 xmlMemBlocks() - mem_base);
16035 test_ret++;
16036 printf(" %d", n_ctxt);
16037 printf(" %d", n_filename);
16038 printf("\n");
16039 }
16040 }
16041 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016042 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016043
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016044 return(test_ret);
16045}
16046
16047
16048static int
16049test_xmlNewInputStream(void) {
16050 int test_ret = 0;
16051
16052 int mem_base;
16053 xmlParserInputPtr ret_val;
16054 xmlParserCtxtPtr ctxt; /* an XML parser context */
16055 int n_ctxt;
16056
16057 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16058 mem_base = xmlMemBlocks();
16059 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16060
16061 ret_val = xmlNewInputStream(ctxt);
16062 desret_xmlParserInputPtr(ret_val);
16063 call_tests++;
16064 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16065 xmlResetLastError();
16066 if (mem_base != xmlMemBlocks()) {
16067 printf("Leak of %d blocks found in xmlNewInputStream",
16068 xmlMemBlocks() - mem_base);
16069 test_ret++;
16070 printf(" %d", n_ctxt);
16071 printf("\n");
16072 }
16073 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016074 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016075
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016076 return(test_ret);
16077}
16078
16079
16080static int
16081test_xmlNewStringInputStream(void) {
16082 int test_ret = 0;
16083
16084 int mem_base;
16085 xmlParserInputPtr ret_val;
16086 xmlParserCtxtPtr ctxt; /* an XML parser context */
16087 int n_ctxt;
16088 xmlChar * buffer; /* an memory buffer */
16089 int n_buffer;
16090
16091 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16092 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16093 mem_base = xmlMemBlocks();
16094 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16095 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16096
William M. Brackf13f77f2004-11-12 16:03:48 +000016097 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016098 desret_xmlParserInputPtr(ret_val);
16099 call_tests++;
16100 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016101 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016102 xmlResetLastError();
16103 if (mem_base != xmlMemBlocks()) {
16104 printf("Leak of %d blocks found in xmlNewStringInputStream",
16105 xmlMemBlocks() - mem_base);
16106 test_ret++;
16107 printf(" %d", n_ctxt);
16108 printf(" %d", n_buffer);
16109 printf("\n");
16110 }
16111 }
16112 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016113 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016114
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016115 return(test_ret);
16116}
16117
16118
16119static int
16120test_xmlNextChar(void) {
16121 int test_ret = 0;
16122
16123 int mem_base;
16124 xmlParserCtxtPtr ctxt; /* the XML parser context */
16125 int n_ctxt;
16126
16127 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16128 mem_base = xmlMemBlocks();
16129 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16130
16131 xmlNextChar(ctxt);
16132 call_tests++;
16133 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16134 xmlResetLastError();
16135 if (mem_base != xmlMemBlocks()) {
16136 printf("Leak of %d blocks found in xmlNextChar",
16137 xmlMemBlocks() - mem_base);
16138 test_ret++;
16139 printf(" %d", n_ctxt);
16140 printf("\n");
16141 }
16142 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016143 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016144
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016145 return(test_ret);
16146}
16147
16148
16149static int
16150test_xmlParserInputShrink(void) {
16151 int test_ret = 0;
16152
16153 int mem_base;
16154 xmlParserInputPtr in; /* an XML parser input */
16155 int n_in;
16156
16157 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16158 mem_base = xmlMemBlocks();
16159 in = gen_xmlParserInputPtr(n_in, 0);
16160
16161 xmlParserInputShrink(in);
16162 call_tests++;
16163 des_xmlParserInputPtr(n_in, in, 0);
16164 xmlResetLastError();
16165 if (mem_base != xmlMemBlocks()) {
16166 printf("Leak of %d blocks found in xmlParserInputShrink",
16167 xmlMemBlocks() - mem_base);
16168 test_ret++;
16169 printf(" %d", n_in);
16170 printf("\n");
16171 }
16172 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016173 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016174
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016175 return(test_ret);
16176}
16177
16178
16179static int
16180test_xmlPopInput(void) {
16181 int test_ret = 0;
16182
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016183 int mem_base;
16184 xmlChar ret_val;
16185 xmlParserCtxtPtr ctxt; /* an XML parser context */
16186 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016187
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016188 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16189 mem_base = xmlMemBlocks();
16190 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16191
16192 ret_val = xmlPopInput(ctxt);
16193 desret_xmlChar(ret_val);
16194 call_tests++;
16195 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16196 xmlResetLastError();
16197 if (mem_base != xmlMemBlocks()) {
16198 printf("Leak of %d blocks found in xmlPopInput",
16199 xmlMemBlocks() - mem_base);
16200 test_ret++;
16201 printf(" %d", n_ctxt);
16202 printf("\n");
16203 }
16204 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016205 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016206
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016207 return(test_ret);
16208}
16209
16210
16211static int
16212test_xmlPushInput(void) {
16213 int test_ret = 0;
16214
16215 int mem_base;
16216 xmlParserCtxtPtr ctxt; /* an XML parser context */
16217 int n_ctxt;
16218 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16219 int n_input;
16220
16221 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16222 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16223 mem_base = xmlMemBlocks();
16224 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16225 input = gen_xmlParserInputPtr(n_input, 1);
16226
16227 xmlPushInput(ctxt, input);
16228 call_tests++;
16229 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16230 des_xmlParserInputPtr(n_input, input, 1);
16231 xmlResetLastError();
16232 if (mem_base != xmlMemBlocks()) {
16233 printf("Leak of %d blocks found in xmlPushInput",
16234 xmlMemBlocks() - mem_base);
16235 test_ret++;
16236 printf(" %d", n_ctxt);
16237 printf(" %d", n_input);
16238 printf("\n");
16239 }
16240 }
16241 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016243
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016244 return(test_ret);
16245}
16246
16247
16248static int
16249test_xmlSetEntityReferenceFunc(void) {
16250 int test_ret = 0;
16251
16252
16253 /* missing type support */
16254 return(test_ret);
16255}
16256
16257
16258static int
16259test_xmlSplitQName(void) {
16260 int test_ret = 0;
16261
16262 int mem_base;
16263 xmlChar * ret_val;
16264 xmlParserCtxtPtr ctxt; /* an XML parser context */
16265 int n_ctxt;
16266 xmlChar * name; /* an XML parser context */
16267 int n_name;
16268 xmlChar ** prefix; /* a xmlChar ** */
16269 int n_prefix;
16270
16271 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16272 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16273 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16274 mem_base = xmlMemBlocks();
16275 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16276 name = gen_const_xmlChar_ptr(n_name, 1);
16277 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16278
William M. Brackf13f77f2004-11-12 16:03:48 +000016279 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016280 desret_xmlChar_ptr(ret_val);
16281 call_tests++;
16282 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016283 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016284 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16285 xmlResetLastError();
16286 if (mem_base != xmlMemBlocks()) {
16287 printf("Leak of %d blocks found in xmlSplitQName",
16288 xmlMemBlocks() - mem_base);
16289 test_ret++;
16290 printf(" %d", n_ctxt);
16291 printf(" %d", n_name);
16292 printf(" %d", n_prefix);
16293 printf("\n");
16294 }
16295 }
16296 }
16297 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016298 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016299
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016300 return(test_ret);
16301}
16302
16303
16304static int
16305test_xmlStringCurrentChar(void) {
16306 int test_ret = 0;
16307
16308 int mem_base;
16309 int ret_val;
16310 xmlParserCtxtPtr ctxt; /* the XML parser context */
16311 int n_ctxt;
16312 xmlChar * cur; /* pointer to the beginning of the char */
16313 int n_cur;
16314 int * len; /* pointer to the length of the char read */
16315 int n_len;
16316
16317 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16318 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16319 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16320 mem_base = xmlMemBlocks();
16321 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16322 cur = gen_const_xmlChar_ptr(n_cur, 1);
16323 len = gen_int_ptr(n_len, 2);
16324
William M. Brackf13f77f2004-11-12 16:03:48 +000016325 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016326 desret_int(ret_val);
16327 call_tests++;
16328 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016329 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016330 des_int_ptr(n_len, len, 2);
16331 xmlResetLastError();
16332 if (mem_base != xmlMemBlocks()) {
16333 printf("Leak of %d blocks found in xmlStringCurrentChar",
16334 xmlMemBlocks() - mem_base);
16335 test_ret++;
16336 printf(" %d", n_ctxt);
16337 printf(" %d", n_cur);
16338 printf(" %d", n_len);
16339 printf("\n");
16340 }
16341 }
16342 }
16343 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016344 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016345
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016346 return(test_ret);
16347}
16348
16349
16350static int
16351test_xmlStringDecodeEntities(void) {
16352 int test_ret = 0;
16353
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016354 int mem_base;
16355 xmlChar * ret_val;
16356 xmlParserCtxtPtr ctxt; /* the parser context */
16357 int n_ctxt;
16358 xmlChar * str; /* the input string */
16359 int n_str;
16360 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16361 int n_what;
16362 xmlChar end; /* an end marker xmlChar, 0 if none */
16363 int n_end;
16364 xmlChar end2; /* an end marker xmlChar, 0 if none */
16365 int n_end2;
16366 xmlChar end3; /* an end marker xmlChar, 0 if none */
16367 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016368
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016369 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16370 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16371 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16372 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16373 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16374 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16375 mem_base = xmlMemBlocks();
16376 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16377 str = gen_const_xmlChar_ptr(n_str, 1);
16378 what = gen_int(n_what, 2);
16379 end = gen_xmlChar(n_end, 3);
16380 end2 = gen_xmlChar(n_end2, 4);
16381 end3 = gen_xmlChar(n_end3, 5);
16382
William M. Brackf13f77f2004-11-12 16:03:48 +000016383 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016384 desret_xmlChar_ptr(ret_val);
16385 call_tests++;
16386 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016387 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016388 des_int(n_what, what, 2);
16389 des_xmlChar(n_end, end, 3);
16390 des_xmlChar(n_end2, end2, 4);
16391 des_xmlChar(n_end3, end3, 5);
16392 xmlResetLastError();
16393 if (mem_base != xmlMemBlocks()) {
16394 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16395 xmlMemBlocks() - mem_base);
16396 test_ret++;
16397 printf(" %d", n_ctxt);
16398 printf(" %d", n_str);
16399 printf(" %d", n_what);
16400 printf(" %d", n_end);
16401 printf(" %d", n_end2);
16402 printf(" %d", n_end3);
16403 printf("\n");
16404 }
16405 }
16406 }
16407 }
16408 }
16409 }
16410 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016412
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016413 return(test_ret);
16414}
16415
16416
16417static int
16418test_xmlStringLenDecodeEntities(void) {
16419 int test_ret = 0;
16420
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016421 int mem_base;
16422 xmlChar * ret_val;
16423 xmlParserCtxtPtr ctxt; /* the parser context */
16424 int n_ctxt;
16425 xmlChar * str; /* the input string */
16426 int n_str;
16427 int len; /* the string length */
16428 int n_len;
16429 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16430 int n_what;
16431 xmlChar end; /* an end marker xmlChar, 0 if none */
16432 int n_end;
16433 xmlChar end2; /* an end marker xmlChar, 0 if none */
16434 int n_end2;
16435 xmlChar end3; /* an end marker xmlChar, 0 if none */
16436 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016437
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016438 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16439 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16440 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16441 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16442 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16443 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16444 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16445 mem_base = xmlMemBlocks();
16446 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16447 str = gen_const_xmlChar_ptr(n_str, 1);
16448 len = gen_int(n_len, 2);
16449 what = gen_int(n_what, 3);
16450 end = gen_xmlChar(n_end, 4);
16451 end2 = gen_xmlChar(n_end2, 5);
16452 end3 = gen_xmlChar(n_end3, 6);
16453
William M. Brackf13f77f2004-11-12 16:03:48 +000016454 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016455 desret_xmlChar_ptr(ret_val);
16456 call_tests++;
16457 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016458 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016459 des_int(n_len, len, 2);
16460 des_int(n_what, what, 3);
16461 des_xmlChar(n_end, end, 4);
16462 des_xmlChar(n_end2, end2, 5);
16463 des_xmlChar(n_end3, end3, 6);
16464 xmlResetLastError();
16465 if (mem_base != xmlMemBlocks()) {
16466 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16467 xmlMemBlocks() - mem_base);
16468 test_ret++;
16469 printf(" %d", n_ctxt);
16470 printf(" %d", n_str);
16471 printf(" %d", n_len);
16472 printf(" %d", n_what);
16473 printf(" %d", n_end);
16474 printf(" %d", n_end2);
16475 printf(" %d", n_end3);
16476 printf("\n");
16477 }
16478 }
16479 }
16480 }
16481 }
16482 }
16483 }
16484 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016486
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016487 return(test_ret);
16488}
16489
16490
16491static int
16492test_xmlSwitchEncoding(void) {
16493 int test_ret = 0;
16494
16495 int mem_base;
16496 int ret_val;
16497 xmlParserCtxtPtr ctxt; /* the parser context */
16498 int n_ctxt;
16499 xmlCharEncoding enc; /* the encoding value (number) */
16500 int n_enc;
16501
16502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16503 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16504 mem_base = xmlMemBlocks();
16505 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16506 enc = gen_xmlCharEncoding(n_enc, 1);
16507
16508 ret_val = xmlSwitchEncoding(ctxt, enc);
16509 desret_int(ret_val);
16510 call_tests++;
16511 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16512 des_xmlCharEncoding(n_enc, enc, 1);
16513 xmlResetLastError();
16514 if (mem_base != xmlMemBlocks()) {
16515 printf("Leak of %d blocks found in xmlSwitchEncoding",
16516 xmlMemBlocks() - mem_base);
16517 test_ret++;
16518 printf(" %d", n_ctxt);
16519 printf(" %d", n_enc);
16520 printf("\n");
16521 }
16522 }
16523 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016525
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016526 return(test_ret);
16527}
16528
16529
16530static int
16531test_xmlSwitchInputEncoding(void) {
16532 int test_ret = 0;
16533
16534 int mem_base;
16535 int ret_val;
16536 xmlParserCtxtPtr ctxt; /* the parser context */
16537 int n_ctxt;
16538 xmlParserInputPtr input; /* the input stream */
16539 int n_input;
16540 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16541 int n_handler;
16542
16543 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16544 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16545 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16546 mem_base = xmlMemBlocks();
16547 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16548 input = gen_xmlParserInputPtr(n_input, 1);
16549 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16550
16551 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16552 desret_int(ret_val);
16553 call_tests++;
16554 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16555 des_xmlParserInputPtr(n_input, input, 1);
16556 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16557 xmlResetLastError();
16558 if (mem_base != xmlMemBlocks()) {
16559 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16560 xmlMemBlocks() - mem_base);
16561 test_ret++;
16562 printf(" %d", n_ctxt);
16563 printf(" %d", n_input);
16564 printf(" %d", n_handler);
16565 printf("\n");
16566 }
16567 }
16568 }
16569 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016570 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016571
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016572 return(test_ret);
16573}
16574
16575
16576static int
16577test_xmlSwitchToEncoding(void) {
16578 int test_ret = 0;
16579
16580 int mem_base;
16581 int ret_val;
16582 xmlParserCtxtPtr ctxt; /* the parser context */
16583 int n_ctxt;
16584 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16585 int n_handler;
16586
16587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16588 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16589 mem_base = xmlMemBlocks();
16590 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16591 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16592
16593 ret_val = xmlSwitchToEncoding(ctxt, handler);
16594 desret_int(ret_val);
16595 call_tests++;
16596 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16597 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16598 xmlResetLastError();
16599 if (mem_base != xmlMemBlocks()) {
16600 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16601 xmlMemBlocks() - mem_base);
16602 test_ret++;
16603 printf(" %d", n_ctxt);
16604 printf(" %d", n_handler);
16605 printf("\n");
16606 }
16607 }
16608 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016609 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016610
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016611 return(test_ret);
16612}
16613
16614static int
16615test_parserInternals(void) {
16616 int test_ret = 0;
16617
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016618 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016619 test_ret += test_htmlCreateFileParserCtxt();
16620 test_ret += test_htmlInitAutoClose();
16621 test_ret += test_inputPop();
16622 test_ret += test_inputPush();
16623 test_ret += test_namePop();
16624 test_ret += test_namePush();
16625 test_ret += test_nodePop();
16626 test_ret += test_nodePush();
16627 test_ret += test_xmlCheckLanguageID();
16628 test_ret += test_xmlCopyChar();
16629 test_ret += test_xmlCopyCharMultiByte();
16630 test_ret += test_xmlCreateEntityParserCtxt();
16631 test_ret += test_xmlCreateFileParserCtxt();
16632 test_ret += test_xmlCreateMemoryParserCtxt();
16633 test_ret += test_xmlCreateURLParserCtxt();
16634 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016635 test_ret += test_xmlErrMemory();
16636 test_ret += test_xmlIsLetter();
16637 test_ret += test_xmlNewEntityInputStream();
16638 test_ret += test_xmlNewInputFromFile();
16639 test_ret += test_xmlNewInputStream();
16640 test_ret += test_xmlNewStringInputStream();
16641 test_ret += test_xmlNextChar();
16642 test_ret += test_xmlParserInputShrink();
16643 test_ret += test_xmlPopInput();
16644 test_ret += test_xmlPushInput();
16645 test_ret += test_xmlSetEntityReferenceFunc();
16646 test_ret += test_xmlSplitQName();
16647 test_ret += test_xmlStringCurrentChar();
16648 test_ret += test_xmlStringDecodeEntities();
16649 test_ret += test_xmlStringLenDecodeEntities();
16650 test_ret += test_xmlSwitchEncoding();
16651 test_ret += test_xmlSwitchInputEncoding();
16652 test_ret += test_xmlSwitchToEncoding();
16653
16654 if (test_ret != 0)
16655 printf("Module parserInternals: %d errors\n", test_ret);
16656 return(test_ret);
16657}
16658
Daniel Veillardd93f6252004-11-02 15:53:51 +000016659static int
16660test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016662
William M. Brack21e4ef22005-01-02 09:53:13 +000016663#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016664 int mem_base;
16665 int ret_val;
16666 xmlPatternPtr comp; /* the precompiled pattern */
16667 int n_comp;
16668 xmlNodePtr node; /* a node */
16669 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016670
Daniel Veillardce682bc2004-11-05 17:22:25 +000016671 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16672 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16673 mem_base = xmlMemBlocks();
16674 comp = gen_xmlPatternPtr(n_comp, 0);
16675 node = gen_xmlNodePtr(n_node, 1);
16676
16677 ret_val = xmlPatternMatch(comp, node);
16678 desret_int(ret_val);
16679 call_tests++;
16680 des_xmlPatternPtr(n_comp, comp, 0);
16681 des_xmlNodePtr(n_node, node, 1);
16682 xmlResetLastError();
16683 if (mem_base != xmlMemBlocks()) {
16684 printf("Leak of %d blocks found in xmlPatternMatch",
16685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016686 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016687 printf(" %d", n_comp);
16688 printf(" %d", n_node);
16689 printf("\n");
16690 }
16691 }
16692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016693 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016694#endif
16695
Daniel Veillard42595322004-11-08 10:52:06 +000016696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016697}
16698
16699
16700static int
16701test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016703
16704
16705 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016707}
16708
16709static int
16710test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016712
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016713 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016714 test_ret += test_xmlPatternMatch();
16715 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016716
Daniel Veillard42595322004-11-08 10:52:06 +000016717 if (test_ret != 0)
16718 printf("Module pattern: %d errors\n", test_ret);
16719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016720}
Daniel Veillarda521d282004-11-09 14:59:59 +000016721#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016722
Daniel Veillardce682bc2004-11-05 17:22:25 +000016723#define gen_nb_xmlRelaxNGPtr 1
16724static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16725 return(NULL);
16726}
16727static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16728}
Daniel Veillarda521d282004-11-09 14:59:59 +000016729#endif
16730
Daniel Veillardce682bc2004-11-05 17:22:25 +000016731
Daniel Veillardd93f6252004-11-02 15:53:51 +000016732static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016733test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016735
William M. Brack21e4ef22005-01-02 09:53:13 +000016736#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016737 int mem_base;
16738 FILE * output; /* the file output */
16739 int n_output;
16740 xmlRelaxNGPtr schema; /* a schema structure */
16741 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016742
Daniel Veillardce682bc2004-11-05 17:22:25 +000016743 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16744 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16745 mem_base = xmlMemBlocks();
16746 output = gen_FILE_ptr(n_output, 0);
16747 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16748
16749 xmlRelaxNGDump(output, schema);
16750 call_tests++;
16751 des_FILE_ptr(n_output, output, 0);
16752 des_xmlRelaxNGPtr(n_schema, schema, 1);
16753 xmlResetLastError();
16754 if (mem_base != xmlMemBlocks()) {
16755 printf("Leak of %d blocks found in xmlRelaxNGDump",
16756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016757 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016758 printf(" %d", n_output);
16759 printf(" %d", n_schema);
16760 printf("\n");
16761 }
16762 }
16763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016764 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016765#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016766
Daniel Veillard42595322004-11-08 10:52:06 +000016767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016768}
16769
16770
16771static int
16772test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016774
William M. Brack21e4ef22005-01-02 09:53:13 +000016775#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016776 int mem_base;
16777 FILE * output; /* the file output */
16778 int n_output;
16779 xmlRelaxNGPtr schema; /* a schema structure */
16780 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016781
Daniel Veillardce682bc2004-11-05 17:22:25 +000016782 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16783 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16784 mem_base = xmlMemBlocks();
16785 output = gen_FILE_ptr(n_output, 0);
16786 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16787
16788 xmlRelaxNGDumpTree(output, schema);
16789 call_tests++;
16790 des_FILE_ptr(n_output, output, 0);
16791 des_xmlRelaxNGPtr(n_schema, schema, 1);
16792 xmlResetLastError();
16793 if (mem_base != xmlMemBlocks()) {
16794 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016796 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016797 printf(" %d", n_output);
16798 printf(" %d", n_schema);
16799 printf("\n");
16800 }
16801 }
16802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016803 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016804#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016805
Daniel Veillard42595322004-11-08 10:52:06 +000016806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016807}
16808
Daniel Veillarda521d282004-11-09 14:59:59 +000016809#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016810
Daniel Veillardce682bc2004-11-05 17:22:25 +000016811#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16812static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16813 return(NULL);
16814}
16815static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16816}
Daniel Veillarda521d282004-11-09 14:59:59 +000016817#endif
16818
16819#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016820
16821#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16822static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16823 return(NULL);
16824}
16825static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16826}
Daniel Veillarda521d282004-11-09 14:59:59 +000016827#endif
16828
16829#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016830
16831#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16832static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16833 return(NULL);
16834}
16835static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16836}
Daniel Veillarda521d282004-11-09 14:59:59 +000016837#endif
16838
16839#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016840
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016841#define gen_nb_void_ptr_ptr 1
16842static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16843 return(NULL);
16844}
16845static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16846}
Daniel Veillarda521d282004-11-09 14:59:59 +000016847#endif
16848
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016849
Daniel Veillardd93f6252004-11-02 15:53:51 +000016850static int
16851test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016853
William M. Brack21e4ef22005-01-02 09:53:13 +000016854#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016855 int mem_base;
16856 int ret_val;
16857 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16858 int n_ctxt;
16859 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16860 int n_err;
16861 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16862 int n_warn;
16863 void ** ctx; /* contextual data for the callbacks result */
16864 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016865
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016866 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16867 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16868 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16869 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16870 mem_base = xmlMemBlocks();
16871 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16872 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16873 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16874 ctx = gen_void_ptr_ptr(n_ctx, 3);
16875
16876 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16877 desret_int(ret_val);
16878 call_tests++;
16879 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16880 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16881 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16882 des_void_ptr_ptr(n_ctx, ctx, 3);
16883 xmlResetLastError();
16884 if (mem_base != xmlMemBlocks()) {
16885 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016887 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016888 printf(" %d", n_ctxt);
16889 printf(" %d", n_err);
16890 printf(" %d", n_warn);
16891 printf(" %d", n_ctx);
16892 printf("\n");
16893 }
16894 }
16895 }
16896 }
16897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016898 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016899#endif
16900
Daniel Veillard42595322004-11-08 10:52:06 +000016901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016902}
16903
Daniel Veillarda521d282004-11-09 14:59:59 +000016904#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016905
Daniel Veillardce682bc2004-11-05 17:22:25 +000016906#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16907static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16908 return(NULL);
16909}
16910static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16911}
Daniel Veillarda521d282004-11-09 14:59:59 +000016912#endif
16913
Daniel Veillardce682bc2004-11-05 17:22:25 +000016914
Daniel Veillardd93f6252004-11-02 15:53:51 +000016915static int
16916test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016918
William M. Brack21e4ef22005-01-02 09:53:13 +000016919#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016920 int mem_base;
16921 int ret_val;
16922 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16923 int n_ctxt;
16924 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16925 int n_err;
16926 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16927 int n_warn;
16928 void ** ctx; /* the functions context result */
16929 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016930
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016931 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16932 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16933 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16934 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16935 mem_base = xmlMemBlocks();
16936 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16937 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16938 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16939 ctx = gen_void_ptr_ptr(n_ctx, 3);
16940
16941 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16942 desret_int(ret_val);
16943 call_tests++;
16944 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16945 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16946 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16947 des_void_ptr_ptr(n_ctx, ctx, 3);
16948 xmlResetLastError();
16949 if (mem_base != xmlMemBlocks()) {
16950 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016952 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016953 printf(" %d", n_ctxt);
16954 printf(" %d", n_err);
16955 printf(" %d", n_warn);
16956 printf(" %d", n_ctx);
16957 printf("\n");
16958 }
16959 }
16960 }
16961 }
16962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016963 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016964#endif
16965
Daniel Veillard42595322004-11-08 10:52:06 +000016966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016967}
16968
16969
16970static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016971test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016972 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016973
William M. Brack21e4ef22005-01-02 09:53:13 +000016974#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000016975 int mem_base;
16976 int ret_val;
16977
16978 mem_base = xmlMemBlocks();
16979
16980 ret_val = xmlRelaxNGInitTypes();
16981 desret_int(ret_val);
16982 call_tests++;
16983 xmlResetLastError();
16984 if (mem_base != xmlMemBlocks()) {
16985 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016987 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016988 printf("\n");
16989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016990 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016991#endif
16992
Daniel Veillard42595322004-11-08 10:52:06 +000016993 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016994}
16995
16996
16997static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016998test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017000
William M. Brack21e4ef22005-01-02 09:53:13 +000017001#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017002 int mem_base;
17003 xmlRelaxNGParserCtxtPtr ret_val;
17004 xmlDocPtr doc; /* a preparsed document tree */
17005 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017006
Daniel Veillard42595322004-11-08 10:52:06 +000017007 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17008 mem_base = xmlMemBlocks();
17009 doc = gen_xmlDocPtr(n_doc, 0);
17010
17011 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17012 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17013 call_tests++;
17014 des_xmlDocPtr(n_doc, doc, 0);
17015 xmlResetLastError();
17016 if (mem_base != xmlMemBlocks()) {
17017 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17018 xmlMemBlocks() - mem_base);
17019 test_ret++;
17020 printf(" %d", n_doc);
17021 printf("\n");
17022 }
17023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017024 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017025#endif
17026
Daniel Veillard42595322004-11-08 10:52:06 +000017027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017028}
17029
17030
17031static int
17032test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017034
William M. Brack21e4ef22005-01-02 09:53:13 +000017035#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017036 int mem_base;
17037 xmlRelaxNGParserCtxtPtr ret_val;
17038 char * buffer; /* a pointer to a char array containing the schemas */
17039 int n_buffer;
17040 int size; /* the size of the array */
17041 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017042
Daniel Veillard42595322004-11-08 10:52:06 +000017043 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17044 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17045 mem_base = xmlMemBlocks();
17046 buffer = gen_const_char_ptr(n_buffer, 0);
17047 size = gen_int(n_size, 1);
17048
William M. Brackf13f77f2004-11-12 16:03:48 +000017049 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017050 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17051 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017052 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017053 des_int(n_size, size, 1);
17054 xmlResetLastError();
17055 if (mem_base != xmlMemBlocks()) {
17056 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17057 xmlMemBlocks() - mem_base);
17058 test_ret++;
17059 printf(" %d", n_buffer);
17060 printf(" %d", n_size);
17061 printf("\n");
17062 }
17063 }
17064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017065 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017066#endif
17067
Daniel Veillard42595322004-11-08 10:52:06 +000017068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017069}
17070
17071
17072static int
17073test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017075
William M. Brack21e4ef22005-01-02 09:53:13 +000017076#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017077 int mem_base;
17078 xmlRelaxNGParserCtxtPtr ret_val;
17079 char * URL; /* the location of the schema */
17080 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017081
Daniel Veillard42595322004-11-08 10:52:06 +000017082 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17083 mem_base = xmlMemBlocks();
17084 URL = gen_const_char_ptr(n_URL, 0);
17085
William M. Brackf13f77f2004-11-12 16:03:48 +000017086 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017087 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17088 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017089 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017090 xmlResetLastError();
17091 if (mem_base != xmlMemBlocks()) {
17092 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17093 xmlMemBlocks() - mem_base);
17094 test_ret++;
17095 printf(" %d", n_URL);
17096 printf("\n");
17097 }
17098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017099 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017100#endif
17101
Daniel Veillard42595322004-11-08 10:52:06 +000017102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017103}
17104
17105
17106static int
17107test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017109
17110
17111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017113}
17114
17115
17116static int
17117test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017119
17120
17121 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017123}
17124
17125
17126static int
17127test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017129
17130
17131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017133}
17134
17135
17136static int
17137test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017139
17140
17141 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017143}
17144
17145
17146static int
17147test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017149
William M. Brack21e4ef22005-01-02 09:53:13 +000017150#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017151 int mem_base;
17152 int ret_val;
17153 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17154 int n_ctxt;
17155 xmlDocPtr doc; /* a parsed document tree */
17156 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017157
Daniel Veillardce682bc2004-11-05 17:22:25 +000017158 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17159 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17160 mem_base = xmlMemBlocks();
17161 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17162 doc = gen_xmlDocPtr(n_doc, 1);
17163
17164 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17165 desret_int(ret_val);
17166 call_tests++;
17167 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17168 des_xmlDocPtr(n_doc, doc, 1);
17169 xmlResetLastError();
17170 if (mem_base != xmlMemBlocks()) {
17171 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017173 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017174 printf(" %d", n_ctxt);
17175 printf(" %d", n_doc);
17176 printf("\n");
17177 }
17178 }
17179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017180 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017181#endif
17182
Daniel Veillard42595322004-11-08 10:52:06 +000017183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017184}
17185
17186
17187static int
17188test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017190
William M. Brack21e4ef22005-01-02 09:53:13 +000017191#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017192 int mem_base;
17193 int ret_val;
17194 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17195 int n_ctxt;
17196 xmlDocPtr doc; /* a document instance */
17197 int n_doc;
17198 xmlNodePtr elem; /* an element instance */
17199 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017200
Daniel Veillardce682bc2004-11-05 17:22:25 +000017201 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17203 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17204 mem_base = xmlMemBlocks();
17205 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17206 doc = gen_xmlDocPtr(n_doc, 1);
17207 elem = gen_xmlNodePtr(n_elem, 2);
17208
17209 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17210 desret_int(ret_val);
17211 call_tests++;
17212 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17213 des_xmlDocPtr(n_doc, doc, 1);
17214 des_xmlNodePtr(n_elem, elem, 2);
17215 xmlResetLastError();
17216 if (mem_base != xmlMemBlocks()) {
17217 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017219 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017220 printf(" %d", n_ctxt);
17221 printf(" %d", n_doc);
17222 printf(" %d", n_elem);
17223 printf("\n");
17224 }
17225 }
17226 }
17227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017228 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017229#endif
17230
Daniel Veillard42595322004-11-08 10:52:06 +000017231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017232}
17233
17234
17235static int
17236test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017238
William M. Brack21e4ef22005-01-02 09:53:13 +000017239#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017240 int mem_base;
17241 int ret_val;
17242 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17243 int n_ctxt;
17244 xmlDocPtr doc; /* a document instance */
17245 int n_doc;
17246 xmlNodePtr elem; /* an element instance */
17247 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017248
Daniel Veillardce682bc2004-11-05 17:22:25 +000017249 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17250 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17251 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17252 mem_base = xmlMemBlocks();
17253 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17254 doc = gen_xmlDocPtr(n_doc, 1);
17255 elem = gen_xmlNodePtr(n_elem, 2);
17256
17257 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17258 desret_int(ret_val);
17259 call_tests++;
17260 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17261 des_xmlDocPtr(n_doc, doc, 1);
17262 des_xmlNodePtr(n_elem, elem, 2);
17263 xmlResetLastError();
17264 if (mem_base != xmlMemBlocks()) {
17265 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017267 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017268 printf(" %d", n_ctxt);
17269 printf(" %d", n_doc);
17270 printf(" %d", n_elem);
17271 printf("\n");
17272 }
17273 }
17274 }
17275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017276 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017277#endif
17278
Daniel Veillard42595322004-11-08 10:52:06 +000017279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017280}
17281
17282
17283static int
17284test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017286
William M. Brack21e4ef22005-01-02 09:53:13 +000017287#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017288 int mem_base;
17289 int ret_val;
17290 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17291 int n_ctxt;
17292 xmlChar * data; /* some character data read */
17293 int n_data;
17294 int len; /* the lenght of the data */
17295 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017296
Daniel Veillardce682bc2004-11-05 17:22:25 +000017297 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17298 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17299 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17300 mem_base = xmlMemBlocks();
17301 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17302 data = gen_const_xmlChar_ptr(n_data, 1);
17303 len = gen_int(n_len, 2);
17304
William M. Brackf13f77f2004-11-12 16:03:48 +000017305 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017306 desret_int(ret_val);
17307 call_tests++;
17308 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017309 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017310 des_int(n_len, len, 2);
17311 xmlResetLastError();
17312 if (mem_base != xmlMemBlocks()) {
17313 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017315 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017316 printf(" %d", n_ctxt);
17317 printf(" %d", n_data);
17318 printf(" %d", n_len);
17319 printf("\n");
17320 }
17321 }
17322 }
17323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017324 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017325#endif
17326
Daniel Veillard42595322004-11-08 10:52:06 +000017327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017328}
17329
17330
17331static int
17332test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017334
William M. Brack21e4ef22005-01-02 09:53:13 +000017335#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017336 int mem_base;
17337 int ret_val;
17338 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17339 int n_ctxt;
17340 xmlDocPtr doc; /* a document instance */
17341 int n_doc;
17342 xmlNodePtr elem; /* an element instance */
17343 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017344
Daniel Veillardce682bc2004-11-05 17:22:25 +000017345 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17346 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17347 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17348 mem_base = xmlMemBlocks();
17349 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17350 doc = gen_xmlDocPtr(n_doc, 1);
17351 elem = gen_xmlNodePtr(n_elem, 2);
17352
17353 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17354 desret_int(ret_val);
17355 call_tests++;
17356 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17357 des_xmlDocPtr(n_doc, doc, 1);
17358 des_xmlNodePtr(n_elem, elem, 2);
17359 xmlResetLastError();
17360 if (mem_base != xmlMemBlocks()) {
17361 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017363 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017364 printf(" %d", n_ctxt);
17365 printf(" %d", n_doc);
17366 printf(" %d", n_elem);
17367 printf("\n");
17368 }
17369 }
17370 }
17371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017372 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017373#endif
17374
Daniel Veillard42595322004-11-08 10:52:06 +000017375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017376}
17377
17378
17379static int
17380test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017382
William M. Brack21e4ef22005-01-02 09:53:13 +000017383#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017384 int mem_base;
17385 int ret_val;
17386 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17387 int n_ctxt;
17388 int flags; /* a set of flags values */
17389 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017390
Daniel Veillardce682bc2004-11-05 17:22:25 +000017391 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17392 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17393 mem_base = xmlMemBlocks();
17394 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17395 flags = gen_int(n_flags, 1);
17396
17397 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17398 desret_int(ret_val);
17399 call_tests++;
17400 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17401 des_int(n_flags, flags, 1);
17402 xmlResetLastError();
17403 if (mem_base != xmlMemBlocks()) {
17404 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017406 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017407 printf(" %d", n_ctxt);
17408 printf(" %d", n_flags);
17409 printf("\n");
17410 }
17411 }
17412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017413 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017414#endif
17415
Daniel Veillard42595322004-11-08 10:52:06 +000017416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017417}
17418
17419static int
17420test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017422
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017423 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017424 test_ret += test_xmlRelaxNGDump();
17425 test_ret += test_xmlRelaxNGDumpTree();
17426 test_ret += test_xmlRelaxNGGetParserErrors();
17427 test_ret += test_xmlRelaxNGGetValidErrors();
17428 test_ret += test_xmlRelaxNGInitTypes();
17429 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17430 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17431 test_ret += test_xmlRelaxNGNewParserCtxt();
17432 test_ret += test_xmlRelaxNGNewValidCtxt();
17433 test_ret += test_xmlRelaxNGParse();
17434 test_ret += test_xmlRelaxNGSetParserErrors();
17435 test_ret += test_xmlRelaxNGSetValidErrors();
17436 test_ret += test_xmlRelaxNGValidateDoc();
17437 test_ret += test_xmlRelaxNGValidateFullElement();
17438 test_ret += test_xmlRelaxNGValidatePopElement();
17439 test_ret += test_xmlRelaxNGValidatePushCData();
17440 test_ret += test_xmlRelaxNGValidatePushElement();
17441 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017442
Daniel Veillard42595322004-11-08 10:52:06 +000017443 if (test_ret != 0)
17444 printf("Module relaxng: %d errors\n", test_ret);
17445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017446}
17447static int
17448test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017450
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017451 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017452
Daniel Veillard42595322004-11-08 10:52:06 +000017453 if (test_ret != 0)
17454 printf("Module schemasInternals: %d errors\n", test_ret);
17455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017456}
17457
17458static int
17459test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017461
17462 int mem_base;
17463 xmlNodePtr ret_val;
17464 xmlNodePtr parent; /* the parent node */
17465 int n_parent;
17466 xmlNodePtr cur; /* the child node */
17467 int n_cur;
17468
Daniel Veillarda03e3652004-11-02 18:45:30 +000017469 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017470 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017472 parent = gen_xmlNodePtr(n_parent, 0);
17473 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017474
17475 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017476 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017477 desret_xmlNodePtr(ret_val);
17478 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017479 des_xmlNodePtr(n_parent, parent, 0);
17480 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017481 xmlResetLastError();
17482 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017483 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017485 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017486 printf(" %d", n_parent);
17487 printf(" %d", n_cur);
17488 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017489 }
17490 }
17491 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017493
Daniel Veillard42595322004-11-08 10:52:06 +000017494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017495}
17496
17497
17498static int
17499test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017501
17502 int mem_base;
17503 xmlNodePtr ret_val;
17504 xmlNodePtr parent; /* the parent node */
17505 int n_parent;
17506 xmlNodePtr cur; /* the first node in the list */
17507 int n_cur;
17508
Daniel Veillarda03e3652004-11-02 18:45:30 +000017509 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017510 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017512 parent = gen_xmlNodePtr(n_parent, 0);
17513 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017514
17515 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017516 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017517 desret_xmlNodePtr(ret_val);
17518 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017519 des_xmlNodePtr(n_parent, parent, 0);
17520 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017521 xmlResetLastError();
17522 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017523 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017525 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017526 printf(" %d", n_parent);
17527 printf(" %d", n_cur);
17528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017529 }
17530 }
17531 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017532 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017533
Daniel Veillard42595322004-11-08 10:52:06 +000017534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017535}
17536
17537
17538static int
17539test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017541
17542 int mem_base;
17543 xmlNodePtr ret_val;
17544 xmlNodePtr cur; /* the child node */
17545 int n_cur;
17546 xmlNodePtr elem; /* the new node */
17547 int n_elem;
17548
17549 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017550 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017551 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017552 cur = gen_xmlNodePtr(n_cur, 0);
17553 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017554
17555 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017556 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017557 desret_xmlNodePtr(ret_val);
17558 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017559 des_xmlNodePtr(n_cur, cur, 0);
17560 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017561 xmlResetLastError();
17562 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017563 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017565 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017566 printf(" %d", n_cur);
17567 printf(" %d", n_elem);
17568 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017569 }
17570 }
17571 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017573
Daniel Veillard42595322004-11-08 10:52:06 +000017574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017575}
17576
17577
17578static int
17579test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017581
William M. Brack21e4ef22005-01-02 09:53:13 +000017582#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017583 int mem_base;
17584 xmlNodePtr ret_val;
17585 xmlNodePtr cur; /* the child node */
17586 int n_cur;
17587 xmlNodePtr elem; /* the new node */
17588 int n_elem;
17589
17590 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017591 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017592 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017593 cur = gen_xmlNodePtr(n_cur, 0);
17594 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017595
17596 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017597 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017598 desret_xmlNodePtr(ret_val);
17599 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017600 des_xmlNodePtr(n_cur, cur, 0);
17601 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017602 xmlResetLastError();
17603 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017604 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017606 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017607 printf(" %d", n_cur);
17608 printf(" %d", n_elem);
17609 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017610 }
17611 }
17612 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017613 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017614#endif
17615
Daniel Veillard42595322004-11-08 10:52:06 +000017616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017617}
17618
17619
17620static int
17621test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017623
17624 int mem_base;
17625 xmlNodePtr ret_val;
17626 xmlNodePtr cur; /* the child node */
17627 int n_cur;
17628 xmlNodePtr elem; /* the new node */
17629 int n_elem;
17630
17631 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017632 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017634 cur = gen_xmlNodePtr(n_cur, 0);
17635 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017636
17637 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017638 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017639 desret_xmlNodePtr(ret_val);
17640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017641 des_xmlNodePtr(n_cur, cur, 0);
17642 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017643 xmlResetLastError();
17644 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017645 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017647 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017648 printf(" %d", n_cur);
17649 printf(" %d", n_elem);
17650 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017651 }
17652 }
17653 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017655
Daniel Veillard42595322004-11-08 10:52:06 +000017656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017657}
17658
17659
17660static int
17661test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017663
William M. Brack21e4ef22005-01-02 09:53:13 +000017664#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017665#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017666 int mem_base;
17667 xmlBufferPtr buf; /* the XML buffer output */
17668 int n_buf;
17669 xmlDocPtr doc; /* the document */
17670 int n_doc;
17671 xmlAttrPtr attr; /* the attribute node */
17672 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017673 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017674 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017675
Daniel Veillardce244ad2004-11-05 10:03:46 +000017676 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17677 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17678 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17679 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17680 mem_base = xmlMemBlocks();
17681 buf = gen_xmlBufferPtr(n_buf, 0);
17682 doc = gen_xmlDocPtr(n_doc, 1);
17683 attr = gen_xmlAttrPtr(n_attr, 2);
17684 string = gen_const_xmlChar_ptr(n_string, 3);
17685
William M. Brackf13f77f2004-11-12 16:03:48 +000017686 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017687 call_tests++;
17688 des_xmlBufferPtr(n_buf, buf, 0);
17689 des_xmlDocPtr(n_doc, doc, 1);
17690 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017691 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017692 xmlResetLastError();
17693 if (mem_base != xmlMemBlocks()) {
17694 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017696 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017697 printf(" %d", n_buf);
17698 printf(" %d", n_doc);
17699 printf(" %d", n_attr);
17700 printf(" %d", n_string);
17701 printf("\n");
17702 }
17703 }
17704 }
17705 }
17706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017707 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017708#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017709#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017710
Daniel Veillard42595322004-11-08 10:52:06 +000017711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017712}
17713
17714
17715static int
17716test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017718
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017719 int mem_base;
17720 int ret_val;
17721 xmlBufferPtr buf; /* the buffer to dump */
17722 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017723 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017724 int n_str;
17725 int len; /* the number of #xmlChar to add */
17726 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017727
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017728 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17729 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17730 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017732 buf = gen_xmlBufferPtr(n_buf, 0);
17733 str = gen_const_xmlChar_ptr(n_str, 1);
17734 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017735
William M. Brackf13f77f2004-11-12 16:03:48 +000017736 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017737 desret_int(ret_val);
17738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017739 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017740 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017741 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017742 xmlResetLastError();
17743 if (mem_base != xmlMemBlocks()) {
17744 printf("Leak of %d blocks found in xmlBufferAdd",
17745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017746 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017747 printf(" %d", n_buf);
17748 printf(" %d", n_str);
17749 printf(" %d", n_len);
17750 printf("\n");
17751 }
17752 }
17753 }
17754 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017755 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017756
Daniel Veillard42595322004-11-08 10:52:06 +000017757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017758}
17759
17760
17761static int
17762test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017764
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017765 int mem_base;
17766 int ret_val;
17767 xmlBufferPtr buf; /* the buffer */
17768 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017769 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017770 int n_str;
17771 int len; /* the number of #xmlChar to add */
17772 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017773
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017774 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17775 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17776 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17777 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017778 buf = gen_xmlBufferPtr(n_buf, 0);
17779 str = gen_const_xmlChar_ptr(n_str, 1);
17780 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017781
William M. Brackf13f77f2004-11-12 16:03:48 +000017782 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017783 desret_int(ret_val);
17784 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017785 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017786 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017787 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017788 xmlResetLastError();
17789 if (mem_base != xmlMemBlocks()) {
17790 printf("Leak of %d blocks found in xmlBufferAddHead",
17791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017792 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017793 printf(" %d", n_buf);
17794 printf(" %d", n_str);
17795 printf(" %d", n_len);
17796 printf("\n");
17797 }
17798 }
17799 }
17800 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017801 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017802
Daniel Veillard42595322004-11-08 10:52:06 +000017803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017804}
17805
17806
17807static int
17808test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017810
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017811 int mem_base;
17812 int ret_val;
17813 xmlBufferPtr buf; /* the buffer to dump */
17814 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017815 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017816 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017817
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017818 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17819 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17820 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017821 buf = gen_xmlBufferPtr(n_buf, 0);
17822 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017823
William M. Brackf13f77f2004-11-12 16:03:48 +000017824 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017825 desret_int(ret_val);
17826 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017827 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017828 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017829 xmlResetLastError();
17830 if (mem_base != xmlMemBlocks()) {
17831 printf("Leak of %d blocks found in xmlBufferCCat",
17832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017833 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017834 printf(" %d", n_buf);
17835 printf(" %d", n_str);
17836 printf("\n");
17837 }
17838 }
17839 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017840 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017841
Daniel Veillard42595322004-11-08 10:52:06 +000017842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017843}
17844
17845
17846static int
17847test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017849
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017850 int mem_base;
17851 int ret_val;
17852 xmlBufferPtr buf; /* the buffer to add to */
17853 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017854 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017855 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017856
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017857 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17858 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017860 buf = gen_xmlBufferPtr(n_buf, 0);
17861 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017862
William M. Brackf13f77f2004-11-12 16:03:48 +000017863 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017864 desret_int(ret_val);
17865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017866 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017867 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017868 xmlResetLastError();
17869 if (mem_base != xmlMemBlocks()) {
17870 printf("Leak of %d blocks found in xmlBufferCat",
17871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017872 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017873 printf(" %d", n_buf);
17874 printf(" %d", n_str);
17875 printf("\n");
17876 }
17877 }
17878 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017879 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017880
Daniel Veillard42595322004-11-08 10:52:06 +000017881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017882}
17883
17884
Daniel Veillardce682bc2004-11-05 17:22:25 +000017885#define gen_nb_const_xmlBufferPtr 1
17886static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17887 return(NULL);
17888}
17889static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17890}
17891
Daniel Veillardd93f6252004-11-02 15:53:51 +000017892static int
17893test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017895
Daniel Veillardce682bc2004-11-05 17:22:25 +000017896 int mem_base;
17897 const xmlChar * ret_val;
17898 xmlBufferPtr buf; /* the buffer */
17899 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017900
Daniel Veillardce682bc2004-11-05 17:22:25 +000017901 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17902 mem_base = xmlMemBlocks();
17903 buf = gen_const_xmlBufferPtr(n_buf, 0);
17904
William M. Brackf13f77f2004-11-12 16:03:48 +000017905 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017906 desret_const_xmlChar_ptr(ret_val);
17907 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017908 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017909 xmlResetLastError();
17910 if (mem_base != xmlMemBlocks()) {
17911 printf("Leak of %d blocks found in xmlBufferContent",
17912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017913 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017914 printf(" %d", n_buf);
17915 printf("\n");
17916 }
17917 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000017918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017919
Daniel Veillard42595322004-11-08 10:52:06 +000017920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017921}
17922
17923
17924static int
17925test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017927
Daniel Veillard3d95c732004-11-06 22:25:14 +000017928 int mem_base;
17929 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017930
Daniel Veillard3d95c732004-11-06 22:25:14 +000017931 mem_base = xmlMemBlocks();
17932
17933 ret_val = xmlBufferCreate();
17934 desret_xmlBufferPtr(ret_val);
17935 call_tests++;
17936 xmlResetLastError();
17937 if (mem_base != xmlMemBlocks()) {
17938 printf("Leak of %d blocks found in xmlBufferCreate",
17939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017940 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017941 printf("\n");
17942 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000017943 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017944
Daniel Veillard42595322004-11-08 10:52:06 +000017945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017946}
17947
17948
17949static int
17950test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017952
17953
17954 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017956}
17957
17958
17959static int
17960test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017962
17963
17964 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017966}
17967
17968
17969static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017970test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017972
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017973 int mem_base;
17974 xmlBufferPtr buf; /* the buffer */
17975 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017976
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017977 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17978 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017979 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017980
17981 xmlBufferEmpty(buf);
17982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017983 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017984 xmlResetLastError();
17985 if (mem_base != xmlMemBlocks()) {
17986 printf("Leak of %d blocks found in xmlBufferEmpty",
17987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017988 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017989 printf(" %d", n_buf);
17990 printf("\n");
17991 }
17992 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017993 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017994
Daniel Veillard42595322004-11-08 10:52:06 +000017995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017996}
17997
17998
17999static int
18000test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018002
Daniel Veillard3d97e662004-11-04 10:49:00 +000018003 int mem_base;
18004 int ret_val;
18005 xmlBufferPtr buf; /* the buffer */
18006 int n_buf;
18007 unsigned int len; /* the minimum free size to allocate */
18008 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018009
Daniel Veillard3d97e662004-11-04 10:49:00 +000018010 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18011 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18012 mem_base = xmlMemBlocks();
18013 buf = gen_xmlBufferPtr(n_buf, 0);
18014 len = gen_unsigned_int(n_len, 1);
18015
18016 ret_val = xmlBufferGrow(buf, len);
18017 desret_int(ret_val);
18018 call_tests++;
18019 des_xmlBufferPtr(n_buf, buf, 0);
18020 des_unsigned_int(n_len, len, 1);
18021 xmlResetLastError();
18022 if (mem_base != xmlMemBlocks()) {
18023 printf("Leak of %d blocks found in xmlBufferGrow",
18024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018025 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018026 printf(" %d", n_buf);
18027 printf(" %d", n_len);
18028 printf("\n");
18029 }
18030 }
18031 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018033
Daniel Veillard42595322004-11-08 10:52:06 +000018034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018035}
18036
18037
18038static int
18039test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018041
Daniel Veillardce682bc2004-11-05 17:22:25 +000018042 int mem_base;
18043 int ret_val;
18044 xmlBufferPtr buf; /* the buffer */
18045 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018046
Daniel Veillardce682bc2004-11-05 17:22:25 +000018047 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18048 mem_base = xmlMemBlocks();
18049 buf = gen_const_xmlBufferPtr(n_buf, 0);
18050
William M. Brackf13f77f2004-11-12 16:03:48 +000018051 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018052 desret_int(ret_val);
18053 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018054 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018055 xmlResetLastError();
18056 if (mem_base != xmlMemBlocks()) {
18057 printf("Leak of %d blocks found in xmlBufferLength",
18058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018059 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018060 printf(" %d", n_buf);
18061 printf("\n");
18062 }
18063 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018065
Daniel Veillard42595322004-11-08 10:52:06 +000018066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018067}
18068
18069
18070static int
18071test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018073
Daniel Veillard3d97e662004-11-04 10:49:00 +000018074 int mem_base;
18075 int ret_val;
18076 xmlBufferPtr buf; /* the buffer to resize */
18077 int n_buf;
18078 unsigned int size; /* the desired size */
18079 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018080
Daniel Veillard3d97e662004-11-04 10:49:00 +000018081 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18082 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18083 mem_base = xmlMemBlocks();
18084 buf = gen_xmlBufferPtr(n_buf, 0);
18085 size = gen_unsigned_int(n_size, 1);
18086
18087 ret_val = xmlBufferResize(buf, size);
18088 desret_int(ret_val);
18089 call_tests++;
18090 des_xmlBufferPtr(n_buf, buf, 0);
18091 des_unsigned_int(n_size, size, 1);
18092 xmlResetLastError();
18093 if (mem_base != xmlMemBlocks()) {
18094 printf("Leak of %d blocks found in xmlBufferResize",
18095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018096 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018097 printf(" %d", n_buf);
18098 printf(" %d", n_size);
18099 printf("\n");
18100 }
18101 }
18102 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018103 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018104
Daniel Veillard42595322004-11-08 10:52:06 +000018105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018106}
18107
18108
18109static int
18110test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018112
Daniel Veillard57b25162004-11-06 14:50:18 +000018113 int mem_base;
18114 xmlBufferPtr buf; /* the buffer to tune */
18115 int n_buf;
18116 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18117 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018118
Daniel Veillard57b25162004-11-06 14:50:18 +000018119 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18120 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18121 mem_base = xmlMemBlocks();
18122 buf = gen_xmlBufferPtr(n_buf, 0);
18123 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18124
18125 xmlBufferSetAllocationScheme(buf, scheme);
18126 call_tests++;
18127 des_xmlBufferPtr(n_buf, buf, 0);
18128 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18129 xmlResetLastError();
18130 if (mem_base != xmlMemBlocks()) {
18131 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018133 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018134 printf(" %d", n_buf);
18135 printf(" %d", n_scheme);
18136 printf("\n");
18137 }
18138 }
18139 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018141
Daniel Veillard42595322004-11-08 10:52:06 +000018142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018143}
18144
18145
18146static int
18147test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018149
Daniel Veillard3d97e662004-11-04 10:49:00 +000018150 int mem_base;
18151 int ret_val;
18152 xmlBufferPtr buf; /* the buffer to dump */
18153 int n_buf;
18154 unsigned int len; /* the number of xmlChar to remove */
18155 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018156
Daniel Veillard3d97e662004-11-04 10:49:00 +000018157 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18158 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18159 mem_base = xmlMemBlocks();
18160 buf = gen_xmlBufferPtr(n_buf, 0);
18161 len = gen_unsigned_int(n_len, 1);
18162
18163 ret_val = xmlBufferShrink(buf, len);
18164 desret_int(ret_val);
18165 call_tests++;
18166 des_xmlBufferPtr(n_buf, buf, 0);
18167 des_unsigned_int(n_len, len, 1);
18168 xmlResetLastError();
18169 if (mem_base != xmlMemBlocks()) {
18170 printf("Leak of %d blocks found in xmlBufferShrink",
18171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018172 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018173 printf(" %d", n_buf);
18174 printf(" %d", n_len);
18175 printf("\n");
18176 }
18177 }
18178 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018180
Daniel Veillard42595322004-11-08 10:52:06 +000018181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018182}
18183
18184
18185static int
18186test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018188
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018189 int mem_base;
18190 xmlBufferPtr buf; /* the XML buffer */
18191 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018192 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018193 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018194
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018195 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18196 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018198 buf = gen_xmlBufferPtr(n_buf, 0);
18199 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018200
William M. Brackf13f77f2004-11-12 16:03:48 +000018201 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018202 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018203 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018204 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018205 xmlResetLastError();
18206 if (mem_base != xmlMemBlocks()) {
18207 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018209 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018210 printf(" %d", n_buf);
18211 printf(" %d", n_string);
18212 printf("\n");
18213 }
18214 }
18215 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018216 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018217
Daniel Veillard42595322004-11-08 10:52:06 +000018218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018219}
18220
18221
18222static int
18223test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018225
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018226 int mem_base;
18227 xmlBufferPtr buf; /* the XML buffer output */
18228 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018229 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018230 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018231
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018232 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18233 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18234 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018235 buf = gen_xmlBufferPtr(n_buf, 0);
18236 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018237
William M. Brackf13f77f2004-11-12 16:03:48 +000018238 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018239 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018240 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018241 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018242 xmlResetLastError();
18243 if (mem_base != xmlMemBlocks()) {
18244 printf("Leak of %d blocks found in xmlBufferWriteChar",
18245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018246 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018247 printf(" %d", n_buf);
18248 printf(" %d", n_string);
18249 printf("\n");
18250 }
18251 }
18252 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018254
Daniel Veillard42595322004-11-08 10:52:06 +000018255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018256}
18257
18258
18259static int
18260test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018262
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018263 int mem_base;
18264 xmlBufferPtr buf; /* the XML buffer output */
18265 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018266 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018267 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018268
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018269 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18270 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018272 buf = gen_xmlBufferPtr(n_buf, 0);
18273 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018274
William M. Brackf13f77f2004-11-12 16:03:48 +000018275 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018276 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018277 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018278 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018279 xmlResetLastError();
18280 if (mem_base != xmlMemBlocks()) {
18281 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018283 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018284 printf(" %d", n_buf);
18285 printf(" %d", n_string);
18286 printf("\n");
18287 }
18288 }
18289 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018290 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018291
Daniel Veillard42595322004-11-08 10:52:06 +000018292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018293}
18294
18295
18296static int
18297test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018299
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018300 int mem_base;
18301 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018302 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018303 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018304 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018305 int n_prefix;
18306 xmlChar * memory; /* preallocated memory */
18307 int n_memory;
18308 int len; /* preallocated memory length */
18309 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018310
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018311 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18312 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18313 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18314 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18315 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018316 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18317 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18318 memory = gen_xmlChar_ptr(n_memory, 2);
18319 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018320
William M. Brackf13f77f2004-11-12 16:03:48 +000018321 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018322 if ((ret_val != NULL) && (ret_val != ncname) &&
18323 (ret_val != prefix) && (ret_val != memory))
18324 xmlFree(ret_val);
18325 ret_val = NULL;
18326 desret_xmlChar_ptr(ret_val);
18327 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018328 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18329 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018330 des_xmlChar_ptr(n_memory, memory, 2);
18331 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018332 xmlResetLastError();
18333 if (mem_base != xmlMemBlocks()) {
18334 printf("Leak of %d blocks found in xmlBuildQName",
18335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018336 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018337 printf(" %d", n_ncname);
18338 printf(" %d", n_prefix);
18339 printf(" %d", n_memory);
18340 printf(" %d", n_len);
18341 printf("\n");
18342 }
18343 }
18344 }
18345 }
18346 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018347 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018348
Daniel Veillard42595322004-11-08 10:52:06 +000018349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018350}
18351
18352
18353static int
18354test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018356
William M. Brack21e4ef22005-01-02 09:53:13 +000018357#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018358 int mem_base;
18359 xmlDocPtr ret_val;
18360 xmlDocPtr doc; /* the document */
18361 int n_doc;
18362 int recursive; /* if not zero do a recursive copy. */
18363 int n_recursive;
18364
18365 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18366 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18367 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018368 doc = gen_xmlDocPtr(n_doc, 0);
18369 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018370
18371 ret_val = xmlCopyDoc(doc, recursive);
18372 desret_xmlDocPtr(ret_val);
18373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018374 des_xmlDocPtr(n_doc, doc, 0);
18375 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018376 xmlResetLastError();
18377 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018378 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018380 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018381 printf(" %d", n_doc);
18382 printf(" %d", n_recursive);
18383 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018384 }
18385 }
18386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018387 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018388#endif
18389
Daniel Veillard42595322004-11-08 10:52:06 +000018390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018391}
18392
18393
18394static int
18395test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018397
William M. Brack21e4ef22005-01-02 09:53:13 +000018398#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018399 int mem_base;
18400 xmlDtdPtr ret_val;
18401 xmlDtdPtr dtd; /* the dtd */
18402 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018403
Daniel Veillard27f20102004-11-05 11:50:11 +000018404 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18405 mem_base = xmlMemBlocks();
18406 dtd = gen_xmlDtdPtr(n_dtd, 0);
18407
18408 ret_val = xmlCopyDtd(dtd);
18409 desret_xmlDtdPtr(ret_val);
18410 call_tests++;
18411 des_xmlDtdPtr(n_dtd, dtd, 0);
18412 xmlResetLastError();
18413 if (mem_base != xmlMemBlocks()) {
18414 printf("Leak of %d blocks found in xmlCopyDtd",
18415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018416 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018417 printf(" %d", n_dtd);
18418 printf("\n");
18419 }
18420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018421 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018422#endif
18423
Daniel Veillard42595322004-11-08 10:52:06 +000018424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018425}
18426
18427
18428static int
18429test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018431
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018432 int mem_base;
18433 xmlNsPtr ret_val;
18434 xmlNsPtr cur; /* the namespace */
18435 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018436
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018437 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18438 mem_base = xmlMemBlocks();
18439 cur = gen_xmlNsPtr(n_cur, 0);
18440
18441 ret_val = xmlCopyNamespace(cur);
18442 if (ret_val != NULL) xmlFreeNs(ret_val);
18443 desret_xmlNsPtr(ret_val);
18444 call_tests++;
18445 des_xmlNsPtr(n_cur, cur, 0);
18446 xmlResetLastError();
18447 if (mem_base != xmlMemBlocks()) {
18448 printf("Leak of %d blocks found in xmlCopyNamespace",
18449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018450 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018451 printf(" %d", n_cur);
18452 printf("\n");
18453 }
18454 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018456
Daniel Veillard42595322004-11-08 10:52:06 +000018457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018458}
18459
18460
18461static int
18462test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018464
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018465 int mem_base;
18466 xmlNsPtr ret_val;
18467 xmlNsPtr cur; /* the first namespace */
18468 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018469
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018470 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18471 mem_base = xmlMemBlocks();
18472 cur = gen_xmlNsPtr(n_cur, 0);
18473
18474 ret_val = xmlCopyNamespaceList(cur);
18475 if (ret_val != NULL) xmlFreeNsList(ret_val);
18476 desret_xmlNsPtr(ret_val);
18477 call_tests++;
18478 des_xmlNsPtr(n_cur, cur, 0);
18479 xmlResetLastError();
18480 if (mem_base != xmlMemBlocks()) {
18481 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018483 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018484 printf(" %d", n_cur);
18485 printf("\n");
18486 }
18487 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018488 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018489
Daniel Veillard42595322004-11-08 10:52:06 +000018490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018491}
18492
18493
18494static int
18495test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018497
Daniel Veillardce682bc2004-11-05 17:22:25 +000018498 int mem_base;
18499 xmlNodePtr ret_val;
18500 xmlNodePtr node; /* the node */
18501 int n_node;
18502 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18503 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018504
Daniel Veillardce682bc2004-11-05 17:22:25 +000018505 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18506 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18507 mem_base = xmlMemBlocks();
18508 node = gen_const_xmlNodePtr(n_node, 0);
18509 extended = gen_int(n_extended, 1);
18510
William M. Brackf13f77f2004-11-12 16:03:48 +000018511 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018512 desret_xmlNodePtr(ret_val);
18513 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018514 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018515 des_int(n_extended, extended, 1);
18516 xmlResetLastError();
18517 if (mem_base != xmlMemBlocks()) {
18518 printf("Leak of %d blocks found in xmlCopyNode",
18519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018520 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018521 printf(" %d", n_node);
18522 printf(" %d", n_extended);
18523 printf("\n");
18524 }
18525 }
18526 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018527 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018528
Daniel Veillard42595322004-11-08 10:52:06 +000018529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018530}
18531
18532
18533static int
18534test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018536
Daniel Veillardce682bc2004-11-05 17:22:25 +000018537 int mem_base;
18538 xmlNodePtr ret_val;
18539 xmlNodePtr node; /* the first node in the list. */
18540 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018541
Daniel Veillardce682bc2004-11-05 17:22:25 +000018542 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18543 mem_base = xmlMemBlocks();
18544 node = gen_const_xmlNodePtr(n_node, 0);
18545
William M. Brackf13f77f2004-11-12 16:03:48 +000018546 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018547 desret_xmlNodePtr(ret_val);
18548 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018549 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018550 xmlResetLastError();
18551 if (mem_base != xmlMemBlocks()) {
18552 printf("Leak of %d blocks found in xmlCopyNodeList",
18553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018554 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018555 printf(" %d", n_node);
18556 printf("\n");
18557 }
18558 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018559 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018560
Daniel Veillard42595322004-11-08 10:52:06 +000018561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018562}
18563
18564
18565static int
18566test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018568
Daniel Veillard57b25162004-11-06 14:50:18 +000018569 int mem_base;
18570 xmlAttrPtr ret_val;
18571 xmlNodePtr target; /* the element where the attribute will be grafted */
18572 int n_target;
18573 xmlAttrPtr cur; /* the attribute */
18574 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018575
Daniel Veillard57b25162004-11-06 14:50:18 +000018576 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18577 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18578 mem_base = xmlMemBlocks();
18579 target = gen_xmlNodePtr(n_target, 0);
18580 cur = gen_xmlAttrPtr(n_cur, 1);
18581
18582 ret_val = xmlCopyProp(target, cur);
18583 desret_xmlAttrPtr(ret_val);
18584 call_tests++;
18585 des_xmlNodePtr(n_target, target, 0);
18586 des_xmlAttrPtr(n_cur, cur, 1);
18587 xmlResetLastError();
18588 if (mem_base != xmlMemBlocks()) {
18589 printf("Leak of %d blocks found in xmlCopyProp",
18590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018591 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018592 printf(" %d", n_target);
18593 printf(" %d", n_cur);
18594 printf("\n");
18595 }
18596 }
18597 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018598 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018599
Daniel Veillard42595322004-11-08 10:52:06 +000018600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018601}
18602
18603
18604static int
18605test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018607
Daniel Veillard57b25162004-11-06 14:50:18 +000018608 int mem_base;
18609 xmlAttrPtr ret_val;
18610 xmlNodePtr target; /* the element where the attributes will be grafted */
18611 int n_target;
18612 xmlAttrPtr cur; /* the first attribute */
18613 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018614
Daniel Veillard57b25162004-11-06 14:50:18 +000018615 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18616 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18617 mem_base = xmlMemBlocks();
18618 target = gen_xmlNodePtr(n_target, 0);
18619 cur = gen_xmlAttrPtr(n_cur, 1);
18620
18621 ret_val = xmlCopyPropList(target, cur);
18622 desret_xmlAttrPtr(ret_val);
18623 call_tests++;
18624 des_xmlNodePtr(n_target, target, 0);
18625 des_xmlAttrPtr(n_cur, cur, 1);
18626 xmlResetLastError();
18627 if (mem_base != xmlMemBlocks()) {
18628 printf("Leak of %d blocks found in xmlCopyPropList",
18629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018630 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018631 printf(" %d", n_target);
18632 printf(" %d", n_cur);
18633 printf("\n");
18634 }
18635 }
18636 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018637 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018638
Daniel Veillard42595322004-11-08 10:52:06 +000018639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018640}
18641
18642
18643static int
18644test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018646
Daniel Veillard34099b42004-11-04 17:34:35 +000018647 int mem_base;
18648 xmlDtdPtr ret_val;
18649 xmlDocPtr doc; /* the document pointer */
18650 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018651 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018652 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018653 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018654 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018655 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018656 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018657
Daniel Veillard34099b42004-11-04 17:34:35 +000018658 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18659 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18660 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18661 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18662 mem_base = xmlMemBlocks();
18663 doc = gen_xmlDocPtr(n_doc, 0);
18664 name = gen_const_xmlChar_ptr(n_name, 1);
18665 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18666 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18667
William M. Brackf13f77f2004-11-12 16:03:48 +000018668 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018669 desret_xmlDtdPtr(ret_val);
18670 call_tests++;
18671 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018672 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18673 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18674 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018675 xmlResetLastError();
18676 if (mem_base != xmlMemBlocks()) {
18677 printf("Leak of %d blocks found in xmlCreateIntSubset",
18678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018679 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018680 printf(" %d", n_doc);
18681 printf(" %d", n_name);
18682 printf(" %d", n_ExternalID);
18683 printf(" %d", n_SystemID);
18684 printf("\n");
18685 }
18686 }
18687 }
18688 }
18689 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018690 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018691
Daniel Veillard42595322004-11-08 10:52:06 +000018692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018693}
18694
18695
18696static int
18697test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018699
Daniel Veillardce682bc2004-11-05 17:22:25 +000018700 int mem_base;
18701 xmlNodePtr ret_val;
18702 xmlNodePtr node; /* the node */
18703 int n_node;
18704 xmlDocPtr doc; /* the document */
18705 int n_doc;
18706 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18707 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018708
Daniel Veillardce682bc2004-11-05 17:22:25 +000018709 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18710 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18711 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18712 mem_base = xmlMemBlocks();
18713 node = gen_const_xmlNodePtr(n_node, 0);
18714 doc = gen_xmlDocPtr(n_doc, 1);
18715 extended = gen_int(n_extended, 2);
18716
William M. Brackf13f77f2004-11-12 16:03:48 +000018717 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018718 desret_xmlNodePtr(ret_val);
18719 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018720 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018721 des_xmlDocPtr(n_doc, doc, 1);
18722 des_int(n_extended, extended, 2);
18723 xmlResetLastError();
18724 if (mem_base != xmlMemBlocks()) {
18725 printf("Leak of %d blocks found in xmlDocCopyNode",
18726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018727 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018728 printf(" %d", n_node);
18729 printf(" %d", n_doc);
18730 printf(" %d", n_extended);
18731 printf("\n");
18732 }
18733 }
18734 }
18735 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018737
Daniel Veillard42595322004-11-08 10:52:06 +000018738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018739}
18740
18741
18742static int
18743test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018745
Daniel Veillardce682bc2004-11-05 17:22:25 +000018746 int mem_base;
18747 xmlNodePtr ret_val;
18748 xmlDocPtr doc; /* the target document */
18749 int n_doc;
18750 xmlNodePtr node; /* the first node in the list. */
18751 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018752
Daniel Veillardce682bc2004-11-05 17:22:25 +000018753 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18754 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18755 mem_base = xmlMemBlocks();
18756 doc = gen_xmlDocPtr(n_doc, 0);
18757 node = gen_const_xmlNodePtr(n_node, 1);
18758
William M. Brackf13f77f2004-11-12 16:03:48 +000018759 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018760 desret_xmlNodePtr(ret_val);
18761 call_tests++;
18762 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018763 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018764 xmlResetLastError();
18765 if (mem_base != xmlMemBlocks()) {
18766 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018768 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018769 printf(" %d", n_doc);
18770 printf(" %d", n_node);
18771 printf("\n");
18772 }
18773 }
18774 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018776
Daniel Veillard42595322004-11-08 10:52:06 +000018777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018778}
18779
18780
18781static int
18782test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018784
William M. Brack21e4ef22005-01-02 09:53:13 +000018785#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018786 int mem_base;
18787 int ret_val;
18788 FILE * f; /* the FILE* */
18789 int n_f;
18790 xmlDocPtr cur; /* the document */
18791 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018792
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018793 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18794 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18795 mem_base = xmlMemBlocks();
18796 f = gen_FILE_ptr(n_f, 0);
18797 cur = gen_xmlDocPtr(n_cur, 1);
18798
18799 ret_val = xmlDocDump(f, cur);
18800 desret_int(ret_val);
18801 call_tests++;
18802 des_FILE_ptr(n_f, f, 0);
18803 des_xmlDocPtr(n_cur, cur, 1);
18804 xmlResetLastError();
18805 if (mem_base != xmlMemBlocks()) {
18806 printf("Leak of %d blocks found in xmlDocDump",
18807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018808 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018809 printf(" %d", n_f);
18810 printf(" %d", n_cur);
18811 printf("\n");
18812 }
18813 }
18814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018815 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018816#endif
18817
Daniel Veillard42595322004-11-08 10:52:06 +000018818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018819}
18820
18821
18822static int
18823test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018825
William M. Brack21e4ef22005-01-02 09:53:13 +000018826#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018827 int mem_base;
18828 xmlDocPtr cur; /* the document */
18829 int n_cur;
18830 xmlChar ** mem; /* OUT: the memory pointer */
18831 int n_mem;
18832 int * size; /* OUT: the memory length */
18833 int n_size;
18834 int format; /* should formatting spaces been added */
18835 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018836
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018837 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18838 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18839 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18840 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18841 mem_base = xmlMemBlocks();
18842 cur = gen_xmlDocPtr(n_cur, 0);
18843 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18844 size = gen_int_ptr(n_size, 2);
18845 format = gen_int(n_format, 3);
18846
18847 xmlDocDumpFormatMemory(cur, mem, size, format);
18848 call_tests++;
18849 des_xmlDocPtr(n_cur, cur, 0);
18850 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18851 des_int_ptr(n_size, size, 2);
18852 des_int(n_format, format, 3);
18853 xmlResetLastError();
18854 if (mem_base != xmlMemBlocks()) {
18855 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018857 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018858 printf(" %d", n_cur);
18859 printf(" %d", n_mem);
18860 printf(" %d", n_size);
18861 printf(" %d", n_format);
18862 printf("\n");
18863 }
18864 }
18865 }
18866 }
18867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018868 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018869#endif
18870
Daniel Veillard42595322004-11-08 10:52:06 +000018871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018872}
18873
18874
18875static int
18876test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018878
William M. Brack21e4ef22005-01-02 09:53:13 +000018879#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018880 int mem_base;
18881 xmlDocPtr out_doc; /* Document to generate XML text from */
18882 int n_out_doc;
18883 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18884 int n_doc_txt_ptr;
18885 int * doc_txt_len; /* Length of the generated XML text */
18886 int n_doc_txt_len;
18887 char * txt_encoding; /* Character encoding to use when generating XML text */
18888 int n_txt_encoding;
18889 int format; /* should formatting spaces been added */
18890 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018891
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018892 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18893 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18894 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18895 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18896 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18897 mem_base = xmlMemBlocks();
18898 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18899 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18900 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18901 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18902 format = gen_int(n_format, 4);
18903
William M. Brackf13f77f2004-11-12 16:03:48 +000018904 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018905 call_tests++;
18906 des_xmlDocPtr(n_out_doc, out_doc, 0);
18907 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18908 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018909 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018910 des_int(n_format, format, 4);
18911 xmlResetLastError();
18912 if (mem_base != xmlMemBlocks()) {
18913 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018915 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018916 printf(" %d", n_out_doc);
18917 printf(" %d", n_doc_txt_ptr);
18918 printf(" %d", n_doc_txt_len);
18919 printf(" %d", n_txt_encoding);
18920 printf(" %d", n_format);
18921 printf("\n");
18922 }
18923 }
18924 }
18925 }
18926 }
18927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018928 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018929#endif
18930
Daniel Veillard42595322004-11-08 10:52:06 +000018931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018932}
18933
18934
18935static int
18936test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018938
William M. Brack21e4ef22005-01-02 09:53:13 +000018939#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018940 int mem_base;
18941 xmlDocPtr cur; /* the document */
18942 int n_cur;
18943 xmlChar ** mem; /* OUT: the memory pointer */
18944 int n_mem;
18945 int * size; /* OUT: the memory length */
18946 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018947
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018948 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18949 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18950 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18951 mem_base = xmlMemBlocks();
18952 cur = gen_xmlDocPtr(n_cur, 0);
18953 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18954 size = gen_int_ptr(n_size, 2);
18955
18956 xmlDocDumpMemory(cur, mem, size);
18957 call_tests++;
18958 des_xmlDocPtr(n_cur, cur, 0);
18959 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18960 des_int_ptr(n_size, size, 2);
18961 xmlResetLastError();
18962 if (mem_base != xmlMemBlocks()) {
18963 printf("Leak of %d blocks found in xmlDocDumpMemory",
18964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018965 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018966 printf(" %d", n_cur);
18967 printf(" %d", n_mem);
18968 printf(" %d", n_size);
18969 printf("\n");
18970 }
18971 }
18972 }
18973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018974 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018975#endif
18976
Daniel Veillard42595322004-11-08 10:52:06 +000018977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018978}
18979
18980
18981static int
18982test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018984
William M. Brack21e4ef22005-01-02 09:53:13 +000018985#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018986 int mem_base;
18987 xmlDocPtr out_doc; /* Document to generate XML text from */
18988 int n_out_doc;
18989 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18990 int n_doc_txt_ptr;
18991 int * doc_txt_len; /* Length of the generated XML text */
18992 int n_doc_txt_len;
18993 char * txt_encoding; /* Character encoding to use when generating XML text */
18994 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018995
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018996 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18997 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18998 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18999 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19000 mem_base = xmlMemBlocks();
19001 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19002 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19003 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19004 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19005
William M. Brackf13f77f2004-11-12 16:03:48 +000019006 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019007 call_tests++;
19008 des_xmlDocPtr(n_out_doc, out_doc, 0);
19009 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19010 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019011 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019012 xmlResetLastError();
19013 if (mem_base != xmlMemBlocks()) {
19014 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019016 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019017 printf(" %d", n_out_doc);
19018 printf(" %d", n_doc_txt_ptr);
19019 printf(" %d", n_doc_txt_len);
19020 printf(" %d", n_txt_encoding);
19021 printf("\n");
19022 }
19023 }
19024 }
19025 }
19026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019027 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019028#endif
19029
Daniel Veillard42595322004-11-08 10:52:06 +000019030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019031}
19032
19033
19034static int
19035test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019037
William M. Brack21e4ef22005-01-02 09:53:13 +000019038#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019039 int mem_base;
19040 int ret_val;
19041 FILE * f; /* the FILE* */
19042 int n_f;
19043 xmlDocPtr cur; /* the document */
19044 int n_cur;
19045 int format; /* should formatting spaces been added */
19046 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019047
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019048 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19049 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19050 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19051 mem_base = xmlMemBlocks();
19052 f = gen_FILE_ptr(n_f, 0);
19053 cur = gen_xmlDocPtr(n_cur, 1);
19054 format = gen_int(n_format, 2);
19055
19056 ret_val = xmlDocFormatDump(f, cur, format);
19057 desret_int(ret_val);
19058 call_tests++;
19059 des_FILE_ptr(n_f, f, 0);
19060 des_xmlDocPtr(n_cur, cur, 1);
19061 des_int(n_format, format, 2);
19062 xmlResetLastError();
19063 if (mem_base != xmlMemBlocks()) {
19064 printf("Leak of %d blocks found in xmlDocFormatDump",
19065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019066 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019067 printf(" %d", n_f);
19068 printf(" %d", n_cur);
19069 printf(" %d", n_format);
19070 printf("\n");
19071 }
19072 }
19073 }
19074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019075 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019076#endif
19077
Daniel Veillard42595322004-11-08 10:52:06 +000019078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019079}
19080
19081
19082static int
19083test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019085
19086 int mem_base;
19087 xmlNodePtr ret_val;
19088 xmlDocPtr doc; /* the document */
19089 int n_doc;
19090
19091 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19092 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019093 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019094
19095 ret_val = xmlDocGetRootElement(doc);
19096 desret_xmlNodePtr(ret_val);
19097 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019098 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019099 xmlResetLastError();
19100 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019101 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019103 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019104 printf(" %d", n_doc);
19105 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019106 }
19107 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019109
Daniel Veillard42595322004-11-08 10:52:06 +000019110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019111}
19112
19113
19114static int
19115test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019117
William M. Brack21e4ef22005-01-02 09:53:13 +000019118#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019119 int mem_base;
19120 xmlNodePtr ret_val;
19121 xmlDocPtr doc; /* the document */
19122 int n_doc;
19123 xmlNodePtr root; /* the new document root element */
19124 int n_root;
19125
19126 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019127 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019129 doc = gen_xmlDocPtr(n_doc, 0);
19130 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131
19132 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019133 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019134 desret_xmlNodePtr(ret_val);
19135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019136 des_xmlDocPtr(n_doc, doc, 0);
19137 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019138 xmlResetLastError();
19139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019140 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019143 printf(" %d", n_doc);
19144 printf(" %d", n_root);
19145 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019146 }
19147 }
19148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019149 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019150#endif
19151
Daniel Veillard42595322004-11-08 10:52:06 +000019152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019153}
19154
19155
19156static int
19157test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019159
William M. Brack21e4ef22005-01-02 09:53:13 +000019160#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019161 int mem_base;
19162 FILE * f; /* the FILE * for the output */
19163 int n_f;
19164 xmlDocPtr doc; /* the document */
19165 int n_doc;
19166 xmlNodePtr cur; /* the current node */
19167 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019168
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019169 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19170 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19171 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19172 mem_base = xmlMemBlocks();
19173 f = gen_FILE_ptr(n_f, 0);
19174 doc = gen_xmlDocPtr(n_doc, 1);
19175 cur = gen_xmlNodePtr(n_cur, 2);
19176
19177 xmlElemDump(f, doc, cur);
19178 call_tests++;
19179 des_FILE_ptr(n_f, f, 0);
19180 des_xmlDocPtr(n_doc, doc, 1);
19181 des_xmlNodePtr(n_cur, cur, 2);
19182 xmlResetLastError();
19183 if (mem_base != xmlMemBlocks()) {
19184 printf("Leak of %d blocks found in xmlElemDump",
19185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019186 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019187 printf(" %d", n_f);
19188 printf(" %d", n_doc);
19189 printf(" %d", n_cur);
19190 printf("\n");
19191 }
19192 }
19193 }
19194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019195 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019196#endif
19197
Daniel Veillard42595322004-11-08 10:52:06 +000019198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019199}
19200
19201
19202static int
19203test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019205
Daniel Veillard57b25162004-11-06 14:50:18 +000019206 int mem_base;
19207 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019208
Daniel Veillard57b25162004-11-06 14:50:18 +000019209 mem_base = xmlMemBlocks();
19210
19211 ret_val = xmlGetBufferAllocationScheme();
19212 desret_xmlBufferAllocationScheme(ret_val);
19213 call_tests++;
19214 xmlResetLastError();
19215 if (mem_base != xmlMemBlocks()) {
19216 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019218 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019219 printf("\n");
19220 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019221 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019222
Daniel Veillard42595322004-11-08 10:52:06 +000019223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019224}
19225
19226
19227static int
19228test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019230
19231 int mem_base;
19232 int ret_val;
19233
19234 mem_base = xmlMemBlocks();
19235
19236 ret_val = xmlGetCompressMode();
19237 desret_int(ret_val);
19238 call_tests++;
19239 xmlResetLastError();
19240 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019241 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019243 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019244 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019245 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019247
Daniel Veillard42595322004-11-08 10:52:06 +000019248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019249}
19250
19251
19252static int
19253test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019255
19256 int mem_base;
19257 int ret_val;
19258 xmlDocPtr doc; /* the document */
19259 int n_doc;
19260
19261 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019263 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019264
19265 ret_val = xmlGetDocCompressMode(doc);
19266 desret_int(ret_val);
19267 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019268 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019269 xmlResetLastError();
19270 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019271 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019274 printf(" %d", n_doc);
19275 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019276 }
19277 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019279
Daniel Veillard42595322004-11-08 10:52:06 +000019280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019281}
19282
19283
19284static int
19285test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019287
Daniel Veillard34099b42004-11-04 17:34:35 +000019288 int mem_base;
19289 xmlDtdPtr ret_val;
19290 xmlDocPtr doc; /* the document pointer */
19291 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019292
Daniel Veillard34099b42004-11-04 17:34:35 +000019293 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19294 mem_base = xmlMemBlocks();
19295 doc = gen_xmlDocPtr(n_doc, 0);
19296
19297 ret_val = xmlGetIntSubset(doc);
19298 desret_xmlDtdPtr(ret_val);
19299 call_tests++;
19300 des_xmlDocPtr(n_doc, doc, 0);
19301 xmlResetLastError();
19302 if (mem_base != xmlMemBlocks()) {
19303 printf("Leak of %d blocks found in xmlGetIntSubset",
19304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019305 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019306 printf(" %d", n_doc);
19307 printf("\n");
19308 }
19309 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019311
Daniel Veillard42595322004-11-08 10:52:06 +000019312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019313}
19314
19315
19316static int
19317test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019319
19320 int mem_base;
19321 xmlNodePtr ret_val;
19322 xmlNodePtr parent; /* the parent node */
19323 int n_parent;
19324
19325 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019327 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019328
19329 ret_val = xmlGetLastChild(parent);
19330 desret_xmlNodePtr(ret_val);
19331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019332 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019333 xmlResetLastError();
19334 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019335 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019337 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019338 printf(" %d", n_parent);
19339 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019340 }
19341 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019343
Daniel Veillard42595322004-11-08 10:52:06 +000019344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019345}
19346
19347
19348static int
19349test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019351
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019352 int mem_base;
19353 long ret_val;
19354 xmlNodePtr node; /* valid node */
19355 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019356
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019357 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19358 mem_base = xmlMemBlocks();
19359 node = gen_xmlNodePtr(n_node, 0);
19360
19361 ret_val = xmlGetLineNo(node);
19362 desret_long(ret_val);
19363 call_tests++;
19364 des_xmlNodePtr(n_node, node, 0);
19365 xmlResetLastError();
19366 if (mem_base != xmlMemBlocks()) {
19367 printf("Leak of %d blocks found in xmlGetLineNo",
19368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019369 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019370 printf(" %d", n_node);
19371 printf("\n");
19372 }
19373 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019375
Daniel Veillard42595322004-11-08 10:52:06 +000019376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019377}
19378
19379
19380static int
19381test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019383
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019384 int mem_base;
19385 xmlChar * ret_val;
19386 xmlNodePtr node; /* the node */
19387 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019388 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019389 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019390
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019391 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19392 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019394 node = gen_xmlNodePtr(n_node, 0);
19395 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019396
William M. Brackf13f77f2004-11-12 16:03:48 +000019397 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019398 desret_xmlChar_ptr(ret_val);
19399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019400 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019401 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019402 xmlResetLastError();
19403 if (mem_base != xmlMemBlocks()) {
19404 printf("Leak of %d blocks found in xmlGetNoNsProp",
19405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019406 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019407 printf(" %d", n_node);
19408 printf(" %d", n_name);
19409 printf("\n");
19410 }
19411 }
19412 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019413 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019414
Daniel Veillard42595322004-11-08 10:52:06 +000019415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019416}
19417
19418
19419static int
19420test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019422
William M. Brack21e4ef22005-01-02 09:53:13 +000019423#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019424 int mem_base;
19425 xmlChar * ret_val;
19426 xmlNodePtr node; /* a node */
19427 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019428
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019429 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19430 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019431 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019432
19433 ret_val = xmlGetNodePath(node);
19434 desret_xmlChar_ptr(ret_val);
19435 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019436 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019437 xmlResetLastError();
19438 if (mem_base != xmlMemBlocks()) {
19439 printf("Leak of %d blocks found in xmlGetNodePath",
19440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019441 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019442 printf(" %d", n_node);
19443 printf("\n");
19444 }
19445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019446 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019447#endif
19448
Daniel Veillard42595322004-11-08 10:52:06 +000019449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019450}
19451
19452
19453static int
19454test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019456
19457
19458 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019460}
19461
19462
19463static int
19464test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019466
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019467 int mem_base;
19468 xmlChar * ret_val;
19469 xmlNodePtr node; /* the node */
19470 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019471 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019472 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019473 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019474 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019475
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019476 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19477 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19478 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19479 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019480 node = gen_xmlNodePtr(n_node, 0);
19481 name = gen_const_xmlChar_ptr(n_name, 1);
19482 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019483
William M. Brackf13f77f2004-11-12 16:03:48 +000019484 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019485 desret_xmlChar_ptr(ret_val);
19486 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019487 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019488 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19489 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019490 xmlResetLastError();
19491 if (mem_base != xmlMemBlocks()) {
19492 printf("Leak of %d blocks found in xmlGetNsProp",
19493 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019494 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019495 printf(" %d", n_node);
19496 printf(" %d", n_name);
19497 printf(" %d", n_nameSpace);
19498 printf("\n");
19499 }
19500 }
19501 }
19502 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019503 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019504
Daniel Veillard42595322004-11-08 10:52:06 +000019505 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019506}
19507
19508
19509static int
19510test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019512
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019513 int mem_base;
19514 xmlChar * ret_val;
19515 xmlNodePtr node; /* the node */
19516 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019517 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019518 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019519
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019520 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19521 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019523 node = gen_xmlNodePtr(n_node, 0);
19524 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019525
William M. Brackf13f77f2004-11-12 16:03:48 +000019526 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019527 desret_xmlChar_ptr(ret_val);
19528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019529 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019530 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019531 xmlResetLastError();
19532 if (mem_base != xmlMemBlocks()) {
19533 printf("Leak of %d blocks found in xmlGetProp",
19534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019535 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019536 printf(" %d", n_node);
19537 printf(" %d", n_name);
19538 printf("\n");
19539 }
19540 }
19541 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019542 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019543
Daniel Veillard42595322004-11-08 10:52:06 +000019544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019545}
19546
19547
19548static int
19549test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019551
Daniel Veillard57b25162004-11-06 14:50:18 +000019552 int mem_base;
19553 xmlAttrPtr ret_val;
19554 xmlNodePtr node; /* the node */
19555 int n_node;
19556 xmlChar * name; /* the attribute name */
19557 int n_name;
19558 xmlChar * nameSpace; /* the URI of the namespace */
19559 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019560
Daniel Veillard57b25162004-11-06 14:50:18 +000019561 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19562 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19563 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19564 mem_base = xmlMemBlocks();
19565 node = gen_xmlNodePtr(n_node, 0);
19566 name = gen_const_xmlChar_ptr(n_name, 1);
19567 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19568
William M. Brackf13f77f2004-11-12 16:03:48 +000019569 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019570 desret_xmlAttrPtr(ret_val);
19571 call_tests++;
19572 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019573 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19574 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019575 xmlResetLastError();
19576 if (mem_base != xmlMemBlocks()) {
19577 printf("Leak of %d blocks found in xmlHasNsProp",
19578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019579 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019580 printf(" %d", n_node);
19581 printf(" %d", n_name);
19582 printf(" %d", n_nameSpace);
19583 printf("\n");
19584 }
19585 }
19586 }
19587 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019588 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019589
Daniel Veillard42595322004-11-08 10:52:06 +000019590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019591}
19592
19593
19594static int
19595test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019597
Daniel Veillard57b25162004-11-06 14:50:18 +000019598 int mem_base;
19599 xmlAttrPtr ret_val;
19600 xmlNodePtr node; /* the node */
19601 int n_node;
19602 xmlChar * name; /* the attribute name */
19603 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019604
Daniel Veillard57b25162004-11-06 14:50:18 +000019605 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19606 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19607 mem_base = xmlMemBlocks();
19608 node = gen_xmlNodePtr(n_node, 0);
19609 name = gen_const_xmlChar_ptr(n_name, 1);
19610
William M. Brackf13f77f2004-11-12 16:03:48 +000019611 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019612 desret_xmlAttrPtr(ret_val);
19613 call_tests++;
19614 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019615 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019616 xmlResetLastError();
19617 if (mem_base != xmlMemBlocks()) {
19618 printf("Leak of %d blocks found in xmlHasProp",
19619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019620 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019621 printf(" %d", n_node);
19622 printf(" %d", n_name);
19623 printf("\n");
19624 }
19625 }
19626 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019628
Daniel Veillard42595322004-11-08 10:52:06 +000019629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019630}
19631
19632
19633static int
19634test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019636
19637 int mem_base;
19638 int ret_val;
19639 xmlNodePtr node; /* the node */
19640 int n_node;
19641
19642 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19643 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019644 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019645
19646 ret_val = xmlIsBlankNode(node);
19647 desret_int(ret_val);
19648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019649 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019650 xmlResetLastError();
19651 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019652 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019654 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019655 printf(" %d", n_node);
19656 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019657 }
19658 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019659 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019660
Daniel Veillard42595322004-11-08 10:52:06 +000019661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019662}
19663
19664
19665static int
19666test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019668
19669 int mem_base;
19670 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019671 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019672 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019673 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019674 int n_publicID;
19675
19676 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19677 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019679 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19680 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019681
William M. Brackf13f77f2004-11-12 16:03:48 +000019682 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019683 desret_int(ret_val);
19684 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019685 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19686 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019687 xmlResetLastError();
19688 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019689 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019691 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019692 printf(" %d", n_systemID);
19693 printf(" %d", n_publicID);
19694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019695 }
19696 }
19697 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019699
Daniel Veillard42595322004-11-08 10:52:06 +000019700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019701}
19702
19703
19704static int
19705test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019707
19708 int mem_base;
19709 xmlNodePtr ret_val;
19710 xmlDocPtr doc; /* the document */
19711 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019712 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019713 int n_content;
19714 int len; /* the length of the block */
19715 int n_len;
19716
19717 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19718 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19719 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19720 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019721 doc = gen_xmlDocPtr(n_doc, 0);
19722 content = gen_const_xmlChar_ptr(n_content, 1);
19723 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019724
William M. Brackf13f77f2004-11-12 16:03:48 +000019725 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019726 desret_xmlNodePtr(ret_val);
19727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019728 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019729 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019730 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019731 xmlResetLastError();
19732 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019733 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019735 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019736 printf(" %d", n_doc);
19737 printf(" %d", n_content);
19738 printf(" %d", n_len);
19739 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019740 }
19741 }
19742 }
19743 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019744 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019745
Daniel Veillard42595322004-11-08 10:52:06 +000019746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019747}
19748
19749
19750static int
19751test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019753
19754 int mem_base;
19755 xmlNodePtr ret_val;
19756 xmlDocPtr doc; /* the document */
19757 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019758 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019759 int n_name;
19760
19761 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19762 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19763 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019764 doc = gen_xmlDocPtr(n_doc, 0);
19765 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019766
William M. Brackf13f77f2004-11-12 16:03:48 +000019767 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019768 desret_xmlNodePtr(ret_val);
19769 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019770 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019771 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019772 xmlResetLastError();
19773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019774 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019777 printf(" %d", n_doc);
19778 printf(" %d", n_name);
19779 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019780 }
19781 }
19782 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019783 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019784
Daniel Veillard42595322004-11-08 10:52:06 +000019785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019786}
19787
19788
19789static int
19790test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019792
William M. Brack21e4ef22005-01-02 09:53:13 +000019793#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019794#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019795 int mem_base;
19796 xmlNodePtr ret_val;
19797 xmlNodePtr parent; /* the parent node */
19798 int n_parent;
19799 xmlNsPtr ns; /* a namespace if any */
19800 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019801 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019802 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019803 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019804 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019805
Daniel Veillard27f20102004-11-05 11:50:11 +000019806 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19807 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19808 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19809 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19810 mem_base = xmlMemBlocks();
19811 parent = gen_xmlNodePtr(n_parent, 0);
19812 ns = gen_xmlNsPtr(n_ns, 1);
19813 name = gen_const_xmlChar_ptr(n_name, 2);
19814 content = gen_const_xmlChar_ptr(n_content, 3);
19815
William M. Brackf13f77f2004-11-12 16:03:48 +000019816 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019817 desret_xmlNodePtr(ret_val);
19818 call_tests++;
19819 des_xmlNodePtr(n_parent, parent, 0);
19820 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019821 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19822 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019823 xmlResetLastError();
19824 if (mem_base != xmlMemBlocks()) {
19825 printf("Leak of %d blocks found in xmlNewChild",
19826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019827 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019828 printf(" %d", n_parent);
19829 printf(" %d", n_ns);
19830 printf(" %d", n_name);
19831 printf(" %d", n_content);
19832 printf("\n");
19833 }
19834 }
19835 }
19836 }
19837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019838 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019839#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000019840#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019841
Daniel Veillard42595322004-11-08 10:52:06 +000019842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019843}
19844
19845
19846static int
19847test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019849
19850 int mem_base;
19851 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019852 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019853 int n_content;
19854
19855 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019857 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019858
William M. Brackf13f77f2004-11-12 16:03:48 +000019859 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019860 desret_xmlNodePtr(ret_val);
19861 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019862 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019863 xmlResetLastError();
19864 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019865 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019867 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019868 printf(" %d", n_content);
19869 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019870 }
19871 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019872 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019873
Daniel Veillard42595322004-11-08 10:52:06 +000019874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019875}
19876
19877
19878static int
19879test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019881
19882 int mem_base;
19883 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019884 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019885 int n_version;
19886
19887 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19888 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019889 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019890
William M. Brackf13f77f2004-11-12 16:03:48 +000019891 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019892 desret_xmlDocPtr(ret_val);
19893 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019894 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895 xmlResetLastError();
19896 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019897 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019899 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019900 printf(" %d", n_version);
19901 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019902 }
19903 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019904 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019905
Daniel Veillard42595322004-11-08 10:52:06 +000019906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019907}
19908
19909
19910static int
19911test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019913
19914 int mem_base;
19915 xmlNodePtr ret_val;
19916 xmlDocPtr doc; /* the document */
19917 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019918 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019919 int n_content;
19920
19921 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19922 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019924 doc = gen_xmlDocPtr(n_doc, 0);
19925 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019926
William M. Brackf13f77f2004-11-12 16:03:48 +000019927 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019928 desret_xmlNodePtr(ret_val);
19929 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019930 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019931 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019932 xmlResetLastError();
19933 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019934 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019936 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019937 printf(" %d", n_doc);
19938 printf(" %d", n_content);
19939 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019940 }
19941 }
19942 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019943 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019944
Daniel Veillard42595322004-11-08 10:52:06 +000019945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946}
19947
19948
19949static int
19950test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019952
William M. Brack21e4ef22005-01-02 09:53:13 +000019953#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954 int mem_base;
19955 xmlNodePtr ret_val;
19956 xmlDocPtr doc; /* the document owning the fragment */
19957 int n_doc;
19958
19959 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019961 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019962
19963 ret_val = xmlNewDocFragment(doc);
19964 desret_xmlNodePtr(ret_val);
19965 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019966 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019967 xmlResetLastError();
19968 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019969 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019971 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019972 printf(" %d", n_doc);
19973 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019974 }
19975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019976 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019977#endif
19978
Daniel Veillard42595322004-11-08 10:52:06 +000019979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019980}
19981
19982
19983static int
19984test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019986
Daniel Veillard27f20102004-11-05 11:50:11 +000019987 int mem_base;
19988 xmlNodePtr ret_val;
19989 xmlDocPtr doc; /* the document */
19990 int n_doc;
19991 xmlNsPtr ns; /* namespace if any */
19992 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019993 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019994 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019995 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019996 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019997
Daniel Veillard27f20102004-11-05 11:50:11 +000019998 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19999 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20000 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20001 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20002 mem_base = xmlMemBlocks();
20003 doc = gen_xmlDocPtr(n_doc, 0);
20004 ns = gen_xmlNsPtr(n_ns, 1);
20005 name = gen_const_xmlChar_ptr(n_name, 2);
20006 content = gen_const_xmlChar_ptr(n_content, 3);
20007
William M. Brackf13f77f2004-11-12 16:03:48 +000020008 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020009 desret_xmlNodePtr(ret_val);
20010 call_tests++;
20011 des_xmlDocPtr(n_doc, doc, 0);
20012 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020013 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20014 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020015 xmlResetLastError();
20016 if (mem_base != xmlMemBlocks()) {
20017 printf("Leak of %d blocks found in xmlNewDocNode",
20018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020019 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020020 printf(" %d", n_doc);
20021 printf(" %d", n_ns);
20022 printf(" %d", n_name);
20023 printf(" %d", n_content);
20024 printf("\n");
20025 }
20026 }
20027 }
20028 }
20029 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020031
Daniel Veillard42595322004-11-08 10:52:06 +000020032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020033}
20034
20035
20036static int
20037test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020039
Daniel Veillard27f20102004-11-05 11:50:11 +000020040 int mem_base;
20041 xmlNodePtr ret_val;
20042 xmlDocPtr doc; /* the document */
20043 int n_doc;
20044 xmlNsPtr ns; /* namespace if any */
20045 int n_ns;
20046 xmlChar * name; /* the node name */
20047 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020048 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020049 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020050
Daniel Veillard27f20102004-11-05 11:50:11 +000020051 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20052 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20053 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20054 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20055 mem_base = xmlMemBlocks();
20056 doc = gen_xmlDocPtr(n_doc, 0);
20057 ns = gen_xmlNsPtr(n_ns, 1);
20058 name = gen_eaten_name(n_name, 2);
20059 content = gen_const_xmlChar_ptr(n_content, 3);
20060
William M. Brackf13f77f2004-11-12 16:03:48 +000020061 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020062 desret_xmlNodePtr(ret_val);
20063 call_tests++;
20064 des_xmlDocPtr(n_doc, doc, 0);
20065 des_xmlNsPtr(n_ns, ns, 1);
20066 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020067 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020068 xmlResetLastError();
20069 if (mem_base != xmlMemBlocks()) {
20070 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020072 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020073 printf(" %d", n_doc);
20074 printf(" %d", n_ns);
20075 printf(" %d", n_name);
20076 printf(" %d", n_content);
20077 printf("\n");
20078 }
20079 }
20080 }
20081 }
20082 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020083 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020084
Daniel Veillard42595322004-11-08 10:52:06 +000020085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020086}
20087
20088
20089static int
20090test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020092
20093 int mem_base;
20094 xmlNodePtr ret_val;
20095 xmlDocPtr doc; /* the target document */
20096 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020097 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020098 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020099 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020100 int n_content;
20101
20102 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20103 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20104 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20105 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020106 doc = gen_xmlDocPtr(n_doc, 0);
20107 name = gen_const_xmlChar_ptr(n_name, 1);
20108 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020109
William M. Brackf13f77f2004-11-12 16:03:48 +000020110 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111 desret_xmlNodePtr(ret_val);
20112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020113 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020114 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20115 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020116 xmlResetLastError();
20117 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020118 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020120 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020121 printf(" %d", n_doc);
20122 printf(" %d", n_name);
20123 printf(" %d", n_content);
20124 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020125 }
20126 }
20127 }
20128 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020129 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020130
Daniel Veillard42595322004-11-08 10:52:06 +000020131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020132}
20133
20134
20135static int
20136test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020138
Daniel Veillard57b25162004-11-06 14:50:18 +000020139 int mem_base;
20140 xmlAttrPtr ret_val;
20141 xmlDocPtr doc; /* the document */
20142 int n_doc;
20143 xmlChar * name; /* the name of the attribute */
20144 int n_name;
20145 xmlChar * value; /* the value of the attribute */
20146 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020147
Daniel Veillard57b25162004-11-06 14:50:18 +000020148 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20149 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20150 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20151 mem_base = xmlMemBlocks();
20152 doc = gen_xmlDocPtr(n_doc, 0);
20153 name = gen_const_xmlChar_ptr(n_name, 1);
20154 value = gen_const_xmlChar_ptr(n_value, 2);
20155
William M. Brackf13f77f2004-11-12 16:03:48 +000020156 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020157 desret_xmlAttrPtr(ret_val);
20158 call_tests++;
20159 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020160 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20161 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020162 xmlResetLastError();
20163 if (mem_base != xmlMemBlocks()) {
20164 printf("Leak of %d blocks found in xmlNewDocProp",
20165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020166 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020167 printf(" %d", n_doc);
20168 printf(" %d", n_name);
20169 printf(" %d", n_value);
20170 printf("\n");
20171 }
20172 }
20173 }
20174 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020176
Daniel Veillard42595322004-11-08 10:52:06 +000020177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020178}
20179
20180
20181static int
20182test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020184
William M. Brack21e4ef22005-01-02 09:53:13 +000020185#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020186#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020187 int mem_base;
20188 xmlNodePtr ret_val;
20189 xmlDocPtr doc; /* the document */
20190 int n_doc;
20191 xmlNsPtr ns; /* namespace if any */
20192 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020193 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020194 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020195 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020196 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020197
Daniel Veillard27f20102004-11-05 11:50:11 +000020198 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20199 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20200 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20201 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20202 mem_base = xmlMemBlocks();
20203 doc = gen_xmlDocPtr(n_doc, 0);
20204 ns = gen_xmlNsPtr(n_ns, 1);
20205 name = gen_const_xmlChar_ptr(n_name, 2);
20206 content = gen_const_xmlChar_ptr(n_content, 3);
20207
William M. Brackf13f77f2004-11-12 16:03:48 +000020208 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020209 desret_xmlNodePtr(ret_val);
20210 call_tests++;
20211 des_xmlDocPtr(n_doc, doc, 0);
20212 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020213 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20214 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020215 xmlResetLastError();
20216 if (mem_base != xmlMemBlocks()) {
20217 printf("Leak of %d blocks found in xmlNewDocRawNode",
20218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020219 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020220 printf(" %d", n_doc);
20221 printf(" %d", n_ns);
20222 printf(" %d", n_name);
20223 printf(" %d", n_content);
20224 printf("\n");
20225 }
20226 }
20227 }
20228 }
20229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020230 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020231#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020232#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020233
Daniel Veillard42595322004-11-08 10:52:06 +000020234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020235}
20236
20237
20238static int
20239test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020241
20242 int mem_base;
20243 xmlNodePtr ret_val;
20244 xmlDocPtr doc; /* the document */
20245 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020246 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020247 int n_content;
20248
20249 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20250 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020252 doc = gen_xmlDocPtr(n_doc, 0);
20253 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020254
William M. Brackf13f77f2004-11-12 16:03:48 +000020255 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020256 desret_xmlNodePtr(ret_val);
20257 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020258 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020259 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020260 xmlResetLastError();
20261 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020262 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020264 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020265 printf(" %d", n_doc);
20266 printf(" %d", n_content);
20267 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020268 }
20269 }
20270 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020271 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020272
Daniel Veillard42595322004-11-08 10:52:06 +000020273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020274}
20275
20276
20277static int
20278test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020280
20281 int mem_base;
20282 xmlNodePtr ret_val;
20283 xmlDocPtr doc; /* the document */
20284 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020285 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020286 int n_content;
20287 int len; /* the text len. */
20288 int n_len;
20289
20290 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20291 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20292 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20293 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020294 doc = gen_xmlDocPtr(n_doc, 0);
20295 content = gen_const_xmlChar_ptr(n_content, 1);
20296 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020297
William M. Brackf13f77f2004-11-12 16:03:48 +000020298 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020299 desret_xmlNodePtr(ret_val);
20300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020301 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020302 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020303 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020304 xmlResetLastError();
20305 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020306 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020308 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020309 printf(" %d", n_doc);
20310 printf(" %d", n_content);
20311 printf(" %d", n_len);
20312 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020313 }
20314 }
20315 }
20316 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020318
Daniel Veillard42595322004-11-08 10:52:06 +000020319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020320}
20321
20322
20323static int
20324test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020326
Daniel Veillard34099b42004-11-04 17:34:35 +000020327 int mem_base;
20328 xmlDtdPtr ret_val;
20329 xmlDocPtr doc; /* the document pointer */
20330 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020331 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020332 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020333 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020334 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020335 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020336 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020337
Daniel Veillard34099b42004-11-04 17:34:35 +000020338 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20339 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20340 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20341 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20342 mem_base = xmlMemBlocks();
20343 doc = gen_xmlDocPtr(n_doc, 0);
20344 name = gen_const_xmlChar_ptr(n_name, 1);
20345 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20346 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20347
William M. Brackf13f77f2004-11-12 16:03:48 +000020348 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020349 desret_xmlDtdPtr(ret_val);
20350 call_tests++;
20351 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020352 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20353 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20354 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020355 xmlResetLastError();
20356 if (mem_base != xmlMemBlocks()) {
20357 printf("Leak of %d blocks found in xmlNewDtd",
20358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020359 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020360 printf(" %d", n_doc);
20361 printf(" %d", n_name);
20362 printf(" %d", n_ExternalID);
20363 printf(" %d", n_SystemID);
20364 printf("\n");
20365 }
20366 }
20367 }
20368 }
20369 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020371
Daniel Veillard42595322004-11-08 10:52:06 +000020372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020373}
20374
20375
20376static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020377test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020379
Daniel Veillard27f20102004-11-05 11:50:11 +000020380 int mem_base;
20381 xmlNodePtr ret_val;
20382 xmlNsPtr ns; /* namespace if any */
20383 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020384 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020385 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020386
Daniel Veillard27f20102004-11-05 11:50:11 +000020387 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20388 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20389 mem_base = xmlMemBlocks();
20390 ns = gen_xmlNsPtr(n_ns, 0);
20391 name = gen_const_xmlChar_ptr(n_name, 1);
20392
William M. Brackf13f77f2004-11-12 16:03:48 +000020393 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020394 desret_xmlNodePtr(ret_val);
20395 call_tests++;
20396 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020397 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020398 xmlResetLastError();
20399 if (mem_base != xmlMemBlocks()) {
20400 printf("Leak of %d blocks found in xmlNewNode",
20401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020402 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020403 printf(" %d", n_ns);
20404 printf(" %d", n_name);
20405 printf("\n");
20406 }
20407 }
20408 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020409 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020410
Daniel Veillard42595322004-11-08 10:52:06 +000020411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020412}
20413
20414
20415static int
20416test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020418
Daniel Veillard27f20102004-11-05 11:50:11 +000020419 int mem_base;
20420 xmlNodePtr ret_val;
20421 xmlNsPtr ns; /* namespace if any */
20422 int n_ns;
20423 xmlChar * name; /* the node name */
20424 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020425
Daniel Veillard27f20102004-11-05 11:50:11 +000020426 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20427 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20428 mem_base = xmlMemBlocks();
20429 ns = gen_xmlNsPtr(n_ns, 0);
20430 name = gen_eaten_name(n_name, 1);
20431
20432 ret_val = xmlNewNodeEatName(ns, name);
20433 desret_xmlNodePtr(ret_val);
20434 call_tests++;
20435 des_xmlNsPtr(n_ns, ns, 0);
20436 des_eaten_name(n_name, name, 1);
20437 xmlResetLastError();
20438 if (mem_base != xmlMemBlocks()) {
20439 printf("Leak of %d blocks found in xmlNewNodeEatName",
20440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020441 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020442 printf(" %d", n_ns);
20443 printf(" %d", n_name);
20444 printf("\n");
20445 }
20446 }
20447 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020449
Daniel Veillard42595322004-11-08 10:52:06 +000020450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020451}
20452
20453
20454static int
20455test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020457
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020458 int mem_base;
20459 xmlNsPtr ret_val;
20460 xmlNodePtr node; /* the element carrying the namespace */
20461 int n_node;
20462 xmlChar * href; /* the URI associated */
20463 int n_href;
20464 xmlChar * prefix; /* the prefix for the namespace */
20465 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020467 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20468 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20469 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20470 mem_base = xmlMemBlocks();
20471 node = gen_xmlNodePtr(n_node, 0);
20472 href = gen_const_xmlChar_ptr(n_href, 1);
20473 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20474
William M. Brackf13f77f2004-11-12 16:03:48 +000020475 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020476 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20477 desret_xmlNsPtr(ret_val);
20478 call_tests++;
20479 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020480 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20481 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020482 xmlResetLastError();
20483 if (mem_base != xmlMemBlocks()) {
20484 printf("Leak of %d blocks found in xmlNewNs",
20485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020486 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020487 printf(" %d", n_node);
20488 printf(" %d", n_href);
20489 printf(" %d", n_prefix);
20490 printf("\n");
20491 }
20492 }
20493 }
20494 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020495 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020496
Daniel Veillard42595322004-11-08 10:52:06 +000020497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020498}
20499
20500
20501static int
20502test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020504
Daniel Veillard57b25162004-11-06 14:50:18 +000020505 int mem_base;
20506 xmlAttrPtr ret_val;
20507 xmlNodePtr node; /* the holding node */
20508 int n_node;
20509 xmlNsPtr ns; /* the namespace */
20510 int n_ns;
20511 xmlChar * name; /* the name of the attribute */
20512 int n_name;
20513 xmlChar * value; /* the value of the attribute */
20514 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020515
Daniel Veillard57b25162004-11-06 14:50:18 +000020516 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20517 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20518 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20519 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20520 mem_base = xmlMemBlocks();
20521 node = gen_xmlNodePtr(n_node, 0);
20522 ns = gen_xmlNsPtr(n_ns, 1);
20523 name = gen_const_xmlChar_ptr(n_name, 2);
20524 value = gen_const_xmlChar_ptr(n_value, 3);
20525
William M. Brackf13f77f2004-11-12 16:03:48 +000020526 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020527 desret_xmlAttrPtr(ret_val);
20528 call_tests++;
20529 des_xmlNodePtr(n_node, node, 0);
20530 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020531 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20532 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020533 xmlResetLastError();
20534 if (mem_base != xmlMemBlocks()) {
20535 printf("Leak of %d blocks found in xmlNewNsProp",
20536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020537 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020538 printf(" %d", n_node);
20539 printf(" %d", n_ns);
20540 printf(" %d", n_name);
20541 printf(" %d", n_value);
20542 printf("\n");
20543 }
20544 }
20545 }
20546 }
20547 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020548 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020549
Daniel Veillard42595322004-11-08 10:52:06 +000020550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020551}
20552
20553
20554static int
20555test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020557
Daniel Veillard57b25162004-11-06 14:50:18 +000020558 int mem_base;
20559 xmlAttrPtr ret_val;
20560 xmlNodePtr node; /* the holding node */
20561 int n_node;
20562 xmlNsPtr ns; /* the namespace */
20563 int n_ns;
20564 xmlChar * name; /* the name of the attribute */
20565 int n_name;
20566 xmlChar * value; /* the value of the attribute */
20567 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020568
Daniel Veillard57b25162004-11-06 14:50:18 +000020569 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20570 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20571 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20572 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20573 mem_base = xmlMemBlocks();
20574 node = gen_xmlNodePtr(n_node, 0);
20575 ns = gen_xmlNsPtr(n_ns, 1);
20576 name = gen_eaten_name(n_name, 2);
20577 value = gen_const_xmlChar_ptr(n_value, 3);
20578
William M. Brackf13f77f2004-11-12 16:03:48 +000020579 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020580 desret_xmlAttrPtr(ret_val);
20581 call_tests++;
20582 des_xmlNodePtr(n_node, node, 0);
20583 des_xmlNsPtr(n_ns, ns, 1);
20584 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020585 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020586 xmlResetLastError();
20587 if (mem_base != xmlMemBlocks()) {
20588 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020590 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020591 printf(" %d", n_node);
20592 printf(" %d", n_ns);
20593 printf(" %d", n_name);
20594 printf(" %d", n_value);
20595 printf("\n");
20596 }
20597 }
20598 }
20599 }
20600 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020602
Daniel Veillard42595322004-11-08 10:52:06 +000020603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020604}
20605
20606
20607static int
20608test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020610
20611 int mem_base;
20612 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020613 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020614 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020615 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020616 int n_content;
20617
20618 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20619 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20620 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020621 name = gen_const_xmlChar_ptr(n_name, 0);
20622 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020623
William M. Brackf13f77f2004-11-12 16:03:48 +000020624 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020625 desret_xmlNodePtr(ret_val);
20626 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020627 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20628 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020629 xmlResetLastError();
20630 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020631 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020633 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020634 printf(" %d", n_name);
20635 printf(" %d", n_content);
20636 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020637 }
20638 }
20639 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020641
Daniel Veillard42595322004-11-08 10:52:06 +000020642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020643}
20644
20645
20646static int
20647test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020649
William M. Brack21e4ef22005-01-02 09:53:13 +000020650#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020651#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020652 int mem_base;
20653 xmlAttrPtr ret_val;
20654 xmlNodePtr node; /* the holding node */
20655 int n_node;
20656 xmlChar * name; /* the name of the attribute */
20657 int n_name;
20658 xmlChar * value; /* the value of the attribute */
20659 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020660
Daniel Veillard57b25162004-11-06 14:50:18 +000020661 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20662 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20663 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20664 mem_base = xmlMemBlocks();
20665 node = gen_xmlNodePtr(n_node, 0);
20666 name = gen_const_xmlChar_ptr(n_name, 1);
20667 value = gen_const_xmlChar_ptr(n_value, 2);
20668
William M. Brackf13f77f2004-11-12 16:03:48 +000020669 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020670 desret_xmlAttrPtr(ret_val);
20671 call_tests++;
20672 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020673 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20674 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020675 xmlResetLastError();
20676 if (mem_base != xmlMemBlocks()) {
20677 printf("Leak of %d blocks found in xmlNewProp",
20678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020679 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020680 printf(" %d", n_node);
20681 printf(" %d", n_name);
20682 printf(" %d", n_value);
20683 printf("\n");
20684 }
20685 }
20686 }
20687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020688 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020689#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020690#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020691
Daniel Veillard42595322004-11-08 10:52:06 +000020692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020693}
20694
20695
20696static int
20697test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020699
20700 int mem_base;
20701 xmlNodePtr ret_val;
20702 xmlDocPtr doc; /* the document */
20703 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020704 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020705 int n_name;
20706
20707 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20708 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020710 doc = gen_xmlDocPtr(n_doc, 0);
20711 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020712
William M. Brackf13f77f2004-11-12 16:03:48 +000020713 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020714 desret_xmlNodePtr(ret_val);
20715 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020716 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020717 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020718 xmlResetLastError();
20719 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020720 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020722 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020723 printf(" %d", n_doc);
20724 printf(" %d", n_name);
20725 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020726 }
20727 }
20728 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020729 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020730
Daniel Veillard42595322004-11-08 10:52:06 +000020731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020732}
20733
20734
20735static int
20736test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020738
20739 int mem_base;
20740 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020741 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020742 int n_content;
20743
20744 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20745 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020746 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020747
William M. Brackf13f77f2004-11-12 16:03:48 +000020748 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020749 desret_xmlNodePtr(ret_val);
20750 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020751 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020752 xmlResetLastError();
20753 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020754 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020755 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020756 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020757 printf(" %d", n_content);
20758 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020759 }
20760 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020761 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020762
Daniel Veillard42595322004-11-08 10:52:06 +000020763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020764}
20765
20766
20767static int
20768test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020770
William M. Brack21e4ef22005-01-02 09:53:13 +000020771#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020772#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020773 int mem_base;
20774 xmlNodePtr ret_val;
20775 xmlNodePtr parent; /* the parent node */
20776 int n_parent;
20777 xmlNsPtr ns; /* a namespace if any */
20778 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020779 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020780 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020781 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020782 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020783
Daniel Veillard27f20102004-11-05 11:50:11 +000020784 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20785 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20786 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20787 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20788 mem_base = xmlMemBlocks();
20789 parent = gen_xmlNodePtr(n_parent, 0);
20790 ns = gen_xmlNsPtr(n_ns, 1);
20791 name = gen_const_xmlChar_ptr(n_name, 2);
20792 content = gen_const_xmlChar_ptr(n_content, 3);
20793
William M. Brackf13f77f2004-11-12 16:03:48 +000020794 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020795 desret_xmlNodePtr(ret_val);
20796 call_tests++;
20797 des_xmlNodePtr(n_parent, parent, 0);
20798 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020799 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20800 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020801 xmlResetLastError();
20802 if (mem_base != xmlMemBlocks()) {
20803 printf("Leak of %d blocks found in xmlNewTextChild",
20804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020805 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020806 printf(" %d", n_parent);
20807 printf(" %d", n_ns);
20808 printf(" %d", n_name);
20809 printf(" %d", n_content);
20810 printf("\n");
20811 }
20812 }
20813 }
20814 }
20815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020816 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020817#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020818#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020819
Daniel Veillard42595322004-11-08 10:52:06 +000020820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020821}
20822
20823
20824static int
20825test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020827
20828 int mem_base;
20829 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020830 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020831 int n_content;
20832 int len; /* the text len. */
20833 int n_len;
20834
20835 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20836 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020838 content = gen_const_xmlChar_ptr(n_content, 0);
20839 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020840
William M. Brackf13f77f2004-11-12 16:03:48 +000020841 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020842 desret_xmlNodePtr(ret_val);
20843 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020844 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020845 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020846 xmlResetLastError();
20847 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020848 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020850 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020851 printf(" %d", n_content);
20852 printf(" %d", n_len);
20853 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020854 }
20855 }
20856 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020857 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020858
Daniel Veillard42595322004-11-08 10:52:06 +000020859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020860}
20861
20862
20863static int
20864test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020866
20867 int mem_base;
20868 xmlNodePtr cur; /* the node being modified */
20869 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020870 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020871 int n_content;
20872
20873 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20874 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20875 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020876 cur = gen_xmlNodePtr(n_cur, 0);
20877 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020878
William M. Brackf13f77f2004-11-12 16:03:48 +000020879 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020880 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020881 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020882 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020883 xmlResetLastError();
20884 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020885 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020887 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020888 printf(" %d", n_cur);
20889 printf(" %d", n_content);
20890 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020891 }
20892 }
20893 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020894 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020895
Daniel Veillard42595322004-11-08 10:52:06 +000020896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020897}
20898
20899
20900static int
20901test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020903
20904 int mem_base;
20905 xmlNodePtr cur; /* the node being modified */
20906 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020907 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020908 int n_content;
20909 int len; /* the size of @content */
20910 int n_len;
20911
20912 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20913 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20914 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020916 cur = gen_xmlNodePtr(n_cur, 0);
20917 content = gen_const_xmlChar_ptr(n_content, 1);
20918 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020919
William M. Brackf13f77f2004-11-12 16:03:48 +000020920 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020922 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020923 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020924 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020925 xmlResetLastError();
20926 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020927 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020929 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020930 printf(" %d", n_cur);
20931 printf(" %d", n_content);
20932 printf(" %d", n_len);
20933 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020934 }
20935 }
20936 }
20937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020939
Daniel Veillard42595322004-11-08 10:52:06 +000020940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020941}
20942
20943
20944static int
20945test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020947
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020948 int mem_base;
20949 int ret_val;
20950 xmlBufferPtr buffer; /* a buffer */
20951 int n_buffer;
20952 xmlNodePtr cur; /* the node being read */
20953 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020954
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020955 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20956 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020958 buffer = gen_xmlBufferPtr(n_buffer, 0);
20959 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020960
20961 ret_val = xmlNodeBufGetContent(buffer, cur);
20962 desret_int(ret_val);
20963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020964 des_xmlBufferPtr(n_buffer, buffer, 0);
20965 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020966 xmlResetLastError();
20967 if (mem_base != xmlMemBlocks()) {
20968 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020970 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020971 printf(" %d", n_buffer);
20972 printf(" %d", n_cur);
20973 printf("\n");
20974 }
20975 }
20976 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020978
Daniel Veillard42595322004-11-08 10:52:06 +000020979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020980}
20981
20982
20983static int
20984test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020986
William M. Brack21e4ef22005-01-02 09:53:13 +000020987#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020988 int mem_base;
20989 int ret_val;
20990 xmlBufferPtr buf; /* the XML buffer output */
20991 int n_buf;
20992 xmlDocPtr doc; /* the document */
20993 int n_doc;
20994 xmlNodePtr cur; /* the current node */
20995 int n_cur;
20996 int level; /* the imbrication level for indenting */
20997 int n_level;
20998 int format; /* is formatting allowed */
20999 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021000
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021001 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21002 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21003 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21004 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21005 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21006 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021007 buf = gen_xmlBufferPtr(n_buf, 0);
21008 doc = gen_xmlDocPtr(n_doc, 1);
21009 cur = gen_xmlNodePtr(n_cur, 2);
21010 level = gen_int(n_level, 3);
21011 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021012
21013 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21014 desret_int(ret_val);
21015 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021016 des_xmlBufferPtr(n_buf, buf, 0);
21017 des_xmlDocPtr(n_doc, doc, 1);
21018 des_xmlNodePtr(n_cur, cur, 2);
21019 des_int(n_level, level, 3);
21020 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021021 xmlResetLastError();
21022 if (mem_base != xmlMemBlocks()) {
21023 printf("Leak of %d blocks found in xmlNodeDump",
21024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021025 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021026 printf(" %d", n_buf);
21027 printf(" %d", n_doc);
21028 printf(" %d", n_cur);
21029 printf(" %d", n_level);
21030 printf(" %d", n_format);
21031 printf("\n");
21032 }
21033 }
21034 }
21035 }
21036 }
21037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021038 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021039#endif
21040
Daniel Veillard42595322004-11-08 10:52:06 +000021041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021042}
21043
21044
21045static int
21046test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021048
William M. Brack21e4ef22005-01-02 09:53:13 +000021049#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021050 int mem_base;
21051 xmlOutputBufferPtr buf; /* the XML buffer output */
21052 int n_buf;
21053 xmlDocPtr doc; /* the document */
21054 int n_doc;
21055 xmlNodePtr cur; /* the current node */
21056 int n_cur;
21057 int level; /* the imbrication level for indenting */
21058 int n_level;
21059 int format; /* is formatting allowed */
21060 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021061 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021062 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021063
Daniel Veillard3d97e662004-11-04 10:49:00 +000021064 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21065 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21066 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21067 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21068 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21069 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21070 mem_base = xmlMemBlocks();
21071 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21072 doc = gen_xmlDocPtr(n_doc, 1);
21073 cur = gen_xmlNodePtr(n_cur, 2);
21074 level = gen_int(n_level, 3);
21075 format = gen_int(n_format, 4);
21076 encoding = gen_const_char_ptr(n_encoding, 5);
21077
William M. Brackf13f77f2004-11-12 16:03:48 +000021078 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021079 call_tests++;
21080 des_xmlOutputBufferPtr(n_buf, buf, 0);
21081 des_xmlDocPtr(n_doc, doc, 1);
21082 des_xmlNodePtr(n_cur, cur, 2);
21083 des_int(n_level, level, 3);
21084 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021085 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021086 xmlResetLastError();
21087 if (mem_base != xmlMemBlocks()) {
21088 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021090 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021091 printf(" %d", n_buf);
21092 printf(" %d", n_doc);
21093 printf(" %d", n_cur);
21094 printf(" %d", n_level);
21095 printf(" %d", n_format);
21096 printf(" %d", n_encoding);
21097 printf("\n");
21098 }
21099 }
21100 }
21101 }
21102 }
21103 }
21104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021105 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021106#endif
21107
Daniel Veillard42595322004-11-08 10:52:06 +000021108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021109}
21110
21111
21112static int
21113test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021115
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021116 int mem_base;
21117 xmlChar * ret_val;
21118 xmlDocPtr doc; /* the document the node pertains to */
21119 int n_doc;
21120 xmlNodePtr cur; /* the node being checked */
21121 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021122
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021123 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21124 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021126 doc = gen_xmlDocPtr(n_doc, 0);
21127 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021128
21129 ret_val = xmlNodeGetBase(doc, cur);
21130 desret_xmlChar_ptr(ret_val);
21131 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021132 des_xmlDocPtr(n_doc, doc, 0);
21133 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021134 xmlResetLastError();
21135 if (mem_base != xmlMemBlocks()) {
21136 printf("Leak of %d blocks found in xmlNodeGetBase",
21137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021138 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021139 printf(" %d", n_doc);
21140 printf(" %d", n_cur);
21141 printf("\n");
21142 }
21143 }
21144 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021145 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021146
Daniel Veillard42595322004-11-08 10:52:06 +000021147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021148}
21149
21150
21151static int
21152test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021154
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021155 int mem_base;
21156 xmlChar * ret_val;
21157 xmlNodePtr cur; /* the node being read */
21158 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021159
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021160 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21161 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021162 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021163
21164 ret_val = xmlNodeGetContent(cur);
21165 desret_xmlChar_ptr(ret_val);
21166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021167 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021168 xmlResetLastError();
21169 if (mem_base != xmlMemBlocks()) {
21170 printf("Leak of %d blocks found in xmlNodeGetContent",
21171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021172 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021173 printf(" %d", n_cur);
21174 printf("\n");
21175 }
21176 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021178
Daniel Veillard42595322004-11-08 10:52:06 +000021179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021180}
21181
21182
21183static int
21184test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021186
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021187 int mem_base;
21188 xmlChar * ret_val;
21189 xmlNodePtr cur; /* the node being checked */
21190 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021191
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021192 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21193 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021194 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021195
21196 ret_val = xmlNodeGetLang(cur);
21197 desret_xmlChar_ptr(ret_val);
21198 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021199 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021200 xmlResetLastError();
21201 if (mem_base != xmlMemBlocks()) {
21202 printf("Leak of %d blocks found in xmlNodeGetLang",
21203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021204 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021205 printf(" %d", n_cur);
21206 printf("\n");
21207 }
21208 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021209 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021210
Daniel Veillard42595322004-11-08 10:52:06 +000021211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021212}
21213
21214
21215static int
21216test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021218
21219 int mem_base;
21220 int ret_val;
21221 xmlNodePtr cur; /* the node being checked */
21222 int n_cur;
21223
21224 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21225 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021226 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021227
21228 ret_val = xmlNodeGetSpacePreserve(cur);
21229 desret_int(ret_val);
21230 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021231 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021232 xmlResetLastError();
21233 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021234 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021236 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021237 printf(" %d", n_cur);
21238 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021239 }
21240 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021241 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021242
Daniel Veillard42595322004-11-08 10:52:06 +000021243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021244}
21245
21246
21247static int
21248test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021250
21251 int mem_base;
21252 int ret_val;
21253 xmlNodePtr node; /* the node */
21254 int n_node;
21255
21256 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021258 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021259
21260 ret_val = xmlNodeIsText(node);
21261 desret_int(ret_val);
21262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021263 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021264 xmlResetLastError();
21265 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021266 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021268 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021269 printf(" %d", n_node);
21270 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021271 }
21272 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021274
Daniel Veillard42595322004-11-08 10:52:06 +000021275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021276}
21277
21278
21279static int
21280test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021282
William M. Brack21e4ef22005-01-02 09:53:13 +000021283#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021284 int mem_base;
21285 xmlChar * ret_val;
21286 xmlDocPtr doc; /* the document */
21287 int n_doc;
21288 xmlNodePtr list; /* a Node list */
21289 int n_list;
21290 int inLine; /* should we replace entity contents or show their external form */
21291 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021292
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021293 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21294 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21295 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21296 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021297 doc = gen_xmlDocPtr(n_doc, 0);
21298 list = gen_xmlNodePtr(n_list, 1);
21299 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021300
21301 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21302 desret_xmlChar_ptr(ret_val);
21303 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021304 des_xmlDocPtr(n_doc, doc, 0);
21305 des_xmlNodePtr(n_list, list, 1);
21306 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021307 xmlResetLastError();
21308 if (mem_base != xmlMemBlocks()) {
21309 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021311 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021312 printf(" %d", n_doc);
21313 printf(" %d", n_list);
21314 printf(" %d", n_inLine);
21315 printf("\n");
21316 }
21317 }
21318 }
21319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021320 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021321#endif
21322
Daniel Veillard42595322004-11-08 10:52:06 +000021323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021324}
21325
21326
21327static int
21328test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021330
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021331 int mem_base;
21332 xmlChar * ret_val;
21333 xmlDocPtr doc; /* the document */
21334 int n_doc;
21335 xmlNodePtr list; /* a Node list */
21336 int n_list;
21337 int inLine; /* should we replace entity contents or show their external form */
21338 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021339
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021340 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21341 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21342 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21343 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021344 doc = gen_xmlDocPtr(n_doc, 0);
21345 list = gen_xmlNodePtr(n_list, 1);
21346 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021347
21348 ret_val = xmlNodeListGetString(doc, list, inLine);
21349 desret_xmlChar_ptr(ret_val);
21350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021351 des_xmlDocPtr(n_doc, doc, 0);
21352 des_xmlNodePtr(n_list, list, 1);
21353 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021354 xmlResetLastError();
21355 if (mem_base != xmlMemBlocks()) {
21356 printf("Leak of %d blocks found in xmlNodeListGetString",
21357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021358 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021359 printf(" %d", n_doc);
21360 printf(" %d", n_list);
21361 printf(" %d", n_inLine);
21362 printf("\n");
21363 }
21364 }
21365 }
21366 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021368
Daniel Veillard42595322004-11-08 10:52:06 +000021369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021370}
21371
21372
21373static int
21374test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021376
William M. Brack21e4ef22005-01-02 09:53:13 +000021377#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021378 int mem_base;
21379 xmlNodePtr cur; /* the node being changed */
21380 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021381 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021382 int n_uri;
21383
21384 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21385 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021387 cur = gen_xmlNodePtr(n_cur, 0);
21388 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021389
William M. Brackf13f77f2004-11-12 16:03:48 +000021390 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021391 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021392 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021393 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021394 xmlResetLastError();
21395 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021396 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021398 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021399 printf(" %d", n_cur);
21400 printf(" %d", n_uri);
21401 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021402 }
21403 }
21404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021405 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406#endif
21407
Daniel Veillard42595322004-11-08 10:52:06 +000021408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021409}
21410
21411
21412static int
21413test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021415
21416 int mem_base;
21417 xmlNodePtr cur; /* the node being modified */
21418 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021419 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021420 int n_content;
21421
21422 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21423 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021425 cur = gen_xmlNodePtr(n_cur, 0);
21426 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021427
William M. Brackf13f77f2004-11-12 16:03:48 +000021428 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021430 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021431 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021432 xmlResetLastError();
21433 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021434 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021436 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021437 printf(" %d", n_cur);
21438 printf(" %d", n_content);
21439 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021440 }
21441 }
21442 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021443 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021444
Daniel Veillard42595322004-11-08 10:52:06 +000021445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021446}
21447
21448
21449static int
21450test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021452
William M. Brack21e4ef22005-01-02 09:53:13 +000021453#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021454 int mem_base;
21455 xmlNodePtr cur; /* the node being modified */
21456 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021457 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021458 int n_content;
21459 int len; /* the size of @content */
21460 int n_len;
21461
21462 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21463 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21464 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021466 cur = gen_xmlNodePtr(n_cur, 0);
21467 content = gen_const_xmlChar_ptr(n_content, 1);
21468 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021469
William M. Brackf13f77f2004-11-12 16:03:48 +000021470 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021472 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021473 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021474 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021475 xmlResetLastError();
21476 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021477 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021479 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021480 printf(" %d", n_cur);
21481 printf(" %d", n_content);
21482 printf(" %d", n_len);
21483 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021484 }
21485 }
21486 }
21487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021488 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021489#endif
21490
Daniel Veillard42595322004-11-08 10:52:06 +000021491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021492}
21493
21494
21495static int
21496test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021498
William M. Brack21e4ef22005-01-02 09:53:13 +000021499#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021500 int mem_base;
21501 xmlNodePtr cur; /* the node being changed */
21502 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021503 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021504 int n_lang;
21505
21506 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21507 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021509 cur = gen_xmlNodePtr(n_cur, 0);
21510 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021511
William M. Brackf13f77f2004-11-12 16:03:48 +000021512 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021514 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021515 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021516 xmlResetLastError();
21517 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021518 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021520 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021521 printf(" %d", n_cur);
21522 printf(" %d", n_lang);
21523 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021524 }
21525 }
21526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021527 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021528#endif
21529
Daniel Veillard42595322004-11-08 10:52:06 +000021530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021531}
21532
21533
21534static int
21535test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021537
William M. Brack21e4ef22005-01-02 09:53:13 +000021538#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021539 int mem_base;
21540 xmlNodePtr cur; /* the node being changed */
21541 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021542 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021543 int n_name;
21544
21545 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21546 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21547 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021548 cur = gen_xmlNodePtr(n_cur, 0);
21549 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021550
William M. Brackf13f77f2004-11-12 16:03:48 +000021551 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021552 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021553 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021554 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021555 xmlResetLastError();
21556 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021557 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021559 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021560 printf(" %d", n_cur);
21561 printf(" %d", n_name);
21562 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021563 }
21564 }
21565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021566 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021567#endif
21568
Daniel Veillard42595322004-11-08 10:52:06 +000021569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021570}
21571
21572
21573static int
21574test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021576
William M. Brack21e4ef22005-01-02 09:53:13 +000021577#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021578 int mem_base;
21579 xmlNodePtr cur; /* the node being changed */
21580 int n_cur;
21581 int val; /* the xml:space value ("0": default, 1: "preserve") */
21582 int n_val;
21583
21584 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21585 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021587 cur = gen_xmlNodePtr(n_cur, 0);
21588 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021589
21590 xmlNodeSetSpacePreserve(cur, val);
21591 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021592 des_xmlNodePtr(n_cur, cur, 0);
21593 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021594 xmlResetLastError();
21595 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021596 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021598 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021599 printf(" %d", n_cur);
21600 printf(" %d", n_val);
21601 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021602 }
21603 }
21604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021605 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606#endif
21607
Daniel Veillard42595322004-11-08 10:52:06 +000021608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021609}
21610
21611
21612static int
21613test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021615
William M. Brack21e4ef22005-01-02 09:53:13 +000021616#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021617#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021618 int mem_base;
21619 int ret_val;
21620 xmlDocPtr doc; /* the document */
21621 int n_doc;
21622 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21623 int n_tree;
21624
21625 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21626 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21627 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021628 doc = gen_xmlDocPtr(n_doc, 0);
21629 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021630
21631 ret_val = xmlReconciliateNs(doc, tree);
21632 desret_int(ret_val);
21633 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021634 des_xmlDocPtr(n_doc, doc, 0);
21635 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021636 xmlResetLastError();
21637 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021638 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021640 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021641 printf(" %d", n_doc);
21642 printf(" %d", n_tree);
21643 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021644 }
21645 }
21646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021647 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021648#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021649#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021650
Daniel Veillard42595322004-11-08 10:52:06 +000021651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021652}
21653
21654
21655static int
21656test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021658
William M. Brack21e4ef22005-01-02 09:53:13 +000021659#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021660 int mem_base;
21661 int ret_val;
21662 xmlAttrPtr cur; /* an attribute */
21663 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021664
Daniel Veillardce244ad2004-11-05 10:03:46 +000021665 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21666 mem_base = xmlMemBlocks();
21667 cur = gen_xmlAttrPtr(n_cur, 0);
21668
21669 ret_val = xmlRemoveProp(cur);
21670 cur = NULL;
21671 desret_int(ret_val);
21672 call_tests++;
21673 des_xmlAttrPtr(n_cur, cur, 0);
21674 xmlResetLastError();
21675 if (mem_base != xmlMemBlocks()) {
21676 printf("Leak of %d blocks found in xmlRemoveProp",
21677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021678 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021679 printf(" %d", n_cur);
21680 printf("\n");
21681 }
21682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021683 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021684#endif
21685
Daniel Veillard42595322004-11-08 10:52:06 +000021686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687}
21688
21689
21690static int
21691test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021693
William M. Brack21e4ef22005-01-02 09:53:13 +000021694#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021695 int mem_base;
21696 xmlNodePtr ret_val;
21697 xmlNodePtr old; /* the old node */
21698 int n_old;
21699 xmlNodePtr cur; /* the node */
21700 int n_cur;
21701
21702 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021703 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021705 old = gen_xmlNodePtr(n_old, 0);
21706 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021707
21708 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021709 if (cur != NULL) {
21710 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021711 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021712 if (old != NULL) {
21713 xmlUnlinkNode(old);
21714 xmlFreeNode(old) ; old = NULL ; }
21715 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021716 desret_xmlNodePtr(ret_val);
21717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021718 des_xmlNodePtr(n_old, old, 0);
21719 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021720 xmlResetLastError();
21721 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021722 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021724 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021725 printf(" %d", n_old);
21726 printf(" %d", n_cur);
21727 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021728 }
21729 }
21730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021731 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021732#endif
21733
Daniel Veillard42595322004-11-08 10:52:06 +000021734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021735}
21736
21737
21738static int
21739test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021741
William M. Brack21e4ef22005-01-02 09:53:13 +000021742#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021743 int mem_base;
21744 int ret_val;
21745 const char * filename; /* the filename (or URL) */
21746 int n_filename;
21747 xmlDocPtr cur; /* the document */
21748 int n_cur;
21749
21750 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21751 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021753 filename = gen_fileoutput(n_filename, 0);
21754 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021755
21756 ret_val = xmlSaveFile(filename, cur);
21757 desret_int(ret_val);
21758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021759 des_fileoutput(n_filename, filename, 0);
21760 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021761 xmlResetLastError();
21762 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021763 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021765 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021766 printf(" %d", n_filename);
21767 printf(" %d", n_cur);
21768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021769 }
21770 }
21771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021772 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773#endif
21774
Daniel Veillard42595322004-11-08 10:52:06 +000021775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776}
21777
21778
21779static int
21780test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021782
William M. Brack21e4ef22005-01-02 09:53:13 +000021783#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021784 int mem_base;
21785 int ret_val;
21786 const char * filename; /* the filename (or URL) */
21787 int n_filename;
21788 xmlDocPtr cur; /* the document */
21789 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021790 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021791 int n_encoding;
21792
21793 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21794 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21795 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021797 filename = gen_fileoutput(n_filename, 0);
21798 cur = gen_xmlDocPtr(n_cur, 1);
21799 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021800
William M. Brackf13f77f2004-11-12 16:03:48 +000021801 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021802 desret_int(ret_val);
21803 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021804 des_fileoutput(n_filename, filename, 0);
21805 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021806 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021807 xmlResetLastError();
21808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021809 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021812 printf(" %d", n_filename);
21813 printf(" %d", n_cur);
21814 printf(" %d", n_encoding);
21815 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021816 }
21817 }
21818 }
21819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021820 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021821#endif
21822
Daniel Veillard42595322004-11-08 10:52:06 +000021823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021824}
21825
21826
21827static int
21828test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021830
William M. Brack21e4ef22005-01-02 09:53:13 +000021831#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021832 int mem_base;
21833 int ret_val;
21834 xmlOutputBufferPtr buf; /* an output I/O buffer */
21835 int n_buf;
21836 xmlDocPtr cur; /* the document */
21837 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021838 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021839 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021840
Daniel Veillard3d97e662004-11-04 10:49:00 +000021841 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21842 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21843 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21844 mem_base = xmlMemBlocks();
21845 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21846 cur = gen_xmlDocPtr(n_cur, 1);
21847 encoding = gen_const_char_ptr(n_encoding, 2);
21848
William M. Brackf13f77f2004-11-12 16:03:48 +000021849 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021850 buf = NULL;
21851 desret_int(ret_val);
21852 call_tests++;
21853 des_xmlOutputBufferPtr(n_buf, buf, 0);
21854 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021855 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021856 xmlResetLastError();
21857 if (mem_base != xmlMemBlocks()) {
21858 printf("Leak of %d blocks found in xmlSaveFileTo",
21859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021860 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021861 printf(" %d", n_buf);
21862 printf(" %d", n_cur);
21863 printf(" %d", n_encoding);
21864 printf("\n");
21865 }
21866 }
21867 }
21868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021869 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021870#endif
21871
Daniel Veillard42595322004-11-08 10:52:06 +000021872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021873}
21874
21875
21876static int
21877test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021879
William M. Brack21e4ef22005-01-02 09:53:13 +000021880#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021881 int mem_base;
21882 int ret_val;
21883 const char * filename; /* the filename (or URL) */
21884 int n_filename;
21885 xmlDocPtr cur; /* the document */
21886 int n_cur;
21887 int format; /* should formatting spaces been added */
21888 int n_format;
21889
21890 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21891 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21892 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21893 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021894 filename = gen_fileoutput(n_filename, 0);
21895 cur = gen_xmlDocPtr(n_cur, 1);
21896 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021897
21898 ret_val = xmlSaveFormatFile(filename, cur, format);
21899 desret_int(ret_val);
21900 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021901 des_fileoutput(n_filename, filename, 0);
21902 des_xmlDocPtr(n_cur, cur, 1);
21903 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021904 xmlResetLastError();
21905 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021906 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021908 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021909 printf(" %d", n_filename);
21910 printf(" %d", n_cur);
21911 printf(" %d", n_format);
21912 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021913 }
21914 }
21915 }
21916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021917 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021918#endif
21919
Daniel Veillard42595322004-11-08 10:52:06 +000021920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021921}
21922
21923
21924static int
21925test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021927
William M. Brack21e4ef22005-01-02 09:53:13 +000021928#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021929 int mem_base;
21930 int ret_val;
21931 const char * filename; /* the filename or URL to output */
21932 int n_filename;
21933 xmlDocPtr cur; /* the document being saved */
21934 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021935 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021936 int n_encoding;
21937 int format; /* should formatting spaces be added. */
21938 int n_format;
21939
21940 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21941 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21942 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21943 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021945 filename = gen_fileoutput(n_filename, 0);
21946 cur = gen_xmlDocPtr(n_cur, 1);
21947 encoding = gen_const_char_ptr(n_encoding, 2);
21948 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021949
William M. Brackf13f77f2004-11-12 16:03:48 +000021950 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021951 desret_int(ret_val);
21952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021953 des_fileoutput(n_filename, filename, 0);
21954 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021955 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021956 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021957 xmlResetLastError();
21958 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021959 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021961 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021962 printf(" %d", n_filename);
21963 printf(" %d", n_cur);
21964 printf(" %d", n_encoding);
21965 printf(" %d", n_format);
21966 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021967 }
21968 }
21969 }
21970 }
21971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021972 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021973#endif
21974
Daniel Veillard42595322004-11-08 10:52:06 +000021975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021976}
21977
21978
21979static int
21980test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021982
William M. Brack21e4ef22005-01-02 09:53:13 +000021983#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021984 int mem_base;
21985 int ret_val;
21986 xmlOutputBufferPtr buf; /* an output I/O buffer */
21987 int n_buf;
21988 xmlDocPtr cur; /* the document */
21989 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021990 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021991 int n_encoding;
21992 int format; /* should formatting spaces been added */
21993 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021994
Daniel Veillard3d97e662004-11-04 10:49:00 +000021995 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21996 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21997 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21998 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21999 mem_base = xmlMemBlocks();
22000 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22001 cur = gen_xmlDocPtr(n_cur, 1);
22002 encoding = gen_const_char_ptr(n_encoding, 2);
22003 format = gen_int(n_format, 3);
22004
William M. Brackf13f77f2004-11-12 16:03:48 +000022005 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022006 buf = NULL;
22007 desret_int(ret_val);
22008 call_tests++;
22009 des_xmlOutputBufferPtr(n_buf, buf, 0);
22010 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022011 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022012 des_int(n_format, format, 3);
22013 xmlResetLastError();
22014 if (mem_base != xmlMemBlocks()) {
22015 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022017 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022018 printf(" %d", n_buf);
22019 printf(" %d", n_cur);
22020 printf(" %d", n_encoding);
22021 printf(" %d", n_format);
22022 printf("\n");
22023 }
22024 }
22025 }
22026 }
22027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022028 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022029#endif
22030
Daniel Veillard42595322004-11-08 10:52:06 +000022031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022032}
22033
22034
22035static int
22036test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022038
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022039 int mem_base;
22040 xmlNsPtr ret_val;
22041 xmlDocPtr doc; /* the document */
22042 int n_doc;
22043 xmlNodePtr node; /* the current node */
22044 int n_node;
22045 xmlChar * nameSpace; /* the namespace prefix */
22046 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022047
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022048 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22049 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22050 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22051 mem_base = xmlMemBlocks();
22052 doc = gen_xmlDocPtr(n_doc, 0);
22053 node = gen_xmlNodePtr(n_node, 1);
22054 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22055
William M. Brackf13f77f2004-11-12 16:03:48 +000022056 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022057 desret_xmlNsPtr(ret_val);
22058 call_tests++;
22059 des_xmlDocPtr(n_doc, doc, 0);
22060 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022061 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022062 xmlResetLastError();
22063 if (mem_base != xmlMemBlocks()) {
22064 printf("Leak of %d blocks found in xmlSearchNs",
22065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022066 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022067 printf(" %d", n_doc);
22068 printf(" %d", n_node);
22069 printf(" %d", n_nameSpace);
22070 printf("\n");
22071 }
22072 }
22073 }
22074 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022076
Daniel Veillard42595322004-11-08 10:52:06 +000022077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022078}
22079
22080
22081static int
22082test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022084
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022085 int mem_base;
22086 xmlNsPtr ret_val;
22087 xmlDocPtr doc; /* the document */
22088 int n_doc;
22089 xmlNodePtr node; /* the current node */
22090 int n_node;
22091 xmlChar * href; /* the namespace value */
22092 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022093
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022094 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22095 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22096 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22097 mem_base = xmlMemBlocks();
22098 doc = gen_xmlDocPtr(n_doc, 0);
22099 node = gen_xmlNodePtr(n_node, 1);
22100 href = gen_const_xmlChar_ptr(n_href, 2);
22101
William M. Brackf13f77f2004-11-12 16:03:48 +000022102 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022103 desret_xmlNsPtr(ret_val);
22104 call_tests++;
22105 des_xmlDocPtr(n_doc, doc, 0);
22106 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022107 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022108 xmlResetLastError();
22109 if (mem_base != xmlMemBlocks()) {
22110 printf("Leak of %d blocks found in xmlSearchNsByHref",
22111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022112 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022113 printf(" %d", n_doc);
22114 printf(" %d", n_node);
22115 printf(" %d", n_href);
22116 printf("\n");
22117 }
22118 }
22119 }
22120 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022121 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022122
Daniel Veillard42595322004-11-08 10:52:06 +000022123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022124}
22125
22126
22127static int
22128test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022130
Daniel Veillard57b25162004-11-06 14:50:18 +000022131 int mem_base;
22132 xmlBufferAllocationScheme scheme; /* allocation method to use */
22133 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022134
Daniel Veillard57b25162004-11-06 14:50:18 +000022135 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22136 mem_base = xmlMemBlocks();
22137 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22138
22139 xmlSetBufferAllocationScheme(scheme);
22140 call_tests++;
22141 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22142 xmlResetLastError();
22143 if (mem_base != xmlMemBlocks()) {
22144 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022146 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022147 printf(" %d", n_scheme);
22148 printf("\n");
22149 }
22150 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022151 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022152
Daniel Veillard42595322004-11-08 10:52:06 +000022153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022154}
22155
22156
22157static int
22158test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022160
22161 int mem_base;
22162 int mode; /* the compression ratio */
22163 int n_mode;
22164
22165 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022167 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022168
22169 xmlSetCompressMode(mode);
22170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022171 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022172 xmlResetLastError();
22173 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022174 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022177 printf(" %d", n_mode);
22178 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022179 }
22180 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022182
Daniel Veillard42595322004-11-08 10:52:06 +000022183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022184}
22185
22186
22187static int
22188test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022190
22191 int mem_base;
22192 xmlDocPtr doc; /* the document */
22193 int n_doc;
22194 int mode; /* the compression ratio */
22195 int n_mode;
22196
22197 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22198 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022200 doc = gen_xmlDocPtr(n_doc, 0);
22201 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022202
22203 xmlSetDocCompressMode(doc, mode);
22204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022205 des_xmlDocPtr(n_doc, doc, 0);
22206 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022207 xmlResetLastError();
22208 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022209 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022212 printf(" %d", n_doc);
22213 printf(" %d", n_mode);
22214 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022215 }
22216 }
22217 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022219
Daniel Veillard42595322004-11-08 10:52:06 +000022220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022221}
22222
22223
22224static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022225test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022227
Daniel Veillard27f20102004-11-05 11:50:11 +000022228 int mem_base;
22229 xmlNodePtr node; /* a node in the document */
22230 int n_node;
22231 xmlNsPtr ns; /* a namespace pointer */
22232 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022233
Daniel Veillard27f20102004-11-05 11:50:11 +000022234 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22235 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22236 mem_base = xmlMemBlocks();
22237 node = gen_xmlNodePtr(n_node, 0);
22238 ns = gen_xmlNsPtr(n_ns, 1);
22239
22240 xmlSetNs(node, ns);
22241 call_tests++;
22242 des_xmlNodePtr(n_node, node, 0);
22243 des_xmlNsPtr(n_ns, ns, 1);
22244 xmlResetLastError();
22245 if (mem_base != xmlMemBlocks()) {
22246 printf("Leak of %d blocks found in xmlSetNs",
22247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022248 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022249 printf(" %d", n_node);
22250 printf(" %d", n_ns);
22251 printf("\n");
22252 }
22253 }
22254 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022256
Daniel Veillard42595322004-11-08 10:52:06 +000022257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022258}
22259
22260
22261static int
22262test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022264
William M. Brack21e4ef22005-01-02 09:53:13 +000022265#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022266 int mem_base;
22267 xmlAttrPtr ret_val;
22268 xmlNodePtr node; /* the node */
22269 int n_node;
22270 xmlNsPtr ns; /* the namespace definition */
22271 int n_ns;
22272 xmlChar * name; /* the attribute name */
22273 int n_name;
22274 xmlChar * value; /* the attribute value */
22275 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022276
Daniel Veillard57b25162004-11-06 14:50:18 +000022277 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22278 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22279 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22280 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22281 mem_base = xmlMemBlocks();
22282 node = gen_xmlNodePtr(n_node, 0);
22283 ns = gen_xmlNsPtr(n_ns, 1);
22284 name = gen_const_xmlChar_ptr(n_name, 2);
22285 value = gen_const_xmlChar_ptr(n_value, 3);
22286
William M. Brackf13f77f2004-11-12 16:03:48 +000022287 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022288 desret_xmlAttrPtr(ret_val);
22289 call_tests++;
22290 des_xmlNodePtr(n_node, node, 0);
22291 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022292 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22293 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022294 xmlResetLastError();
22295 if (mem_base != xmlMemBlocks()) {
22296 printf("Leak of %d blocks found in xmlSetNsProp",
22297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022298 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022299 printf(" %d", n_node);
22300 printf(" %d", n_ns);
22301 printf(" %d", n_name);
22302 printf(" %d", n_value);
22303 printf("\n");
22304 }
22305 }
22306 }
22307 }
22308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022309 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022310#endif
22311
Daniel Veillard42595322004-11-08 10:52:06 +000022312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022313}
22314
22315
22316static int
22317test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022319
William M. Brack21e4ef22005-01-02 09:53:13 +000022320#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022321 int mem_base;
22322 xmlAttrPtr ret_val;
22323 xmlNodePtr node; /* the node */
22324 int n_node;
22325 xmlChar * name; /* the attribute name */
22326 int n_name;
22327 xmlChar * value; /* the attribute value */
22328 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022329
Daniel Veillard57b25162004-11-06 14:50:18 +000022330 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22331 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22332 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22333 mem_base = xmlMemBlocks();
22334 node = gen_xmlNodePtr(n_node, 0);
22335 name = gen_const_xmlChar_ptr(n_name, 1);
22336 value = gen_const_xmlChar_ptr(n_value, 2);
22337
William M. Brackf13f77f2004-11-12 16:03:48 +000022338 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022339 desret_xmlAttrPtr(ret_val);
22340 call_tests++;
22341 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022342 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22343 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022344 xmlResetLastError();
22345 if (mem_base != xmlMemBlocks()) {
22346 printf("Leak of %d blocks found in xmlSetProp",
22347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022348 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022349 printf(" %d", n_node);
22350 printf(" %d", n_name);
22351 printf(" %d", n_value);
22352 printf("\n");
22353 }
22354 }
22355 }
22356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022357 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022358#endif
22359
Daniel Veillard42595322004-11-08 10:52:06 +000022360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022361}
22362
22363
22364static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022365test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022367
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022368 int mem_base;
22369 xmlChar * ret_val;
22370 xmlChar * name; /* the full QName */
22371 int n_name;
22372 xmlChar ** prefix; /* a xmlChar ** */
22373 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022374
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022375 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22376 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22377 mem_base = xmlMemBlocks();
22378 name = gen_const_xmlChar_ptr(n_name, 0);
22379 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22380
William M. Brackf13f77f2004-11-12 16:03:48 +000022381 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022382 desret_xmlChar_ptr(ret_val);
22383 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022384 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022385 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22386 xmlResetLastError();
22387 if (mem_base != xmlMemBlocks()) {
22388 printf("Leak of %d blocks found in xmlSplitQName2",
22389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022390 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022391 printf(" %d", n_name);
22392 printf(" %d", n_prefix);
22393 printf("\n");
22394 }
22395 }
22396 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022397 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022398
Daniel Veillard42595322004-11-08 10:52:06 +000022399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022400}
22401
22402
22403static int
22404test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022406
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022407 int mem_base;
22408 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022409 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022410 int n_name;
22411 int * len; /* an int * */
22412 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022413
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022414 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22415 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22416 mem_base = xmlMemBlocks();
22417 name = gen_const_xmlChar_ptr(n_name, 0);
22418 len = gen_int_ptr(n_len, 1);
22419
William M. Brackf13f77f2004-11-12 16:03:48 +000022420 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022421 desret_const_xmlChar_ptr(ret_val);
22422 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022423 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022424 des_int_ptr(n_len, len, 1);
22425 xmlResetLastError();
22426 if (mem_base != xmlMemBlocks()) {
22427 printf("Leak of %d blocks found in xmlSplitQName3",
22428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022429 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022430 printf(" %d", n_name);
22431 printf(" %d", n_len);
22432 printf("\n");
22433 }
22434 }
22435 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022436 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022437
Daniel Veillard42595322004-11-08 10:52:06 +000022438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022439}
22440
22441
22442static int
22443test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022445
22446 int mem_base;
22447 xmlNodePtr ret_val;
22448 xmlDocPtr doc; /* the document */
22449 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022450 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022451 int n_value;
22452
22453 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22454 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022456 doc = gen_xmlDocPtr(n_doc, 0);
22457 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022458
William M. Brackf13f77f2004-11-12 16:03:48 +000022459 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022460 desret_xmlNodePtr(ret_val);
22461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022462 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022463 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022464 xmlResetLastError();
22465 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022466 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022468 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022469 printf(" %d", n_doc);
22470 printf(" %d", n_value);
22471 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022472 }
22473 }
22474 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022475 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022476
Daniel Veillard42595322004-11-08 10:52:06 +000022477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022478}
22479
22480
22481static int
22482test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022484
22485 int mem_base;
22486 xmlNodePtr ret_val;
22487 xmlDocPtr doc; /* the document */
22488 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022489 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022490 int n_value;
22491 int len; /* the length of the string value */
22492 int n_len;
22493
22494 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22495 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22496 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022498 doc = gen_xmlDocPtr(n_doc, 0);
22499 value = gen_const_xmlChar_ptr(n_value, 1);
22500 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022501
William M. Brackf13f77f2004-11-12 16:03:48 +000022502 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022503 desret_xmlNodePtr(ret_val);
22504 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022505 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022506 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022507 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022508 xmlResetLastError();
22509 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022510 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022512 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022513 printf(" %d", n_doc);
22514 printf(" %d", n_value);
22515 printf(" %d", n_len);
22516 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022517 }
22518 }
22519 }
22520 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022522
Daniel Veillard42595322004-11-08 10:52:06 +000022523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022524}
22525
22526
22527static int
22528test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022530
22531 int mem_base;
22532 int ret_val;
22533 xmlNodePtr node; /* the node */
22534 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022535 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022536 int n_content;
22537 int len; /* @content length */
22538 int n_len;
22539
22540 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22541 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22542 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22543 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022544 node = gen_xmlNodePtr(n_node, 0);
22545 content = gen_const_xmlChar_ptr(n_content, 1);
22546 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022547
William M. Brackf13f77f2004-11-12 16:03:48 +000022548 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022549 desret_int(ret_val);
22550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022551 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022552 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022553 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022554 xmlResetLastError();
22555 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022556 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022558 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022559 printf(" %d", n_node);
22560 printf(" %d", n_content);
22561 printf(" %d", n_len);
22562 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022563 }
22564 }
22565 }
22566 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022568
Daniel Veillard42595322004-11-08 10:52:06 +000022569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022570}
22571
22572
22573static int
22574test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022576
22577 int mem_base;
22578 xmlNodePtr ret_val;
22579 xmlNodePtr first; /* the first text node */
22580 int n_first;
22581 xmlNodePtr second; /* the second text node being merged */
22582 int n_second;
22583
Daniel Veillarda03e3652004-11-02 18:45:30 +000022584 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22585 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022587 first = gen_xmlNodePtr_in(n_first, 0);
22588 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022589
22590 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022591 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022592 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022593 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022594 desret_xmlNodePtr(ret_val);
22595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022596 des_xmlNodePtr_in(n_first, first, 0);
22597 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022598 xmlResetLastError();
22599 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022600 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022602 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022603 printf(" %d", n_first);
22604 printf(" %d", n_second);
22605 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022606 }
22607 }
22608 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022609 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022610
Daniel Veillard42595322004-11-08 10:52:06 +000022611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022612}
22613
22614
22615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022616test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022618
William M. Brack21e4ef22005-01-02 09:53:13 +000022619#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022620 int mem_base;
22621 int ret_val;
22622 xmlNodePtr node; /* the node */
22623 int n_node;
22624 xmlNsPtr ns; /* the namespace definition */
22625 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022626 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022627 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022628
Daniel Veillard27f20102004-11-05 11:50:11 +000022629 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22630 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22631 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22632 mem_base = xmlMemBlocks();
22633 node = gen_xmlNodePtr(n_node, 0);
22634 ns = gen_xmlNsPtr(n_ns, 1);
22635 name = gen_const_xmlChar_ptr(n_name, 2);
22636
William M. Brackf13f77f2004-11-12 16:03:48 +000022637 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022638 desret_int(ret_val);
22639 call_tests++;
22640 des_xmlNodePtr(n_node, node, 0);
22641 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022642 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022643 xmlResetLastError();
22644 if (mem_base != xmlMemBlocks()) {
22645 printf("Leak of %d blocks found in xmlUnsetNsProp",
22646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022647 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022648 printf(" %d", n_node);
22649 printf(" %d", n_ns);
22650 printf(" %d", n_name);
22651 printf("\n");
22652 }
22653 }
22654 }
22655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022656 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022657#endif
22658
Daniel Veillard42595322004-11-08 10:52:06 +000022659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022660}
22661
22662
22663static int
22664test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022666
William M. Brack21e4ef22005-01-02 09:53:13 +000022667#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022668 int mem_base;
22669 int ret_val;
22670 xmlNodePtr node; /* the node */
22671 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022672 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022673 int n_name;
22674
22675 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22676 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22677 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022678 node = gen_xmlNodePtr(n_node, 0);
22679 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022680
William M. Brackf13f77f2004-11-12 16:03:48 +000022681 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682 desret_int(ret_val);
22683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022684 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022685 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022686 xmlResetLastError();
22687 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022688 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022690 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022691 printf(" %d", n_node);
22692 printf(" %d", n_name);
22693 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694 }
22695 }
22696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022697 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022698#endif
22699
Daniel Veillard42595322004-11-08 10:52:06 +000022700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022701}
22702
22703
22704static int
22705test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707
William M. Brack21e4ef22005-01-02 09:53:13 +000022708#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022709#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022710 int mem_base;
22711 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022712 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022713 int n_value;
22714 int space; /* allow spaces in front and end of the string */
22715 int n_space;
22716
22717 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22718 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022720 value = gen_const_xmlChar_ptr(n_value, 0);
22721 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022722
William M. Brackf13f77f2004-11-12 16:03:48 +000022723 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022724 desret_int(ret_val);
22725 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022726 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022727 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022728 xmlResetLastError();
22729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022730 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022733 printf(" %d", n_value);
22734 printf(" %d", n_space);
22735 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022736 }
22737 }
22738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022739 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022740#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022741#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022742
Daniel Veillard42595322004-11-08 10:52:06 +000022743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022744}
22745
22746
22747static int
22748test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022750
William M. Brack21e4ef22005-01-02 09:53:13 +000022751#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022752#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022753 int mem_base;
22754 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022755 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022756 int n_value;
22757 int space; /* allow spaces in front and end of the string */
22758 int n_space;
22759
22760 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22761 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022763 value = gen_const_xmlChar_ptr(n_value, 0);
22764 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022765
William M. Brackf13f77f2004-11-12 16:03:48 +000022766 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022767 desret_int(ret_val);
22768 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022769 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022770 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022771 xmlResetLastError();
22772 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022773 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022775 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022776 printf(" %d", n_value);
22777 printf(" %d", n_space);
22778 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022779 }
22780 }
22781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022782 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022783#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022784#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022785
Daniel Veillard42595322004-11-08 10:52:06 +000022786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022787}
22788
22789
22790static int
22791test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022793
William M. Brack21e4ef22005-01-02 09:53:13 +000022794#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022795#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022796 int mem_base;
22797 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022798 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022799 int n_value;
22800 int space; /* allow spaces in front and end of the string */
22801 int n_space;
22802
22803 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22804 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022806 value = gen_const_xmlChar_ptr(n_value, 0);
22807 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022808
William M. Brackf13f77f2004-11-12 16:03:48 +000022809 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022810 desret_int(ret_val);
22811 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022812 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022813 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022814 xmlResetLastError();
22815 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022816 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022818 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022819 printf(" %d", n_value);
22820 printf(" %d", n_space);
22821 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822 }
22823 }
22824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022825 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022826#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022827#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022828
Daniel Veillard42595322004-11-08 10:52:06 +000022829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022830}
22831
22832
22833static int
22834test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022836
William M. Brack21e4ef22005-01-02 09:53:13 +000022837#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022838#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022839 int mem_base;
22840 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022841 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022842 int n_value;
22843 int space; /* allow spaces in front and end of the string */
22844 int n_space;
22845
22846 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22847 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022849 value = gen_const_xmlChar_ptr(n_value, 0);
22850 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022851
William M. Brackf13f77f2004-11-12 16:03:48 +000022852 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022853 desret_int(ret_val);
22854 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022855 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022856 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857 xmlResetLastError();
22858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022859 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022862 printf(" %d", n_value);
22863 printf(" %d", n_space);
22864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022865 }
22866 }
22867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022868 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022869#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022870#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022871
Daniel Veillard42595322004-11-08 10:52:06 +000022872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022873}
22874
22875static int
22876test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022878
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022879 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022880 test_ret += test_xmlAddChild();
22881 test_ret += test_xmlAddChildList();
22882 test_ret += test_xmlAddNextSibling();
22883 test_ret += test_xmlAddPrevSibling();
22884 test_ret += test_xmlAddSibling();
22885 test_ret += test_xmlAttrSerializeTxtContent();
22886 test_ret += test_xmlBufferAdd();
22887 test_ret += test_xmlBufferAddHead();
22888 test_ret += test_xmlBufferCCat();
22889 test_ret += test_xmlBufferCat();
22890 test_ret += test_xmlBufferContent();
22891 test_ret += test_xmlBufferCreate();
22892 test_ret += test_xmlBufferCreateSize();
22893 test_ret += test_xmlBufferCreateStatic();
22894 test_ret += test_xmlBufferEmpty();
22895 test_ret += test_xmlBufferGrow();
22896 test_ret += test_xmlBufferLength();
22897 test_ret += test_xmlBufferResize();
22898 test_ret += test_xmlBufferSetAllocationScheme();
22899 test_ret += test_xmlBufferShrink();
22900 test_ret += test_xmlBufferWriteCHAR();
22901 test_ret += test_xmlBufferWriteChar();
22902 test_ret += test_xmlBufferWriteQuotedString();
22903 test_ret += test_xmlBuildQName();
22904 test_ret += test_xmlCopyDoc();
22905 test_ret += test_xmlCopyDtd();
22906 test_ret += test_xmlCopyNamespace();
22907 test_ret += test_xmlCopyNamespaceList();
22908 test_ret += test_xmlCopyNode();
22909 test_ret += test_xmlCopyNodeList();
22910 test_ret += test_xmlCopyProp();
22911 test_ret += test_xmlCopyPropList();
22912 test_ret += test_xmlCreateIntSubset();
22913 test_ret += test_xmlDocCopyNode();
22914 test_ret += test_xmlDocCopyNodeList();
22915 test_ret += test_xmlDocDump();
22916 test_ret += test_xmlDocDumpFormatMemory();
22917 test_ret += test_xmlDocDumpFormatMemoryEnc();
22918 test_ret += test_xmlDocDumpMemory();
22919 test_ret += test_xmlDocDumpMemoryEnc();
22920 test_ret += test_xmlDocFormatDump();
22921 test_ret += test_xmlDocGetRootElement();
22922 test_ret += test_xmlDocSetRootElement();
22923 test_ret += test_xmlElemDump();
22924 test_ret += test_xmlGetBufferAllocationScheme();
22925 test_ret += test_xmlGetCompressMode();
22926 test_ret += test_xmlGetDocCompressMode();
22927 test_ret += test_xmlGetIntSubset();
22928 test_ret += test_xmlGetLastChild();
22929 test_ret += test_xmlGetLineNo();
22930 test_ret += test_xmlGetNoNsProp();
22931 test_ret += test_xmlGetNodePath();
22932 test_ret += test_xmlGetNsList();
22933 test_ret += test_xmlGetNsProp();
22934 test_ret += test_xmlGetProp();
22935 test_ret += test_xmlHasNsProp();
22936 test_ret += test_xmlHasProp();
22937 test_ret += test_xmlIsBlankNode();
22938 test_ret += test_xmlIsXHTML();
22939 test_ret += test_xmlNewCDataBlock();
22940 test_ret += test_xmlNewCharRef();
22941 test_ret += test_xmlNewChild();
22942 test_ret += test_xmlNewComment();
22943 test_ret += test_xmlNewDoc();
22944 test_ret += test_xmlNewDocComment();
22945 test_ret += test_xmlNewDocFragment();
22946 test_ret += test_xmlNewDocNode();
22947 test_ret += test_xmlNewDocNodeEatName();
22948 test_ret += test_xmlNewDocPI();
22949 test_ret += test_xmlNewDocProp();
22950 test_ret += test_xmlNewDocRawNode();
22951 test_ret += test_xmlNewDocText();
22952 test_ret += test_xmlNewDocTextLen();
22953 test_ret += test_xmlNewDtd();
22954 test_ret += test_xmlNewNode();
22955 test_ret += test_xmlNewNodeEatName();
22956 test_ret += test_xmlNewNs();
22957 test_ret += test_xmlNewNsProp();
22958 test_ret += test_xmlNewNsPropEatName();
22959 test_ret += test_xmlNewPI();
22960 test_ret += test_xmlNewProp();
22961 test_ret += test_xmlNewReference();
22962 test_ret += test_xmlNewText();
22963 test_ret += test_xmlNewTextChild();
22964 test_ret += test_xmlNewTextLen();
22965 test_ret += test_xmlNodeAddContent();
22966 test_ret += test_xmlNodeAddContentLen();
22967 test_ret += test_xmlNodeBufGetContent();
22968 test_ret += test_xmlNodeDump();
22969 test_ret += test_xmlNodeDumpOutput();
22970 test_ret += test_xmlNodeGetBase();
22971 test_ret += test_xmlNodeGetContent();
22972 test_ret += test_xmlNodeGetLang();
22973 test_ret += test_xmlNodeGetSpacePreserve();
22974 test_ret += test_xmlNodeIsText();
22975 test_ret += test_xmlNodeListGetRawString();
22976 test_ret += test_xmlNodeListGetString();
22977 test_ret += test_xmlNodeSetBase();
22978 test_ret += test_xmlNodeSetContent();
22979 test_ret += test_xmlNodeSetContentLen();
22980 test_ret += test_xmlNodeSetLang();
22981 test_ret += test_xmlNodeSetName();
22982 test_ret += test_xmlNodeSetSpacePreserve();
22983 test_ret += test_xmlReconciliateNs();
22984 test_ret += test_xmlRemoveProp();
22985 test_ret += test_xmlReplaceNode();
22986 test_ret += test_xmlSaveFile();
22987 test_ret += test_xmlSaveFileEnc();
22988 test_ret += test_xmlSaveFileTo();
22989 test_ret += test_xmlSaveFormatFile();
22990 test_ret += test_xmlSaveFormatFileEnc();
22991 test_ret += test_xmlSaveFormatFileTo();
22992 test_ret += test_xmlSearchNs();
22993 test_ret += test_xmlSearchNsByHref();
22994 test_ret += test_xmlSetBufferAllocationScheme();
22995 test_ret += test_xmlSetCompressMode();
22996 test_ret += test_xmlSetDocCompressMode();
22997 test_ret += test_xmlSetNs();
22998 test_ret += test_xmlSetNsProp();
22999 test_ret += test_xmlSetProp();
23000 test_ret += test_xmlSplitQName2();
23001 test_ret += test_xmlSplitQName3();
23002 test_ret += test_xmlStringGetNodeList();
23003 test_ret += test_xmlStringLenGetNodeList();
23004 test_ret += test_xmlTextConcat();
23005 test_ret += test_xmlTextMerge();
23006 test_ret += test_xmlUnsetNsProp();
23007 test_ret += test_xmlUnsetProp();
23008 test_ret += test_xmlValidateNCName();
23009 test_ret += test_xmlValidateNMToken();
23010 test_ret += test_xmlValidateName();
23011 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023012
Daniel Veillard42595322004-11-08 10:52:06 +000023013 if (test_ret != 0)
23014 printf("Module tree: %d errors\n", test_ret);
23015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023016}
23017
23018static int
23019test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023021
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023022 int mem_base;
23023 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023024 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023025 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023026 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023027 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023028
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023029 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23030 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23031 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023032 URI = gen_const_xmlChar_ptr(n_URI, 0);
23033 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023034
William M. Brackf13f77f2004-11-12 16:03:48 +000023035 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023036 desret_xmlChar_ptr(ret_val);
23037 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023038 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23039 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023040 xmlResetLastError();
23041 if (mem_base != xmlMemBlocks()) {
23042 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023044 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023045 printf(" %d", n_URI);
23046 printf(" %d", n_base);
23047 printf("\n");
23048 }
23049 }
23050 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023051 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023052
Daniel Veillard42595322004-11-08 10:52:06 +000023053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023054}
23055
23056
23057static int
23058test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023060
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023061 int mem_base;
23062 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023063 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023064 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023065 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023066 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023067
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023068 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23069 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23070 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023071 URI = gen_const_xmlChar_ptr(n_URI, 0);
23072 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023073
William M. Brackf13f77f2004-11-12 16:03:48 +000023074 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023075 desret_xmlChar_ptr(ret_val);
23076 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023077 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23078 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023079 xmlResetLastError();
23080 if (mem_base != xmlMemBlocks()) {
23081 printf("Leak of %d blocks found in xmlBuildURI",
23082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023083 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023084 printf(" %d", n_URI);
23085 printf(" %d", n_base);
23086 printf("\n");
23087 }
23088 }
23089 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023090 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023091
Daniel Veillard42595322004-11-08 10:52:06 +000023092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023093}
23094
23095
23096static int
23097test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023099
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023100 int mem_base;
23101 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023102 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023103 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023104
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023105 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023107 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023108
William M. Brackf13f77f2004-11-12 16:03:48 +000023109 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023110 desret_xmlChar_ptr(ret_val);
23111 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023112 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023113 xmlResetLastError();
23114 if (mem_base != xmlMemBlocks()) {
23115 printf("Leak of %d blocks found in xmlCanonicPath",
23116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023117 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023118 printf(" %d", n_path);
23119 printf("\n");
23120 }
23121 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023122 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023123
Daniel Veillard42595322004-11-08 10:52:06 +000023124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023125}
23126
23127
23128static int
23129test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023131
23132
23133 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023135}
23136
23137
23138static int
23139test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023141
Daniel Veillardce682bc2004-11-05 17:22:25 +000023142 int mem_base;
23143 int ret_val;
23144 char * path; /* pointer to the path string */
23145 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023146
Daniel Veillardce682bc2004-11-05 17:22:25 +000023147 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23148 mem_base = xmlMemBlocks();
23149 path = gen_char_ptr(n_path, 0);
23150
23151 ret_val = xmlNormalizeURIPath(path);
23152 desret_int(ret_val);
23153 call_tests++;
23154 des_char_ptr(n_path, path, 0);
23155 xmlResetLastError();
23156 if (mem_base != xmlMemBlocks()) {
23157 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023159 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023160 printf(" %d", n_path);
23161 printf("\n");
23162 }
23163 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023165
Daniel Veillard42595322004-11-08 10:52:06 +000023166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023167}
23168
23169
23170static int
23171test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023173
23174
23175 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023177}
23178
23179
Daniel Veillardce682bc2004-11-05 17:22:25 +000023180#define gen_nb_xmlURIPtr 1
23181static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23182 return(NULL);
23183}
23184static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23185}
23186
Daniel Veillardd93f6252004-11-02 15:53:51 +000023187static int
23188test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023190
Daniel Veillardce682bc2004-11-05 17:22:25 +000023191 int mem_base;
23192 int ret_val;
23193 xmlURIPtr uri; /* pointer to an URI structure */
23194 int n_uri;
23195 char * str; /* the string to analyze */
23196 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023197
Daniel Veillardce682bc2004-11-05 17:22:25 +000023198 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23199 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23200 mem_base = xmlMemBlocks();
23201 uri = gen_xmlURIPtr(n_uri, 0);
23202 str = gen_const_char_ptr(n_str, 1);
23203
William M. Brackf13f77f2004-11-12 16:03:48 +000023204 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023205 desret_int(ret_val);
23206 call_tests++;
23207 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023208 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023209 xmlResetLastError();
23210 if (mem_base != xmlMemBlocks()) {
23211 printf("Leak of %d blocks found in xmlParseURIReference",
23212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023213 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023214 printf(" %d", n_uri);
23215 printf(" %d", n_str);
23216 printf("\n");
23217 }
23218 }
23219 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023220 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023221
Daniel Veillard42595322004-11-08 10:52:06 +000023222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023223}
23224
23225
23226static int
23227test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023229
Daniel Veillardce682bc2004-11-05 17:22:25 +000023230 int mem_base;
23231 FILE * stream; /* a FILE* for the output */
23232 int n_stream;
23233 xmlURIPtr uri; /* pointer to an xmlURI */
23234 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023235
Daniel Veillardce682bc2004-11-05 17:22:25 +000023236 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23237 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23238 mem_base = xmlMemBlocks();
23239 stream = gen_FILE_ptr(n_stream, 0);
23240 uri = gen_xmlURIPtr(n_uri, 1);
23241
23242 xmlPrintURI(stream, uri);
23243 call_tests++;
23244 des_FILE_ptr(n_stream, stream, 0);
23245 des_xmlURIPtr(n_uri, uri, 1);
23246 xmlResetLastError();
23247 if (mem_base != xmlMemBlocks()) {
23248 printf("Leak of %d blocks found in xmlPrintURI",
23249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023250 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023251 printf(" %d", n_stream);
23252 printf(" %d", n_uri);
23253 printf("\n");
23254 }
23255 }
23256 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023257 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023258
Daniel Veillard42595322004-11-08 10:52:06 +000023259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023260}
23261
23262
23263static int
23264test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023266
Daniel Veillardce682bc2004-11-05 17:22:25 +000023267 int mem_base;
23268 xmlChar * ret_val;
23269 xmlURIPtr uri; /* pointer to an xmlURI */
23270 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023271
Daniel Veillardce682bc2004-11-05 17:22:25 +000023272 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23273 mem_base = xmlMemBlocks();
23274 uri = gen_xmlURIPtr(n_uri, 0);
23275
23276 ret_val = xmlSaveUri(uri);
23277 desret_xmlChar_ptr(ret_val);
23278 call_tests++;
23279 des_xmlURIPtr(n_uri, uri, 0);
23280 xmlResetLastError();
23281 if (mem_base != xmlMemBlocks()) {
23282 printf("Leak of %d blocks found in xmlSaveUri",
23283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023284 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023285 printf(" %d", n_uri);
23286 printf("\n");
23287 }
23288 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023290
Daniel Veillard42595322004-11-08 10:52:06 +000023291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023292}
23293
23294
23295static int
23296test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023298
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023299 int mem_base;
23300 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023301 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023302 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023303
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023304 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023306 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023307
William M. Brackf13f77f2004-11-12 16:03:48 +000023308 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023309 desret_xmlChar_ptr(ret_val);
23310 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023311 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023312 xmlResetLastError();
23313 if (mem_base != xmlMemBlocks()) {
23314 printf("Leak of %d blocks found in xmlURIEscape",
23315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023316 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023317 printf(" %d", n_str);
23318 printf("\n");
23319 }
23320 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023321 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023322
Daniel Veillard42595322004-11-08 10:52:06 +000023323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023324}
23325
23326
23327static int
23328test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023330
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023331 int mem_base;
23332 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023333 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023334 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023335 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023336 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023337
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023338 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23339 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023341 str = gen_const_xmlChar_ptr(n_str, 0);
23342 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023343
William M. Brackf13f77f2004-11-12 16:03:48 +000023344 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023345 desret_xmlChar_ptr(ret_val);
23346 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023347 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23348 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023349 xmlResetLastError();
23350 if (mem_base != xmlMemBlocks()) {
23351 printf("Leak of %d blocks found in xmlURIEscapeStr",
23352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023353 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023354 printf(" %d", n_str);
23355 printf(" %d", n_list);
23356 printf("\n");
23357 }
23358 }
23359 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023360 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023361
Daniel Veillard42595322004-11-08 10:52:06 +000023362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023363}
23364
23365
23366static int
23367test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023369
23370
23371 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023373}
23374
23375static int
23376test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023378
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023379 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023380 test_ret += test_xmlBuildRelativeURI();
23381 test_ret += test_xmlBuildURI();
23382 test_ret += test_xmlCanonicPath();
23383 test_ret += test_xmlCreateURI();
23384 test_ret += test_xmlNormalizeURIPath();
23385 test_ret += test_xmlParseURI();
23386 test_ret += test_xmlParseURIReference();
23387 test_ret += test_xmlPrintURI();
23388 test_ret += test_xmlSaveUri();
23389 test_ret += test_xmlURIEscape();
23390 test_ret += test_xmlURIEscapeStr();
23391 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023392
Daniel Veillard42595322004-11-08 10:52:06 +000023393 if (test_ret != 0)
23394 printf("Module uri: %d errors\n", test_ret);
23395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023396}
23397
23398static int
23399test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023401
Daniel Veillard42595322004-11-08 10:52:06 +000023402 int mem_base;
23403 xmlAttributePtr ret_val;
23404 xmlValidCtxtPtr ctxt; /* the validation context */
23405 int n_ctxt;
23406 xmlDtdPtr dtd; /* pointer to the DTD */
23407 int n_dtd;
23408 xmlChar * elem; /* the element name */
23409 int n_elem;
23410 xmlChar * name; /* the attribute name */
23411 int n_name;
23412 xmlChar * ns; /* the attribute namespace prefix */
23413 int n_ns;
23414 xmlAttributeType type; /* the attribute type */
23415 int n_type;
23416 xmlAttributeDefault def; /* the attribute default type */
23417 int n_def;
23418 xmlChar * defaultValue; /* the attribute default value */
23419 int n_defaultValue;
23420 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23421 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023422
Daniel Veillard42595322004-11-08 10:52:06 +000023423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23424 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23425 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23426 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23427 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23428 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23429 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23430 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23431 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23432 mem_base = xmlMemBlocks();
23433 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23434 dtd = gen_xmlDtdPtr(n_dtd, 1);
23435 elem = gen_const_xmlChar_ptr(n_elem, 2);
23436 name = gen_const_xmlChar_ptr(n_name, 3);
23437 ns = gen_const_xmlChar_ptr(n_ns, 4);
23438 type = gen_xmlAttributeType(n_type, 5);
23439 def = gen_xmlAttributeDefault(n_def, 6);
23440 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23441 tree = gen_xmlEnumerationPtr(n_tree, 8);
23442
William M. Brackf13f77f2004-11-12 16:03:48 +000023443 ret_val = xmlAddAttributeDecl(ctxt, dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)ns, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard42595322004-11-08 10:52:06 +000023444 desret_xmlAttributePtr(ret_val);
23445 call_tests++;
23446 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23447 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023448 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23449 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23450 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023451 des_xmlAttributeType(n_type, type, 5);
23452 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023453 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023454 des_xmlEnumerationPtr(n_tree, tree, 8);
23455 xmlResetLastError();
23456 if (mem_base != xmlMemBlocks()) {
23457 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23458 xmlMemBlocks() - mem_base);
23459 test_ret++;
23460 printf(" %d", n_ctxt);
23461 printf(" %d", n_dtd);
23462 printf(" %d", n_elem);
23463 printf(" %d", n_name);
23464 printf(" %d", n_ns);
23465 printf(" %d", n_type);
23466 printf(" %d", n_def);
23467 printf(" %d", n_defaultValue);
23468 printf(" %d", n_tree);
23469 printf("\n");
23470 }
23471 }
23472 }
23473 }
23474 }
23475 }
23476 }
23477 }
23478 }
23479 }
Daniel Veillard42595322004-11-08 10:52:06 +000023480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023481
Daniel Veillard42595322004-11-08 10:52:06 +000023482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023483}
23484
23485
23486static int
23487test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023489
Daniel Veillard42595322004-11-08 10:52:06 +000023490 int mem_base;
23491 xmlElementPtr ret_val;
23492 xmlValidCtxtPtr ctxt; /* the validation context */
23493 int n_ctxt;
23494 xmlDtdPtr dtd; /* pointer to the DTD */
23495 int n_dtd;
23496 xmlChar * name; /* the entity name */
23497 int n_name;
23498 xmlElementTypeVal type; /* the element type */
23499 int n_type;
23500 xmlElementContentPtr content; /* the element content tree or NULL */
23501 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023502
Daniel Veillard42595322004-11-08 10:52:06 +000023503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23504 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23505 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23506 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23507 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23508 mem_base = xmlMemBlocks();
23509 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23510 dtd = gen_xmlDtdPtr(n_dtd, 1);
23511 name = gen_const_xmlChar_ptr(n_name, 2);
23512 type = gen_xmlElementTypeVal(n_type, 3);
23513 content = gen_xmlElementContentPtr(n_content, 4);
23514
William M. Brackf13f77f2004-11-12 16:03:48 +000023515 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023516 desret_xmlElementPtr(ret_val);
23517 call_tests++;
23518 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23519 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023520 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023521 des_xmlElementTypeVal(n_type, type, 3);
23522 des_xmlElementContentPtr(n_content, content, 4);
23523 xmlResetLastError();
23524 if (mem_base != xmlMemBlocks()) {
23525 printf("Leak of %d blocks found in xmlAddElementDecl",
23526 xmlMemBlocks() - mem_base);
23527 test_ret++;
23528 printf(" %d", n_ctxt);
23529 printf(" %d", n_dtd);
23530 printf(" %d", n_name);
23531 printf(" %d", n_type);
23532 printf(" %d", n_content);
23533 printf("\n");
23534 }
23535 }
23536 }
23537 }
23538 }
23539 }
Daniel Veillard42595322004-11-08 10:52:06 +000023540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023541
Daniel Veillard42595322004-11-08 10:52:06 +000023542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023543}
23544
23545
23546static int
23547test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023549
23550
23551 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023553}
23554
23555
23556static int
23557test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023559
23560
23561 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023563}
23564
23565
23566static int
23567test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023569
23570
23571 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023573}
23574
23575
Daniel Veillardce682bc2004-11-05 17:22:25 +000023576#define gen_nb_xmlAttributeTablePtr 1
23577static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23578 return(NULL);
23579}
23580static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23581}
23582
Daniel Veillardd93f6252004-11-02 15:53:51 +000023583static int
23584test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023586
23587
23588 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023590}
23591
23592
23593static int
23594test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023596
William M. Brack094dd862004-11-14 14:28:34 +000023597 int mem_base;
23598 xmlElementContentPtr ret_val;
23599 xmlElementContentPtr cur; /* An element content pointer. */
23600 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023601
William M. Brack094dd862004-11-14 14:28:34 +000023602 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23603 mem_base = xmlMemBlocks();
23604 cur = gen_xmlElementContentPtr(n_cur, 0);
23605
23606 ret_val = xmlCopyElementContent(cur);
23607 desret_xmlElementContentPtr(ret_val);
23608 call_tests++;
23609 des_xmlElementContentPtr(n_cur, cur, 0);
23610 xmlResetLastError();
23611 if (mem_base != xmlMemBlocks()) {
23612 printf("Leak of %d blocks found in xmlCopyElementContent",
23613 xmlMemBlocks() - mem_base);
23614 test_ret++;
23615 printf(" %d", n_cur);
23616 printf("\n");
23617 }
23618 }
23619 function_tests++;
23620
Daniel Veillard42595322004-11-08 10:52:06 +000023621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023622}
23623
23624
Daniel Veillardce682bc2004-11-05 17:22:25 +000023625#define gen_nb_xmlElementTablePtr 1
23626static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23627 return(NULL);
23628}
23629static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23630}
23631
Daniel Veillardd93f6252004-11-02 15:53:51 +000023632static int
23633test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023635
23636
23637 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023639}
23640
23641
23642static int
23643test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023645
23646
23647 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023649}
23650
23651
Daniel Veillardce682bc2004-11-05 17:22:25 +000023652#define gen_nb_xmlNotationTablePtr 1
23653static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23654 return(NULL);
23655}
23656static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23657}
23658
Daniel Veillardd93f6252004-11-02 15:53:51 +000023659static int
23660test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023662
23663
23664 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023666}
23667
23668
23669static int
23670test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023672
23673
23674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023676}
23677
23678
Daniel Veillardce682bc2004-11-05 17:22:25 +000023679#define gen_nb_xmlAttributePtr 1
23680static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23681 return(NULL);
23682}
23683static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23684}
23685
Daniel Veillardd93f6252004-11-02 15:53:51 +000023686static int
23687test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023689
William M. Brack21e4ef22005-01-02 09:53:13 +000023690#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023691 int mem_base;
23692 xmlBufferPtr buf; /* the XML buffer output */
23693 int n_buf;
23694 xmlAttributePtr attr; /* An attribute declaration */
23695 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023696
Daniel Veillardce682bc2004-11-05 17:22:25 +000023697 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23698 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23699 mem_base = xmlMemBlocks();
23700 buf = gen_xmlBufferPtr(n_buf, 0);
23701 attr = gen_xmlAttributePtr(n_attr, 1);
23702
23703 xmlDumpAttributeDecl(buf, attr);
23704 call_tests++;
23705 des_xmlBufferPtr(n_buf, buf, 0);
23706 des_xmlAttributePtr(n_attr, attr, 1);
23707 xmlResetLastError();
23708 if (mem_base != xmlMemBlocks()) {
23709 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023711 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023712 printf(" %d", n_buf);
23713 printf(" %d", n_attr);
23714 printf("\n");
23715 }
23716 }
23717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023718 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023719#endif
23720
Daniel Veillard42595322004-11-08 10:52:06 +000023721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023722}
23723
23724
23725static int
23726test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023728
William M. Brack21e4ef22005-01-02 09:53:13 +000023729#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023730 int mem_base;
23731 xmlBufferPtr buf; /* the XML buffer output */
23732 int n_buf;
23733 xmlAttributeTablePtr table; /* An attribute table */
23734 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023735
Daniel Veillardce682bc2004-11-05 17:22:25 +000023736 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23737 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23738 mem_base = xmlMemBlocks();
23739 buf = gen_xmlBufferPtr(n_buf, 0);
23740 table = gen_xmlAttributeTablePtr(n_table, 1);
23741
23742 xmlDumpAttributeTable(buf, table);
23743 call_tests++;
23744 des_xmlBufferPtr(n_buf, buf, 0);
23745 des_xmlAttributeTablePtr(n_table, table, 1);
23746 xmlResetLastError();
23747 if (mem_base != xmlMemBlocks()) {
23748 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023750 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023751 printf(" %d", n_buf);
23752 printf(" %d", n_table);
23753 printf("\n");
23754 }
23755 }
23756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023757 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023758#endif
23759
Daniel Veillard42595322004-11-08 10:52:06 +000023760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023761}
23762
23763
Daniel Veillardce682bc2004-11-05 17:22:25 +000023764#define gen_nb_xmlElementPtr 1
23765static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23766 return(NULL);
23767}
23768static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23769}
23770
Daniel Veillardd93f6252004-11-02 15:53:51 +000023771static int
23772test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023774
William M. Brack21e4ef22005-01-02 09:53:13 +000023775#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023776 int mem_base;
23777 xmlBufferPtr buf; /* the XML buffer output */
23778 int n_buf;
23779 xmlElementPtr elem; /* An element table */
23780 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023781
Daniel Veillardce682bc2004-11-05 17:22:25 +000023782 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23783 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23784 mem_base = xmlMemBlocks();
23785 buf = gen_xmlBufferPtr(n_buf, 0);
23786 elem = gen_xmlElementPtr(n_elem, 1);
23787
23788 xmlDumpElementDecl(buf, elem);
23789 call_tests++;
23790 des_xmlBufferPtr(n_buf, buf, 0);
23791 des_xmlElementPtr(n_elem, elem, 1);
23792 xmlResetLastError();
23793 if (mem_base != xmlMemBlocks()) {
23794 printf("Leak of %d blocks found in xmlDumpElementDecl",
23795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023796 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023797 printf(" %d", n_buf);
23798 printf(" %d", n_elem);
23799 printf("\n");
23800 }
23801 }
23802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023803 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023804#endif
23805
Daniel Veillard42595322004-11-08 10:52:06 +000023806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023807}
23808
23809
23810static int
23811test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023813
William M. Brack21e4ef22005-01-02 09:53:13 +000023814#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023815 int mem_base;
23816 xmlBufferPtr buf; /* the XML buffer output */
23817 int n_buf;
23818 xmlElementTablePtr table; /* An element table */
23819 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023820
Daniel Veillardce682bc2004-11-05 17:22:25 +000023821 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23822 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23823 mem_base = xmlMemBlocks();
23824 buf = gen_xmlBufferPtr(n_buf, 0);
23825 table = gen_xmlElementTablePtr(n_table, 1);
23826
23827 xmlDumpElementTable(buf, table);
23828 call_tests++;
23829 des_xmlBufferPtr(n_buf, buf, 0);
23830 des_xmlElementTablePtr(n_table, table, 1);
23831 xmlResetLastError();
23832 if (mem_base != xmlMemBlocks()) {
23833 printf("Leak of %d blocks found in xmlDumpElementTable",
23834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023835 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023836 printf(" %d", n_buf);
23837 printf(" %d", n_table);
23838 printf("\n");
23839 }
23840 }
23841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023842 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023843#endif
23844
Daniel Veillard42595322004-11-08 10:52:06 +000023845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023846}
23847
23848
Daniel Veillardce682bc2004-11-05 17:22:25 +000023849#define gen_nb_xmlNotationPtr 1
23850static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23851 return(NULL);
23852}
23853static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23854}
23855
Daniel Veillardd93f6252004-11-02 15:53:51 +000023856static int
23857test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023859
William M. Brack21e4ef22005-01-02 09:53:13 +000023860#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023861 int mem_base;
23862 xmlBufferPtr buf; /* the XML buffer output */
23863 int n_buf;
23864 xmlNotationPtr nota; /* A notation declaration */
23865 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023866
Daniel Veillardce682bc2004-11-05 17:22:25 +000023867 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23868 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23869 mem_base = xmlMemBlocks();
23870 buf = gen_xmlBufferPtr(n_buf, 0);
23871 nota = gen_xmlNotationPtr(n_nota, 1);
23872
23873 xmlDumpNotationDecl(buf, nota);
23874 call_tests++;
23875 des_xmlBufferPtr(n_buf, buf, 0);
23876 des_xmlNotationPtr(n_nota, nota, 1);
23877 xmlResetLastError();
23878 if (mem_base != xmlMemBlocks()) {
23879 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023881 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023882 printf(" %d", n_buf);
23883 printf(" %d", n_nota);
23884 printf("\n");
23885 }
23886 }
23887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023888 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023889#endif
23890
Daniel Veillard42595322004-11-08 10:52:06 +000023891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023892}
23893
23894
23895static int
23896test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023898
William M. Brack21e4ef22005-01-02 09:53:13 +000023899#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023900 int mem_base;
23901 xmlBufferPtr buf; /* the XML buffer output */
23902 int n_buf;
23903 xmlNotationTablePtr table; /* A notation table */
23904 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023905
Daniel Veillardce682bc2004-11-05 17:22:25 +000023906 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23907 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23908 mem_base = xmlMemBlocks();
23909 buf = gen_xmlBufferPtr(n_buf, 0);
23910 table = gen_xmlNotationTablePtr(n_table, 1);
23911
23912 xmlDumpNotationTable(buf, table);
23913 call_tests++;
23914 des_xmlBufferPtr(n_buf, buf, 0);
23915 des_xmlNotationTablePtr(n_table, table, 1);
23916 xmlResetLastError();
23917 if (mem_base != xmlMemBlocks()) {
23918 printf("Leak of %d blocks found in xmlDumpNotationTable",
23919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023920 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023921 printf(" %d", n_buf);
23922 printf(" %d", n_table);
23923 printf("\n");
23924 }
23925 }
23926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023927 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023928#endif
23929
Daniel Veillard42595322004-11-08 10:52:06 +000023930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023931}
23932
23933
23934static int
23935test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023937
Daniel Veillard42595322004-11-08 10:52:06 +000023938 int mem_base;
23939 xmlAttributePtr ret_val;
23940 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23941 int n_dtd;
23942 xmlChar * elem; /* the element name */
23943 int n_elem;
23944 xmlChar * name; /* the attribute name */
23945 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023946
Daniel Veillard42595322004-11-08 10:52:06 +000023947 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23948 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23949 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23950 mem_base = xmlMemBlocks();
23951 dtd = gen_xmlDtdPtr(n_dtd, 0);
23952 elem = gen_const_xmlChar_ptr(n_elem, 1);
23953 name = gen_const_xmlChar_ptr(n_name, 2);
23954
William M. Brackf13f77f2004-11-12 16:03:48 +000023955 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023956 desret_xmlAttributePtr(ret_val);
23957 call_tests++;
23958 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023959 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
23960 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023961 xmlResetLastError();
23962 if (mem_base != xmlMemBlocks()) {
23963 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
23964 xmlMemBlocks() - mem_base);
23965 test_ret++;
23966 printf(" %d", n_dtd);
23967 printf(" %d", n_elem);
23968 printf(" %d", n_name);
23969 printf("\n");
23970 }
23971 }
23972 }
23973 }
Daniel Veillard42595322004-11-08 10:52:06 +000023974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023975
Daniel Veillard42595322004-11-08 10:52:06 +000023976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023977}
23978
23979
23980static int
23981test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023983
Daniel Veillard42595322004-11-08 10:52:06 +000023984 int mem_base;
23985 xmlElementPtr ret_val;
23986 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23987 int n_dtd;
23988 xmlChar * name; /* the element name */
23989 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023990
Daniel Veillard42595322004-11-08 10:52:06 +000023991 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23992 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23993 mem_base = xmlMemBlocks();
23994 dtd = gen_xmlDtdPtr(n_dtd, 0);
23995 name = gen_const_xmlChar_ptr(n_name, 1);
23996
William M. Brackf13f77f2004-11-12 16:03:48 +000023997 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023998 desret_xmlElementPtr(ret_val);
23999 call_tests++;
24000 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024001 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024002 xmlResetLastError();
24003 if (mem_base != xmlMemBlocks()) {
24004 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24005 xmlMemBlocks() - mem_base);
24006 test_ret++;
24007 printf(" %d", n_dtd);
24008 printf(" %d", n_name);
24009 printf("\n");
24010 }
24011 }
24012 }
Daniel Veillard42595322004-11-08 10:52:06 +000024013 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024014
Daniel Veillard42595322004-11-08 10:52:06 +000024015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024016}
24017
24018
24019static int
24020test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024022
24023
24024 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024026}
24027
24028
24029static int
24030test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024032
Daniel Veillard42595322004-11-08 10:52:06 +000024033 int mem_base;
24034 xmlAttributePtr ret_val;
24035 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24036 int n_dtd;
24037 xmlChar * elem; /* the element name */
24038 int n_elem;
24039 xmlChar * name; /* the attribute name */
24040 int n_name;
24041 xmlChar * prefix; /* the attribute namespace prefix */
24042 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024043
Daniel Veillard42595322004-11-08 10:52:06 +000024044 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24045 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24046 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24047 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24048 mem_base = xmlMemBlocks();
24049 dtd = gen_xmlDtdPtr(n_dtd, 0);
24050 elem = gen_const_xmlChar_ptr(n_elem, 1);
24051 name = gen_const_xmlChar_ptr(n_name, 2);
24052 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24053
William M. Brackf13f77f2004-11-12 16:03:48 +000024054 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024055 desret_xmlAttributePtr(ret_val);
24056 call_tests++;
24057 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024058 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24059 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24060 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024061 xmlResetLastError();
24062 if (mem_base != xmlMemBlocks()) {
24063 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24064 xmlMemBlocks() - mem_base);
24065 test_ret++;
24066 printf(" %d", n_dtd);
24067 printf(" %d", n_elem);
24068 printf(" %d", n_name);
24069 printf(" %d", n_prefix);
24070 printf("\n");
24071 }
24072 }
24073 }
24074 }
24075 }
Daniel Veillard42595322004-11-08 10:52:06 +000024076 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024077
Daniel Veillard42595322004-11-08 10:52:06 +000024078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024079}
24080
24081
24082static int
24083test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024085
Daniel Veillard42595322004-11-08 10:52:06 +000024086 int mem_base;
24087 xmlElementPtr ret_val;
24088 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24089 int n_dtd;
24090 xmlChar * name; /* the element name */
24091 int n_name;
24092 xmlChar * prefix; /* the element namespace prefix */
24093 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024094
Daniel Veillard42595322004-11-08 10:52:06 +000024095 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24096 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24097 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24098 mem_base = xmlMemBlocks();
24099 dtd = gen_xmlDtdPtr(n_dtd, 0);
24100 name = gen_const_xmlChar_ptr(n_name, 1);
24101 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24102
William M. Brackf13f77f2004-11-12 16:03:48 +000024103 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024104 desret_xmlElementPtr(ret_val);
24105 call_tests++;
24106 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024107 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24108 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024109 xmlResetLastError();
24110 if (mem_base != xmlMemBlocks()) {
24111 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24112 xmlMemBlocks() - mem_base);
24113 test_ret++;
24114 printf(" %d", n_dtd);
24115 printf(" %d", n_name);
24116 printf(" %d", n_prefix);
24117 printf("\n");
24118 }
24119 }
24120 }
24121 }
Daniel Veillard42595322004-11-08 10:52:06 +000024122 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024123
Daniel Veillard42595322004-11-08 10:52:06 +000024124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024125}
24126
24127
24128static int
24129test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024131
Daniel Veillard57b25162004-11-06 14:50:18 +000024132 int mem_base;
24133 xmlAttrPtr ret_val;
24134 xmlDocPtr doc; /* pointer to the document */
24135 int n_doc;
24136 xmlChar * ID; /* the ID value */
24137 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024138
Daniel Veillard57b25162004-11-06 14:50:18 +000024139 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24140 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24141 mem_base = xmlMemBlocks();
24142 doc = gen_xmlDocPtr(n_doc, 0);
24143 ID = gen_const_xmlChar_ptr(n_ID, 1);
24144
William M. Brackf13f77f2004-11-12 16:03:48 +000024145 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024146 desret_xmlAttrPtr(ret_val);
24147 call_tests++;
24148 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024149 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024150 xmlResetLastError();
24151 if (mem_base != xmlMemBlocks()) {
24152 printf("Leak of %d blocks found in xmlGetID",
24153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024154 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024155 printf(" %d", n_doc);
24156 printf(" %d", n_ID);
24157 printf("\n");
24158 }
24159 }
24160 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024162
Daniel Veillard42595322004-11-08 10:52:06 +000024163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024164}
24165
24166
24167static int
24168test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024170
24171
24172 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024174}
24175
24176
24177static int
24178test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024180
Daniel Veillardce244ad2004-11-05 10:03:46 +000024181 int mem_base;
24182 int ret_val;
24183 xmlDocPtr doc; /* the document */
24184 int n_doc;
24185 xmlNodePtr elem; /* the element carrying the attribute */
24186 int n_elem;
24187 xmlAttrPtr attr; /* the attribute */
24188 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024189
Daniel Veillardce244ad2004-11-05 10:03:46 +000024190 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24191 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24192 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24193 mem_base = xmlMemBlocks();
24194 doc = gen_xmlDocPtr(n_doc, 0);
24195 elem = gen_xmlNodePtr(n_elem, 1);
24196 attr = gen_xmlAttrPtr(n_attr, 2);
24197
24198 ret_val = xmlIsID(doc, elem, attr);
24199 desret_int(ret_val);
24200 call_tests++;
24201 des_xmlDocPtr(n_doc, doc, 0);
24202 des_xmlNodePtr(n_elem, elem, 1);
24203 des_xmlAttrPtr(n_attr, attr, 2);
24204 xmlResetLastError();
24205 if (mem_base != xmlMemBlocks()) {
24206 printf("Leak of %d blocks found in xmlIsID",
24207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024208 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024209 printf(" %d", n_doc);
24210 printf(" %d", n_elem);
24211 printf(" %d", n_attr);
24212 printf("\n");
24213 }
24214 }
24215 }
24216 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024217 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024218
Daniel Veillard42595322004-11-08 10:52:06 +000024219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024220}
24221
24222
24223static int
24224test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024226
24227 int mem_base;
24228 int ret_val;
24229 xmlDocPtr doc; /* the document */
24230 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024231 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024232 int n_name;
24233
24234 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24235 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024237 doc = gen_xmlDocPtr(n_doc, 0);
24238 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024239
William M. Brackf13f77f2004-11-12 16:03:48 +000024240 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024241 desret_int(ret_val);
24242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024243 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024244 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024245 xmlResetLastError();
24246 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024247 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024249 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024250 printf(" %d", n_doc);
24251 printf(" %d", n_name);
24252 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024253 }
24254 }
24255 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024256 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024257
Daniel Veillard42595322004-11-08 10:52:06 +000024258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024259}
24260
24261
24262static int
24263test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024265
Daniel Veillardce244ad2004-11-05 10:03:46 +000024266 int mem_base;
24267 int ret_val;
24268 xmlDocPtr doc; /* the document */
24269 int n_doc;
24270 xmlNodePtr elem; /* the element carrying the attribute */
24271 int n_elem;
24272 xmlAttrPtr attr; /* the attribute */
24273 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024274
Daniel Veillardce244ad2004-11-05 10:03:46 +000024275 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24276 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24277 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24278 mem_base = xmlMemBlocks();
24279 doc = gen_xmlDocPtr(n_doc, 0);
24280 elem = gen_xmlNodePtr(n_elem, 1);
24281 attr = gen_xmlAttrPtr(n_attr, 2);
24282
24283 ret_val = xmlIsRef(doc, elem, attr);
24284 desret_int(ret_val);
24285 call_tests++;
24286 des_xmlDocPtr(n_doc, doc, 0);
24287 des_xmlNodePtr(n_elem, elem, 1);
24288 des_xmlAttrPtr(n_attr, attr, 2);
24289 xmlResetLastError();
24290 if (mem_base != xmlMemBlocks()) {
24291 printf("Leak of %d blocks found in xmlIsRef",
24292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024293 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024294 printf(" %d", n_doc);
24295 printf(" %d", n_elem);
24296 printf(" %d", n_attr);
24297 printf("\n");
24298 }
24299 }
24300 }
24301 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024302 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024303
Daniel Veillard42595322004-11-08 10:52:06 +000024304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024305}
24306
24307
24308static int
24309test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024311
William M. Brack094dd862004-11-14 14:28:34 +000024312 int mem_base;
24313 xmlElementContentPtr ret_val;
24314 xmlChar * name; /* the subelement name or NULL */
24315 int n_name;
24316 xmlElementContentType type; /* the type of element content decl */
24317 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024318
William M. Brack094dd862004-11-14 14:28:34 +000024319 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24320 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24321 mem_base = xmlMemBlocks();
24322 name = gen_const_xmlChar_ptr(n_name, 0);
24323 type = gen_xmlElementContentType(n_type, 1);
24324
24325 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24326 desret_xmlElementContentPtr(ret_val);
24327 call_tests++;
24328 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24329 des_xmlElementContentType(n_type, type, 1);
24330 xmlResetLastError();
24331 if (mem_base != xmlMemBlocks()) {
24332 printf("Leak of %d blocks found in xmlNewElementContent",
24333 xmlMemBlocks() - mem_base);
24334 test_ret++;
24335 printf(" %d", n_name);
24336 printf(" %d", n_type);
24337 printf("\n");
24338 }
24339 }
24340 }
24341 function_tests++;
24342
Daniel Veillard42595322004-11-08 10:52:06 +000024343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024344}
24345
24346
24347static int
24348test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024350
24351
24352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024354}
24355
24356
24357static int
24358test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024360
Daniel Veillardce244ad2004-11-05 10:03:46 +000024361 int mem_base;
24362 int ret_val;
24363 xmlDocPtr doc; /* the document */
24364 int n_doc;
24365 xmlAttrPtr attr; /* the attribute */
24366 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024367
Daniel Veillardce244ad2004-11-05 10:03:46 +000024368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24369 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24370 mem_base = xmlMemBlocks();
24371 doc = gen_xmlDocPtr(n_doc, 0);
24372 attr = gen_xmlAttrPtr(n_attr, 1);
24373
24374 ret_val = xmlRemoveID(doc, attr);
24375 desret_int(ret_val);
24376 call_tests++;
24377 des_xmlDocPtr(n_doc, doc, 0);
24378 des_xmlAttrPtr(n_attr, attr, 1);
24379 xmlResetLastError();
24380 if (mem_base != xmlMemBlocks()) {
24381 printf("Leak of %d blocks found in xmlRemoveID",
24382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024383 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024384 printf(" %d", n_doc);
24385 printf(" %d", n_attr);
24386 printf("\n");
24387 }
24388 }
24389 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024391
Daniel Veillard42595322004-11-08 10:52:06 +000024392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024393}
24394
24395
24396static int
24397test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024399
Daniel Veillardce244ad2004-11-05 10:03:46 +000024400 int mem_base;
24401 int ret_val;
24402 xmlDocPtr doc; /* the document */
24403 int n_doc;
24404 xmlAttrPtr attr; /* the attribute */
24405 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024406
Daniel Veillardce244ad2004-11-05 10:03:46 +000024407 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24408 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24409 mem_base = xmlMemBlocks();
24410 doc = gen_xmlDocPtr(n_doc, 0);
24411 attr = gen_xmlAttrPtr(n_attr, 1);
24412
24413 ret_val = xmlRemoveRef(doc, attr);
24414 desret_int(ret_val);
24415 call_tests++;
24416 des_xmlDocPtr(n_doc, doc, 0);
24417 des_xmlAttrPtr(n_attr, attr, 1);
24418 xmlResetLastError();
24419 if (mem_base != xmlMemBlocks()) {
24420 printf("Leak of %d blocks found in xmlRemoveRef",
24421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024422 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024423 printf(" %d", n_doc);
24424 printf(" %d", n_attr);
24425 printf("\n");
24426 }
24427 }
24428 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024429 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024430
Daniel Veillard42595322004-11-08 10:52:06 +000024431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024432}
24433
24434
24435static int
24436test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024438
Daniel Veillardce682bc2004-11-05 17:22:25 +000024439 int mem_base;
24440 char * buf; /* an output buffer */
24441 int n_buf;
24442 int size; /* the buffer size */
24443 int n_size;
24444 xmlElementContentPtr content; /* An element table */
24445 int n_content;
24446 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24447 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024448
Daniel Veillardce682bc2004-11-05 17:22:25 +000024449 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24450 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24451 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24452 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24453 mem_base = xmlMemBlocks();
24454 buf = gen_char_ptr(n_buf, 0);
24455 size = gen_int(n_size, 1);
24456 content = gen_xmlElementContentPtr(n_content, 2);
24457 glob = gen_int(n_glob, 3);
24458
24459 xmlSnprintfElementContent(buf, size, content, glob);
24460 call_tests++;
24461 des_char_ptr(n_buf, buf, 0);
24462 des_int(n_size, size, 1);
24463 des_xmlElementContentPtr(n_content, content, 2);
24464 des_int(n_glob, glob, 3);
24465 xmlResetLastError();
24466 if (mem_base != xmlMemBlocks()) {
24467 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024469 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024470 printf(" %d", n_buf);
24471 printf(" %d", n_size);
24472 printf(" %d", n_content);
24473 printf(" %d", n_glob);
24474 printf("\n");
24475 }
24476 }
24477 }
24478 }
24479 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024481
Daniel Veillard42595322004-11-08 10:52:06 +000024482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024483}
24484
24485
24486static int
24487test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024489
William M. Brack21e4ef22005-01-02 09:53:13 +000024490#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024491#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024492 int mem_base;
24493 char * buf; /* an output buffer */
24494 int n_buf;
24495 xmlElementContentPtr content; /* An element table */
24496 int n_content;
24497 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24498 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024499
Daniel Veillardce682bc2004-11-05 17:22:25 +000024500 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24501 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24502 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24503 mem_base = xmlMemBlocks();
24504 buf = gen_char_ptr(n_buf, 0);
24505 content = gen_xmlElementContentPtr(n_content, 1);
24506 glob = gen_int(n_glob, 2);
24507
24508 xmlSprintfElementContent(buf, content, glob);
24509 call_tests++;
24510 des_char_ptr(n_buf, buf, 0);
24511 des_xmlElementContentPtr(n_content, content, 1);
24512 des_int(n_glob, glob, 2);
24513 xmlResetLastError();
24514 if (mem_base != xmlMemBlocks()) {
24515 printf("Leak of %d blocks found in xmlSprintfElementContent",
24516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024517 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024518 printf(" %d", n_buf);
24519 printf(" %d", n_content);
24520 printf(" %d", n_glob);
24521 printf("\n");
24522 }
24523 }
24524 }
24525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024526 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024527#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024528#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024529
Daniel Veillard42595322004-11-08 10:52:06 +000024530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024531}
24532
24533
24534static int
24535test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024537
William M. Brack21e4ef22005-01-02 09:53:13 +000024538#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024539 int mem_base;
24540 int ret_val;
24541 xmlValidCtxtPtr ctxt; /* a validation context */
24542 int n_ctxt;
24543 xmlElementPtr elem; /* an element declaration node */
24544 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024545
Daniel Veillardce682bc2004-11-05 17:22:25 +000024546 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24547 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24548 mem_base = xmlMemBlocks();
24549 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24550 elem = gen_xmlElementPtr(n_elem, 1);
24551
24552 ret_val = xmlValidBuildContentModel(ctxt, elem);
24553 desret_int(ret_val);
24554 call_tests++;
24555 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24556 des_xmlElementPtr(n_elem, elem, 1);
24557 xmlResetLastError();
24558 if (mem_base != xmlMemBlocks()) {
24559 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024561 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024562 printf(" %d", n_ctxt);
24563 printf(" %d", n_elem);
24564 printf("\n");
24565 }
24566 }
24567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024568 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024569#endif
24570
Daniel Veillard42595322004-11-08 10:52:06 +000024571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024572}
24573
24574
24575static int
24576test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024578
William M. Brack21e4ef22005-01-02 09:53:13 +000024579#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024580 int mem_base;
24581 xmlChar * ret_val;
24582 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24583 int n_ctxt;
24584 xmlDocPtr doc; /* the document */
24585 int n_doc;
24586 xmlNodePtr elem; /* the parent */
24587 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024588 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024589 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024590 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024591 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024592
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024593 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24594 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24595 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24596 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24597 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24598 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024599 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24600 doc = gen_xmlDocPtr(n_doc, 1);
24601 elem = gen_xmlNodePtr(n_elem, 2);
24602 name = gen_const_xmlChar_ptr(n_name, 3);
24603 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024604
William M. Brackf13f77f2004-11-12 16:03:48 +000024605 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024606 desret_xmlChar_ptr(ret_val);
24607 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024608 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24609 des_xmlDocPtr(n_doc, doc, 1);
24610 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024611 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24612 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024613 xmlResetLastError();
24614 if (mem_base != xmlMemBlocks()) {
24615 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024617 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024618 printf(" %d", n_ctxt);
24619 printf(" %d", n_doc);
24620 printf(" %d", n_elem);
24621 printf(" %d", n_name);
24622 printf(" %d", n_value);
24623 printf("\n");
24624 }
24625 }
24626 }
24627 }
24628 }
24629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024630 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024631#endif
24632
Daniel Veillard42595322004-11-08 10:52:06 +000024633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024634}
24635
24636
Daniel Veillardce682bc2004-11-05 17:22:25 +000024637#define gen_nb_xmlElementContent_ptr 1
24638static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24639 return(NULL);
24640}
24641static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24642}
24643
Daniel Veillardd93f6252004-11-02 15:53:51 +000024644static int
24645test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024647
William M. Brack21e4ef22005-01-02 09:53:13 +000024648#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024649#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024650 int mem_base;
24651 int ret_val;
24652 xmlElementContent * ctree; /* an element content tree */
24653 int n_ctree;
24654 xmlChar ** list; /* an array to store the list of child names */
24655 int n_list;
24656 int * len; /* a pointer to the number of element in the list */
24657 int n_len;
24658 int max; /* the size of the array */
24659 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024660
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024661 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24662 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24663 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24664 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24665 mem_base = xmlMemBlocks();
24666 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24667 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24668 len = gen_int_ptr(n_len, 2);
24669 max = gen_int(n_max, 3);
24670
William M. Brackf13f77f2004-11-12 16:03:48 +000024671 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024672 desret_int(ret_val);
24673 call_tests++;
24674 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024675 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024676 des_int_ptr(n_len, len, 2);
24677 des_int(n_max, max, 3);
24678 xmlResetLastError();
24679 if (mem_base != xmlMemBlocks()) {
24680 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024682 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024683 printf(" %d", n_ctree);
24684 printf(" %d", n_list);
24685 printf(" %d", n_len);
24686 printf(" %d", n_max);
24687 printf("\n");
24688 }
24689 }
24690 }
24691 }
24692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024693 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024694#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024695#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024696
Daniel Veillard42595322004-11-08 10:52:06 +000024697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024698}
24699
24700
24701static int
24702test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024704
William M. Brack21e4ef22005-01-02 09:53:13 +000024705#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024706#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024707 int mem_base;
24708 int ret_val;
24709 xmlNode * prev; /* an element to insert after */
24710 int n_prev;
24711 xmlNode * next; /* an element to insert next */
24712 int n_next;
24713 xmlChar ** names; /* an array to store the list of child names */
24714 int n_names;
24715 int max; /* the size of the array */
24716 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024717
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024718 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24719 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24720 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24721 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24722 mem_base = xmlMemBlocks();
24723 prev = gen_xmlNodePtr(n_prev, 0);
24724 next = gen_xmlNodePtr(n_next, 1);
24725 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24726 max = gen_int(n_max, 3);
24727
William M. Brackf13f77f2004-11-12 16:03:48 +000024728 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024729 desret_int(ret_val);
24730 call_tests++;
24731 des_xmlNodePtr(n_prev, prev, 0);
24732 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024733 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024734 des_int(n_max, max, 3);
24735 xmlResetLastError();
24736 if (mem_base != xmlMemBlocks()) {
24737 printf("Leak of %d blocks found in xmlValidGetValidElements",
24738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024739 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024740 printf(" %d", n_prev);
24741 printf(" %d", n_next);
24742 printf(" %d", n_names);
24743 printf(" %d", n_max);
24744 printf("\n");
24745 }
24746 }
24747 }
24748 }
24749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024750 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024751#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024752#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024753
Daniel Veillard42595322004-11-08 10:52:06 +000024754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024755}
24756
24757
24758static int
24759test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024761
William M. Brack21e4ef22005-01-02 09:53:13 +000024762#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024763 int mem_base;
24764 xmlChar * ret_val;
24765 xmlDocPtr doc; /* the document */
24766 int n_doc;
24767 xmlNodePtr elem; /* the parent */
24768 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024769 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024770 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024771 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024772 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024773
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024774 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24775 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24776 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24777 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24778 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024779 doc = gen_xmlDocPtr(n_doc, 0);
24780 elem = gen_xmlNodePtr(n_elem, 1);
24781 name = gen_const_xmlChar_ptr(n_name, 2);
24782 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024783
William M. Brackf13f77f2004-11-12 16:03:48 +000024784 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024785 desret_xmlChar_ptr(ret_val);
24786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024787 des_xmlDocPtr(n_doc, doc, 0);
24788 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024789 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24790 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024791 xmlResetLastError();
24792 if (mem_base != xmlMemBlocks()) {
24793 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024795 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024796 printf(" %d", n_doc);
24797 printf(" %d", n_elem);
24798 printf(" %d", n_name);
24799 printf(" %d", n_value);
24800 printf("\n");
24801 }
24802 }
24803 }
24804 }
24805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024806 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024807#endif
24808
Daniel Veillard42595322004-11-08 10:52:06 +000024809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024810}
24811
24812
24813static int
24814test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024816
William M. Brack21e4ef22005-01-02 09:53:13 +000024817#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024818 int mem_base;
24819 int ret_val;
24820 xmlValidCtxtPtr ctxt; /* the validation context */
24821 int n_ctxt;
24822 xmlDocPtr doc; /* a document instance */
24823 int n_doc;
24824 xmlAttributePtr attr; /* an attribute definition */
24825 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024826
Daniel Veillardce682bc2004-11-05 17:22:25 +000024827 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24828 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24829 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24830 mem_base = xmlMemBlocks();
24831 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24832 doc = gen_xmlDocPtr(n_doc, 1);
24833 attr = gen_xmlAttributePtr(n_attr, 2);
24834
24835 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24836 desret_int(ret_val);
24837 call_tests++;
24838 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24839 des_xmlDocPtr(n_doc, doc, 1);
24840 des_xmlAttributePtr(n_attr, attr, 2);
24841 xmlResetLastError();
24842 if (mem_base != xmlMemBlocks()) {
24843 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024845 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024846 printf(" %d", n_ctxt);
24847 printf(" %d", n_doc);
24848 printf(" %d", n_attr);
24849 printf("\n");
24850 }
24851 }
24852 }
24853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024854 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024855#endif
24856
Daniel Veillard42595322004-11-08 10:52:06 +000024857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024858}
24859
24860
24861static int
24862test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024864
William M. Brack21e4ef22005-01-02 09:53:13 +000024865#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000024866 int mem_base;
24867 int ret_val;
24868 xmlAttributeType type; /* an attribute type */
24869 int n_type;
24870 xmlChar * value; /* an attribute value */
24871 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024872
Daniel Veillard57b25162004-11-06 14:50:18 +000024873 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24874 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24875 mem_base = xmlMemBlocks();
24876 type = gen_xmlAttributeType(n_type, 0);
24877 value = gen_const_xmlChar_ptr(n_value, 1);
24878
William M. Brackf13f77f2004-11-12 16:03:48 +000024879 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000024880 desret_int(ret_val);
24881 call_tests++;
24882 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024883 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024884 xmlResetLastError();
24885 if (mem_base != xmlMemBlocks()) {
24886 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024888 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024889 printf(" %d", n_type);
24890 printf(" %d", n_value);
24891 printf("\n");
24892 }
24893 }
24894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024895 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024896#endif
24897
Daniel Veillard42595322004-11-08 10:52:06 +000024898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024899}
24900
24901
24902static int
24903test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024905
William M. Brack21e4ef22005-01-02 09:53:13 +000024906#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024907 int mem_base;
24908 int ret_val;
24909 xmlValidCtxtPtr ctxt; /* the validation context */
24910 int n_ctxt;
24911 xmlDocPtr doc; /* a document instance */
24912 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024913
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024914 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24915 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024917 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24918 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024919
24920 ret_val = xmlValidateDocument(ctxt, doc);
24921 desret_int(ret_val);
24922 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024923 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24924 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024925 xmlResetLastError();
24926 if (mem_base != xmlMemBlocks()) {
24927 printf("Leak of %d blocks found in xmlValidateDocument",
24928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024929 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024930 printf(" %d", n_ctxt);
24931 printf(" %d", n_doc);
24932 printf("\n");
24933 }
24934 }
24935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024936 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024937#endif
24938
Daniel Veillard42595322004-11-08 10:52:06 +000024939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024940}
24941
24942
24943static int
24944test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024946
William M. Brack21e4ef22005-01-02 09:53:13 +000024947#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024948 int mem_base;
24949 int ret_val;
24950 xmlValidCtxtPtr ctxt; /* the validation context */
24951 int n_ctxt;
24952 xmlDocPtr doc; /* a document instance */
24953 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024954
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24956 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024958 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24959 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024960
24961 ret_val = xmlValidateDocumentFinal(ctxt, doc);
24962 desret_int(ret_val);
24963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024964 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24965 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024966 xmlResetLastError();
24967 if (mem_base != xmlMemBlocks()) {
24968 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
24969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024970 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024971 printf(" %d", n_ctxt);
24972 printf(" %d", n_doc);
24973 printf("\n");
24974 }
24975 }
24976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024977 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024978#endif
24979
Daniel Veillard42595322004-11-08 10:52:06 +000024980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024981}
24982
24983
24984static int
24985test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024987
William M. Brack21e4ef22005-01-02 09:53:13 +000024988#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000024989 int mem_base;
24990 int ret_val;
24991 xmlValidCtxtPtr ctxt; /* the validation context */
24992 int n_ctxt;
24993 xmlDocPtr doc; /* a document instance */
24994 int n_doc;
24995 xmlDtdPtr dtd; /* a dtd instance */
24996 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024997
Daniel Veillard27f20102004-11-05 11:50:11 +000024998 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24999 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25000 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25001 mem_base = xmlMemBlocks();
25002 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25003 doc = gen_xmlDocPtr(n_doc, 1);
25004 dtd = gen_xmlDtdPtr(n_dtd, 2);
25005
25006 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25007 desret_int(ret_val);
25008 call_tests++;
25009 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25010 des_xmlDocPtr(n_doc, doc, 1);
25011 des_xmlDtdPtr(n_dtd, dtd, 2);
25012 xmlResetLastError();
25013 if (mem_base != xmlMemBlocks()) {
25014 printf("Leak of %d blocks found in xmlValidateDtd",
25015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025016 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025017 printf(" %d", n_ctxt);
25018 printf(" %d", n_doc);
25019 printf(" %d", n_dtd);
25020 printf("\n");
25021 }
25022 }
25023 }
25024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025025 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025026#endif
25027
Daniel Veillard42595322004-11-08 10:52:06 +000025028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025029}
25030
25031
25032static int
25033test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025035
William M. Brack21e4ef22005-01-02 09:53:13 +000025036#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025037 int mem_base;
25038 int ret_val;
25039 xmlValidCtxtPtr ctxt; /* the validation context */
25040 int n_ctxt;
25041 xmlDocPtr doc; /* a document instance */
25042 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025043
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025044 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25045 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25046 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025047 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25048 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025049
25050 ret_val = xmlValidateDtdFinal(ctxt, doc);
25051 desret_int(ret_val);
25052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025053 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25054 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025055 xmlResetLastError();
25056 if (mem_base != xmlMemBlocks()) {
25057 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025059 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025060 printf(" %d", n_ctxt);
25061 printf(" %d", n_doc);
25062 printf("\n");
25063 }
25064 }
25065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025066 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025067#endif
25068
Daniel Veillard42595322004-11-08 10:52:06 +000025069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025070}
25071
25072
25073static int
25074test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025076
William M. Brack21e4ef22005-01-02 09:53:13 +000025077#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025078 int mem_base;
25079 int ret_val;
25080 xmlValidCtxtPtr ctxt; /* the validation context */
25081 int n_ctxt;
25082 xmlDocPtr doc; /* a document instance */
25083 int n_doc;
25084 xmlNodePtr elem; /* an element instance */
25085 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025086
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025087 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25088 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25089 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025091 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25092 doc = gen_xmlDocPtr(n_doc, 1);
25093 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025094
25095 ret_val = xmlValidateElement(ctxt, doc, elem);
25096 desret_int(ret_val);
25097 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025098 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25099 des_xmlDocPtr(n_doc, doc, 1);
25100 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025101 xmlResetLastError();
25102 if (mem_base != xmlMemBlocks()) {
25103 printf("Leak of %d blocks found in xmlValidateElement",
25104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025105 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025106 printf(" %d", n_ctxt);
25107 printf(" %d", n_doc);
25108 printf(" %d", n_elem);
25109 printf("\n");
25110 }
25111 }
25112 }
25113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025114 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025115#endif
25116
Daniel Veillard42595322004-11-08 10:52:06 +000025117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025118}
25119
25120
25121static int
25122test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025124
William M. Brack21e4ef22005-01-02 09:53:13 +000025125#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025126 int mem_base;
25127 int ret_val;
25128 xmlValidCtxtPtr ctxt; /* the validation context */
25129 int n_ctxt;
25130 xmlDocPtr doc; /* a document instance */
25131 int n_doc;
25132 xmlElementPtr elem; /* an element definition */
25133 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025134
Daniel Veillardce682bc2004-11-05 17:22:25 +000025135 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25136 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25137 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25138 mem_base = xmlMemBlocks();
25139 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25140 doc = gen_xmlDocPtr(n_doc, 1);
25141 elem = gen_xmlElementPtr(n_elem, 2);
25142
25143 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25144 desret_int(ret_val);
25145 call_tests++;
25146 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25147 des_xmlDocPtr(n_doc, doc, 1);
25148 des_xmlElementPtr(n_elem, elem, 2);
25149 xmlResetLastError();
25150 if (mem_base != xmlMemBlocks()) {
25151 printf("Leak of %d blocks found in xmlValidateElementDecl",
25152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025153 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025154 printf(" %d", n_ctxt);
25155 printf(" %d", n_doc);
25156 printf(" %d", n_elem);
25157 printf("\n");
25158 }
25159 }
25160 }
25161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025162 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025163#endif
25164
Daniel Veillard42595322004-11-08 10:52:06 +000025165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025166}
25167
25168
25169static int
25170test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025172
William M. Brack21e4ef22005-01-02 09:53:13 +000025173#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025174 int mem_base;
25175 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025176 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025177 int n_value;
25178
25179 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025181 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025182
William M. Brackf13f77f2004-11-12 16:03:48 +000025183 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025184 desret_int(ret_val);
25185 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025186 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025187 xmlResetLastError();
25188 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025189 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025192 printf(" %d", n_value);
25193 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025194 }
25195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025196 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025197#endif
25198
Daniel Veillard42595322004-11-08 10:52:06 +000025199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025200}
25201
25202
25203static int
25204test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025206
William M. Brack21e4ef22005-01-02 09:53:13 +000025207#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025208 int mem_base;
25209 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025210 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025211 int n_value;
25212
25213 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025215 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025216
William M. Brackf13f77f2004-11-12 16:03:48 +000025217 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025218 desret_int(ret_val);
25219 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025220 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025221 xmlResetLastError();
25222 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025223 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025225 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025226 printf(" %d", n_value);
25227 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025228 }
25229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025230 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025231#endif
25232
Daniel Veillard42595322004-11-08 10:52:06 +000025233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025234}
25235
25236
25237static int
25238test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025240
William M. Brack21e4ef22005-01-02 09:53:13 +000025241#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025242 int mem_base;
25243 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025244 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025245 int n_value;
25246
25247 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25248 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025249 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025250
William M. Brackf13f77f2004-11-12 16:03:48 +000025251 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025252 desret_int(ret_val);
25253 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025254 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025255 xmlResetLastError();
25256 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025257 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025259 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025260 printf(" %d", n_value);
25261 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025262 }
25263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025264 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025265#endif
25266
Daniel Veillard42595322004-11-08 10:52:06 +000025267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025268}
25269
25270
25271static int
25272test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025274
William M. Brack21e4ef22005-01-02 09:53:13 +000025275#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025276 int mem_base;
25277 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025278 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025279 int n_value;
25280
25281 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25282 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025283 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025284
William M. Brackf13f77f2004-11-12 16:03:48 +000025285 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025286 desret_int(ret_val);
25287 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025288 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025289 xmlResetLastError();
25290 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025291 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025293 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025294 printf(" %d", n_value);
25295 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025296 }
25297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025298 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025299#endif
25300
Daniel Veillard42595322004-11-08 10:52:06 +000025301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025302}
25303
25304
25305static int
25306test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025308
William M. Brack21e4ef22005-01-02 09:53:13 +000025309#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025310 int mem_base;
25311 int ret_val;
25312 xmlValidCtxtPtr ctxt; /* the validation context */
25313 int n_ctxt;
25314 xmlDocPtr doc; /* a document instance */
25315 int n_doc;
25316 xmlNotationPtr nota; /* a notation definition */
25317 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025318
Daniel Veillardce682bc2004-11-05 17:22:25 +000025319 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25320 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25321 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25322 mem_base = xmlMemBlocks();
25323 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25324 doc = gen_xmlDocPtr(n_doc, 1);
25325 nota = gen_xmlNotationPtr(n_nota, 2);
25326
25327 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25328 desret_int(ret_val);
25329 call_tests++;
25330 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25331 des_xmlDocPtr(n_doc, doc, 1);
25332 des_xmlNotationPtr(n_nota, nota, 2);
25333 xmlResetLastError();
25334 if (mem_base != xmlMemBlocks()) {
25335 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025337 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025338 printf(" %d", n_ctxt);
25339 printf(" %d", n_doc);
25340 printf(" %d", n_nota);
25341 printf("\n");
25342 }
25343 }
25344 }
25345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025346 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025347#endif
25348
Daniel Veillard42595322004-11-08 10:52:06 +000025349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025350}
25351
25352
25353static int
25354test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025356
William M. Brack21e4ef22005-01-02 09:53:13 +000025357#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025358 int mem_base;
25359 int ret_val;
25360 xmlValidCtxtPtr ctxt; /* the validation context */
25361 int n_ctxt;
25362 xmlDocPtr doc; /* the document */
25363 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025364 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025365 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025366
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025367 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25369 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025371 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25372 doc = gen_xmlDocPtr(n_doc, 1);
25373 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025374
William M. Brackf13f77f2004-11-12 16:03:48 +000025375 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025376 desret_int(ret_val);
25377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025378 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25379 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025380 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025381 xmlResetLastError();
25382 if (mem_base != xmlMemBlocks()) {
25383 printf("Leak of %d blocks found in xmlValidateNotationUse",
25384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025385 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025386 printf(" %d", n_ctxt);
25387 printf(" %d", n_doc);
25388 printf(" %d", n_notationName);
25389 printf("\n");
25390 }
25391 }
25392 }
25393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025394 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025395#endif
25396
Daniel Veillard42595322004-11-08 10:52:06 +000025397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025398}
25399
25400
25401static int
25402test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025404
William M. Brack21e4ef22005-01-02 09:53:13 +000025405#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025406 int mem_base;
25407 int ret_val;
25408 xmlValidCtxtPtr ctxt; /* the validation context */
25409 int n_ctxt;
25410 xmlDocPtr doc; /* a document instance */
25411 int n_doc;
25412 xmlNodePtr elem; /* an element instance */
25413 int n_elem;
25414 xmlAttrPtr attr; /* an attribute instance */
25415 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025416 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025417 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025418
Daniel Veillardce244ad2004-11-05 10:03:46 +000025419 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25420 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25421 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25422 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25423 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25424 mem_base = xmlMemBlocks();
25425 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25426 doc = gen_xmlDocPtr(n_doc, 1);
25427 elem = gen_xmlNodePtr(n_elem, 2);
25428 attr = gen_xmlAttrPtr(n_attr, 3);
25429 value = gen_const_xmlChar_ptr(n_value, 4);
25430
William M. Brackf13f77f2004-11-12 16:03:48 +000025431 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025432 desret_int(ret_val);
25433 call_tests++;
25434 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25435 des_xmlDocPtr(n_doc, doc, 1);
25436 des_xmlNodePtr(n_elem, elem, 2);
25437 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025438 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025439 xmlResetLastError();
25440 if (mem_base != xmlMemBlocks()) {
25441 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025443 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025444 printf(" %d", n_ctxt);
25445 printf(" %d", n_doc);
25446 printf(" %d", n_elem);
25447 printf(" %d", n_attr);
25448 printf(" %d", n_value);
25449 printf("\n");
25450 }
25451 }
25452 }
25453 }
25454 }
25455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025456 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025457#endif
25458
Daniel Veillard42595322004-11-08 10:52:06 +000025459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025460}
25461
25462
25463static int
25464test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025466
William M. Brack21e4ef22005-01-02 09:53:13 +000025467#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025468 int mem_base;
25469 int ret_val;
25470 xmlValidCtxtPtr ctxt; /* the validation context */
25471 int n_ctxt;
25472 xmlDocPtr doc; /* a document instance */
25473 int n_doc;
25474 xmlNodePtr elem; /* an element instance */
25475 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025476
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025477 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25478 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25479 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025481 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25482 doc = gen_xmlDocPtr(n_doc, 1);
25483 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025484
25485 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25486 desret_int(ret_val);
25487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025488 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25489 des_xmlDocPtr(n_doc, doc, 1);
25490 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025491 xmlResetLastError();
25492 if (mem_base != xmlMemBlocks()) {
25493 printf("Leak of %d blocks found in xmlValidateOneElement",
25494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025495 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025496 printf(" %d", n_ctxt);
25497 printf(" %d", n_doc);
25498 printf(" %d", n_elem);
25499 printf("\n");
25500 }
25501 }
25502 }
25503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025504 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025505#endif
25506
Daniel Veillard42595322004-11-08 10:52:06 +000025507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025508}
25509
25510
25511static int
25512test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025514
William M. Brack21e4ef22005-01-02 09:53:13 +000025515#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025516 int mem_base;
25517 int ret_val;
25518 xmlValidCtxtPtr ctxt; /* the validation context */
25519 int n_ctxt;
25520 xmlDocPtr doc; /* a document instance */
25521 int n_doc;
25522 xmlNodePtr elem; /* an element instance */
25523 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025524 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025525 int n_prefix;
25526 xmlNsPtr ns; /* an namespace declaration instance */
25527 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025528 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025529 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025530
Daniel Veillard27f20102004-11-05 11:50:11 +000025531 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25532 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25533 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25534 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25535 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25536 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25537 mem_base = xmlMemBlocks();
25538 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25539 doc = gen_xmlDocPtr(n_doc, 1);
25540 elem = gen_xmlNodePtr(n_elem, 2);
25541 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25542 ns = gen_xmlNsPtr(n_ns, 4);
25543 value = gen_const_xmlChar_ptr(n_value, 5);
25544
William M. Brackf13f77f2004-11-12 16:03:48 +000025545 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025546 desret_int(ret_val);
25547 call_tests++;
25548 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25549 des_xmlDocPtr(n_doc, doc, 1);
25550 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025551 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025552 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025553 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025554 xmlResetLastError();
25555 if (mem_base != xmlMemBlocks()) {
25556 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025558 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025559 printf(" %d", n_ctxt);
25560 printf(" %d", n_doc);
25561 printf(" %d", n_elem);
25562 printf(" %d", n_prefix);
25563 printf(" %d", n_ns);
25564 printf(" %d", n_value);
25565 printf("\n");
25566 }
25567 }
25568 }
25569 }
25570 }
25571 }
25572 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025573 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025574#endif
25575
Daniel Veillard42595322004-11-08 10:52:06 +000025576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025577}
25578
25579
25580static int
25581test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025583
William M. Brack21e4ef22005-01-02 09:53:13 +000025584#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025585 int mem_base;
25586 int ret_val;
25587 xmlValidCtxtPtr ctxt; /* the validation context */
25588 int n_ctxt;
25589 xmlDocPtr doc; /* a document instance */
25590 int n_doc;
25591 xmlNodePtr elem; /* an element instance */
25592 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025593 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025594 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025595
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025596 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25597 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25598 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25599 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025601 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25602 doc = gen_xmlDocPtr(n_doc, 1);
25603 elem = gen_xmlNodePtr(n_elem, 2);
25604 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025605
William M. Brackf13f77f2004-11-12 16:03:48 +000025606 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025607 desret_int(ret_val);
25608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025609 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25610 des_xmlDocPtr(n_doc, doc, 1);
25611 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025612 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025613 xmlResetLastError();
25614 if (mem_base != xmlMemBlocks()) {
25615 printf("Leak of %d blocks found in xmlValidatePopElement",
25616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025617 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025618 printf(" %d", n_ctxt);
25619 printf(" %d", n_doc);
25620 printf(" %d", n_elem);
25621 printf(" %d", n_qname);
25622 printf("\n");
25623 }
25624 }
25625 }
25626 }
25627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025628 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025629#endif
25630
Daniel Veillard42595322004-11-08 10:52:06 +000025631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025632}
25633
25634
25635static int
25636test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025638
William M. Brack21e4ef22005-01-02 09:53:13 +000025639#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025640 int mem_base;
25641 int ret_val;
25642 xmlValidCtxtPtr ctxt; /* the validation context */
25643 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025644 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025645 int n_data;
25646 int len; /* the lenght of the data */
25647 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025648
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25650 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25651 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25652 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025653 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25654 data = gen_const_xmlChar_ptr(n_data, 1);
25655 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025656
William M. Brackf13f77f2004-11-12 16:03:48 +000025657 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025658 desret_int(ret_val);
25659 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025660 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025661 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025662 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025663 xmlResetLastError();
25664 if (mem_base != xmlMemBlocks()) {
25665 printf("Leak of %d blocks found in xmlValidatePushCData",
25666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025667 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025668 printf(" %d", n_ctxt);
25669 printf(" %d", n_data);
25670 printf(" %d", n_len);
25671 printf("\n");
25672 }
25673 }
25674 }
25675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025676 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025677#endif
25678
Daniel Veillard42595322004-11-08 10:52:06 +000025679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025680}
25681
25682
25683static int
25684test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025686
William M. Brack21e4ef22005-01-02 09:53:13 +000025687#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025688 int mem_base;
25689 int ret_val;
25690 xmlValidCtxtPtr ctxt; /* the validation context */
25691 int n_ctxt;
25692 xmlDocPtr doc; /* a document instance */
25693 int n_doc;
25694 xmlNodePtr elem; /* an element instance */
25695 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025696 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025697 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025698
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025699 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25700 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25701 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25702 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25703 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025704 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25705 doc = gen_xmlDocPtr(n_doc, 1);
25706 elem = gen_xmlNodePtr(n_elem, 2);
25707 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025708
William M. Brackf13f77f2004-11-12 16:03:48 +000025709 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025710 desret_int(ret_val);
25711 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025712 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25713 des_xmlDocPtr(n_doc, doc, 1);
25714 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025715 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025716 xmlResetLastError();
25717 if (mem_base != xmlMemBlocks()) {
25718 printf("Leak of %d blocks found in xmlValidatePushElement",
25719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025720 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025721 printf(" %d", n_ctxt);
25722 printf(" %d", n_doc);
25723 printf(" %d", n_elem);
25724 printf(" %d", n_qname);
25725 printf("\n");
25726 }
25727 }
25728 }
25729 }
25730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025731 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025732#endif
25733
Daniel Veillard42595322004-11-08 10:52:06 +000025734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025735}
25736
25737
25738static int
25739test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025741
William M. Brack21e4ef22005-01-02 09:53:13 +000025742#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025743 int mem_base;
25744 int ret_val;
25745 xmlValidCtxtPtr ctxt; /* the validation context */
25746 int n_ctxt;
25747 xmlDocPtr doc; /* a document instance */
25748 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025749
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025750 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25751 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025753 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25754 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025755
25756 ret_val = xmlValidateRoot(ctxt, doc);
25757 desret_int(ret_val);
25758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025759 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25760 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025761 xmlResetLastError();
25762 if (mem_base != xmlMemBlocks()) {
25763 printf("Leak of %d blocks found in xmlValidateRoot",
25764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025765 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025766 printf(" %d", n_ctxt);
25767 printf(" %d", n_doc);
25768 printf("\n");
25769 }
25770 }
25771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025772 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025773#endif
25774
Daniel Veillard42595322004-11-08 10:52:06 +000025775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025776}
25777
25778static int
25779test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025781
William M. Brack094dd862004-11-14 14:28:34 +000025782 if (quiet == 0) printf("Testing valid : 48 of 67 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025783 test_ret += test_xmlAddAttributeDecl();
25784 test_ret += test_xmlAddElementDecl();
25785 test_ret += test_xmlAddID();
25786 test_ret += test_xmlAddNotationDecl();
25787 test_ret += test_xmlAddRef();
25788 test_ret += test_xmlCopyAttributeTable();
25789 test_ret += test_xmlCopyElementContent();
25790 test_ret += test_xmlCopyElementTable();
25791 test_ret += test_xmlCopyEnumeration();
25792 test_ret += test_xmlCopyNotationTable();
25793 test_ret += test_xmlCreateEnumeration();
25794 test_ret += test_xmlDumpAttributeDecl();
25795 test_ret += test_xmlDumpAttributeTable();
25796 test_ret += test_xmlDumpElementDecl();
25797 test_ret += test_xmlDumpElementTable();
25798 test_ret += test_xmlDumpNotationDecl();
25799 test_ret += test_xmlDumpNotationTable();
25800 test_ret += test_xmlGetDtdAttrDesc();
25801 test_ret += test_xmlGetDtdElementDesc();
25802 test_ret += test_xmlGetDtdNotationDesc();
25803 test_ret += test_xmlGetDtdQAttrDesc();
25804 test_ret += test_xmlGetDtdQElementDesc();
25805 test_ret += test_xmlGetID();
25806 test_ret += test_xmlGetRefs();
25807 test_ret += test_xmlIsID();
25808 test_ret += test_xmlIsMixedElement();
25809 test_ret += test_xmlIsRef();
25810 test_ret += test_xmlNewElementContent();
25811 test_ret += test_xmlNewValidCtxt();
25812 test_ret += test_xmlRemoveID();
25813 test_ret += test_xmlRemoveRef();
25814 test_ret += test_xmlSnprintfElementContent();
25815 test_ret += test_xmlSprintfElementContent();
25816 test_ret += test_xmlValidBuildContentModel();
25817 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25818 test_ret += test_xmlValidGetPotentialChildren();
25819 test_ret += test_xmlValidGetValidElements();
25820 test_ret += test_xmlValidNormalizeAttributeValue();
25821 test_ret += test_xmlValidateAttributeDecl();
25822 test_ret += test_xmlValidateAttributeValue();
25823 test_ret += test_xmlValidateDocument();
25824 test_ret += test_xmlValidateDocumentFinal();
25825 test_ret += test_xmlValidateDtd();
25826 test_ret += test_xmlValidateDtdFinal();
25827 test_ret += test_xmlValidateElement();
25828 test_ret += test_xmlValidateElementDecl();
25829 test_ret += test_xmlValidateNameValue();
25830 test_ret += test_xmlValidateNamesValue();
25831 test_ret += test_xmlValidateNmtokenValue();
25832 test_ret += test_xmlValidateNmtokensValue();
25833 test_ret += test_xmlValidateNotationDecl();
25834 test_ret += test_xmlValidateNotationUse();
25835 test_ret += test_xmlValidateOneAttribute();
25836 test_ret += test_xmlValidateOneElement();
25837 test_ret += test_xmlValidateOneNamespace();
25838 test_ret += test_xmlValidatePopElement();
25839 test_ret += test_xmlValidatePushCData();
25840 test_ret += test_xmlValidatePushElement();
25841 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025842
Daniel Veillard42595322004-11-08 10:52:06 +000025843 if (test_ret != 0)
25844 printf("Module valid: %d errors\n", test_ret);
25845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025846}
25847
25848static int
25849test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025851
25852
25853 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025855}
25856
25857
25858static int
25859test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025861
William M. Brack21e4ef22005-01-02 09:53:13 +000025862#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025863 int mem_base;
25864 int ret_val;
25865 xmlDocPtr doc; /* an XML document */
25866 int n_doc;
25867
25868 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025870 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025871
25872 ret_val = xmlXIncludeProcess(doc);
25873 desret_int(ret_val);
25874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025875 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025876 xmlResetLastError();
25877 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025878 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025880 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025881 printf(" %d", n_doc);
25882 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025883 }
25884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025885 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025886#endif
25887
Daniel Veillard42595322004-11-08 10:52:06 +000025888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025889}
25890
25891
25892static int
25893test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025895
William M. Brack21e4ef22005-01-02 09:53:13 +000025896#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025897 int mem_base;
25898 int ret_val;
25899 xmlDocPtr doc; /* an XML document */
25900 int n_doc;
25901 int flags; /* a set of xmlParserOption used for parsing XML includes */
25902 int n_flags;
25903
25904 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25905 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25906 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025907 doc = gen_xmlDocPtr(n_doc, 0);
25908 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025909
25910 ret_val = xmlXIncludeProcessFlags(doc, flags);
25911 desret_int(ret_val);
25912 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025913 des_xmlDocPtr(n_doc, doc, 0);
25914 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025915 xmlResetLastError();
25916 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025917 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025919 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025920 printf(" %d", n_doc);
25921 printf(" %d", n_flags);
25922 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025923 }
25924 }
25925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025926 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025927#endif
25928
Daniel Veillard42595322004-11-08 10:52:06 +000025929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025930}
25931
Daniel Veillarda521d282004-11-09 14:59:59 +000025932#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000025933
Daniel Veillardce682bc2004-11-05 17:22:25 +000025934#define gen_nb_xmlXIncludeCtxtPtr 1
25935static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25936 return(NULL);
25937}
25938static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25939}
Daniel Veillarda521d282004-11-09 14:59:59 +000025940#endif
25941
Daniel Veillardce682bc2004-11-05 17:22:25 +000025942
Daniel Veillardd93f6252004-11-02 15:53:51 +000025943static int
25944test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025946
William M. Brack21e4ef22005-01-02 09:53:13 +000025947#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025948 int mem_base;
25949 int ret_val;
25950 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
25951 int n_ctxt;
25952 xmlNodePtr node; /* a node in an XML document */
25953 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025954
Daniel Veillardce682bc2004-11-05 17:22:25 +000025955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25956 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
25957 mem_base = xmlMemBlocks();
25958 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25959 node = gen_xmlNodePtr(n_node, 1);
25960
25961 ret_val = xmlXIncludeProcessNode(ctxt, node);
25962 desret_int(ret_val);
25963 call_tests++;
25964 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25965 des_xmlNodePtr(n_node, node, 1);
25966 xmlResetLastError();
25967 if (mem_base != xmlMemBlocks()) {
25968 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
25969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025970 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025971 printf(" %d", n_ctxt);
25972 printf(" %d", n_node);
25973 printf("\n");
25974 }
25975 }
25976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025977 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025978#endif
25979
Daniel Veillard42595322004-11-08 10:52:06 +000025980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025981}
25982
25983
25984static int
25985test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025987
William M. Brack21e4ef22005-01-02 09:53:13 +000025988#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025989 int mem_base;
25990 int ret_val;
25991 xmlNodePtr tree; /* a node in an XML document */
25992 int n_tree;
25993
25994 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025996 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025997
25998 ret_val = xmlXIncludeProcessTree(tree);
25999 desret_int(ret_val);
26000 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026001 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026002 xmlResetLastError();
26003 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026004 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026006 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026007 printf(" %d", n_tree);
26008 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026009 }
26010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026011 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026012#endif
26013
Daniel Veillard42595322004-11-08 10:52:06 +000026014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026015}
26016
26017
26018static int
26019test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026021
William M. Brack21e4ef22005-01-02 09:53:13 +000026022#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026023 int mem_base;
26024 int ret_val;
26025 xmlNodePtr tree; /* a node in an XML document */
26026 int n_tree;
26027 int flags; /* a set of xmlParserOption used for parsing XML includes */
26028 int n_flags;
26029
26030 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26031 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026033 tree = gen_xmlNodePtr(n_tree, 0);
26034 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026035
26036 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26037 desret_int(ret_val);
26038 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026039 des_xmlNodePtr(n_tree, tree, 0);
26040 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026041 xmlResetLastError();
26042 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026043 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026045 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026046 printf(" %d", n_tree);
26047 printf(" %d", n_flags);
26048 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026049 }
26050 }
26051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026052 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026053#endif
26054
Daniel Veillard42595322004-11-08 10:52:06 +000026055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026056}
26057
26058
26059static int
26060test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026062
William M. Brack21e4ef22005-01-02 09:53:13 +000026063#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026064 int mem_base;
26065 int ret_val;
26066 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26067 int n_ctxt;
26068 int flags; /* a set of xmlParserOption used for parsing XML includes */
26069 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026070
Daniel Veillardce682bc2004-11-05 17:22:25 +000026071 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26072 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26073 mem_base = xmlMemBlocks();
26074 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26075 flags = gen_int(n_flags, 1);
26076
26077 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26078 desret_int(ret_val);
26079 call_tests++;
26080 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26081 des_int(n_flags, flags, 1);
26082 xmlResetLastError();
26083 if (mem_base != xmlMemBlocks()) {
26084 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026086 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026087 printf(" %d", n_ctxt);
26088 printf(" %d", n_flags);
26089 printf("\n");
26090 }
26091 }
26092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026093 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026094#endif
26095
Daniel Veillard42595322004-11-08 10:52:06 +000026096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026097}
26098
26099static int
26100test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026102
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026103 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026104 test_ret += test_xmlXIncludeNewContext();
26105 test_ret += test_xmlXIncludeProcess();
26106 test_ret += test_xmlXIncludeProcessFlags();
26107 test_ret += test_xmlXIncludeProcessNode();
26108 test_ret += test_xmlXIncludeProcessTree();
26109 test_ret += test_xmlXIncludeProcessTreeFlags();
26110 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111
Daniel Veillard42595322004-11-08 10:52:06 +000026112 if (test_ret != 0)
26113 printf("Module xinclude: %d errors\n", test_ret);
26114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026115}
26116
26117static int
26118test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026120
William M. Brack21e4ef22005-01-02 09:53:13 +000026121#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026122 int mem_base;
26123 xmlOutputBufferPtr ret_val;
26124 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26125 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026126
Daniel Veillard3d95c732004-11-06 22:25:14 +000026127 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26128 mem_base = xmlMemBlocks();
26129 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26130
26131 ret_val = xmlAllocOutputBuffer(encoder);
26132 desret_xmlOutputBufferPtr(ret_val);
26133 call_tests++;
26134 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26135 xmlResetLastError();
26136 if (mem_base != xmlMemBlocks()) {
26137 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026139 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026140 printf(" %d", n_encoder);
26141 printf("\n");
26142 }
26143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026144 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026145#endif
26146
Daniel Veillard42595322004-11-08 10:52:06 +000026147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026148}
26149
26150
26151static int
26152test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026154
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026155 int mem_base;
26156 xmlParserInputBufferPtr ret_val;
26157 xmlCharEncoding enc; /* the charset encoding if known */
26158 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026159
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026160 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26161 mem_base = xmlMemBlocks();
26162 enc = gen_xmlCharEncoding(n_enc, 0);
26163
26164 ret_val = xmlAllocParserInputBuffer(enc);
26165 desret_xmlParserInputBufferPtr(ret_val);
26166 call_tests++;
26167 des_xmlCharEncoding(n_enc, enc, 0);
26168 xmlResetLastError();
26169 if (mem_base != xmlMemBlocks()) {
26170 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026172 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026173 printf(" %d", n_enc);
26174 printf("\n");
26175 }
26176 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026178
Daniel Veillard42595322004-11-08 10:52:06 +000026179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026180}
26181
26182
26183static int
26184test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026186
26187 int mem_base;
26188 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026189 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026190 int n_path;
26191
26192 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26193 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026194 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026195
William M. Brackf13f77f2004-11-12 16:03:48 +000026196 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026197 desret_int(ret_val);
26198 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026199 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026200 xmlResetLastError();
26201 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026202 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026204 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026205 printf(" %d", n_path);
26206 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026207 }
26208 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026209 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026210
Daniel Veillard42595322004-11-08 10:52:06 +000026211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026212}
26213
26214
26215static int
26216test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026218
Daniel Veillard42595322004-11-08 10:52:06 +000026219 int mem_base;
26220 xmlParserInputPtr ret_val;
26221 xmlParserCtxtPtr ctxt; /* an XML parser context */
26222 int n_ctxt;
26223 xmlParserInputPtr ret; /* an XML parser input */
26224 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026225
Daniel Veillard42595322004-11-08 10:52:06 +000026226 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26227 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26228 mem_base = xmlMemBlocks();
26229 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26230 ret = gen_xmlParserInputPtr(n_ret, 1);
26231
26232 ret_val = xmlCheckHTTPInput(ctxt, ret);
26233 desret_xmlParserInputPtr(ret_val);
26234 call_tests++;
26235 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26236 des_xmlParserInputPtr(n_ret, ret, 1);
26237 xmlResetLastError();
26238 if (mem_base != xmlMemBlocks()) {
26239 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26240 xmlMemBlocks() - mem_base);
26241 test_ret++;
26242 printf(" %d", n_ctxt);
26243 printf(" %d", n_ret);
26244 printf("\n");
26245 }
26246 }
26247 }
Daniel Veillard42595322004-11-08 10:52:06 +000026248 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026249
Daniel Veillard42595322004-11-08 10:52:06 +000026250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026251}
26252
26253
26254static int
26255test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026257
26258 int mem_base;
26259
26260 mem_base = xmlMemBlocks();
26261
26262 xmlCleanupInputCallbacks();
26263 call_tests++;
26264 xmlResetLastError();
26265 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026266 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026268 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026269 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026270 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026271 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026272
Daniel Veillard42595322004-11-08 10:52:06 +000026273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026274}
26275
26276
26277static int
26278test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026280
William M. Brack21e4ef22005-01-02 09:53:13 +000026281#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026282 int mem_base;
26283
26284 mem_base = xmlMemBlocks();
26285
26286 xmlCleanupOutputCallbacks();
26287 call_tests++;
26288 xmlResetLastError();
26289 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026290 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026292 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026293 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026295 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026296#endif
26297
Daniel Veillard42595322004-11-08 10:52:06 +000026298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026299}
26300
26301
26302static int
26303test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026305
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026306 int mem_base;
26307 int ret_val;
26308 void * context; /* the I/O context */
26309 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026310
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026311 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026313 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026314
26315 ret_val = xmlFileClose(context);
26316 desret_int(ret_val);
26317 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026318 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026319 xmlResetLastError();
26320 if (mem_base != xmlMemBlocks()) {
26321 printf("Leak of %d blocks found in xmlFileClose",
26322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026323 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026324 printf(" %d", n_context);
26325 printf("\n");
26326 }
26327 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026328 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026329
Daniel Veillard42595322004-11-08 10:52:06 +000026330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026331}
26332
26333
26334static int
26335test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026337
26338 int mem_base;
26339 int ret_val;
26340 const char * filename; /* the URI for matching */
26341 int n_filename;
26342
26343 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26344 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026345 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026346
26347 ret_val = xmlFileMatch(filename);
26348 desret_int(ret_val);
26349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026350 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026351 xmlResetLastError();
26352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026353 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026356 printf(" %d", n_filename);
26357 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026358 }
26359 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026360 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026361
Daniel Veillard42595322004-11-08 10:52:06 +000026362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026363}
26364
26365
26366static int
26367test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026369
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026370 int mem_base;
26371 void * ret_val;
26372 const char * filename; /* the URI for matching */
26373 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026375 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26376 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026377 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026378
26379 ret_val = xmlFileOpen(filename);
26380 desret_void_ptr(ret_val);
26381 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026382 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026383 xmlResetLastError();
26384 if (mem_base != xmlMemBlocks()) {
26385 printf("Leak of %d blocks found in xmlFileOpen",
26386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026387 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026388 printf(" %d", n_filename);
26389 printf("\n");
26390 }
26391 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026393
Daniel Veillard42595322004-11-08 10:52:06 +000026394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026395}
26396
26397
26398static int
26399test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026401
Daniel Veillardce682bc2004-11-05 17:22:25 +000026402 int mem_base;
26403 int ret_val;
26404 void * context; /* the I/O context */
26405 int n_context;
26406 char * buffer; /* where to drop data */
26407 int n_buffer;
26408 int len; /* number of bytes to write */
26409 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026410
Daniel Veillardce682bc2004-11-05 17:22:25 +000026411 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26412 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26413 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26414 mem_base = xmlMemBlocks();
26415 context = gen_void_ptr(n_context, 0);
26416 buffer = gen_char_ptr(n_buffer, 1);
26417 len = gen_int(n_len, 2);
26418
26419 ret_val = xmlFileRead(context, buffer, len);
26420 desret_int(ret_val);
26421 call_tests++;
26422 des_void_ptr(n_context, context, 0);
26423 des_char_ptr(n_buffer, buffer, 1);
26424 des_int(n_len, len, 2);
26425 xmlResetLastError();
26426 if (mem_base != xmlMemBlocks()) {
26427 printf("Leak of %d blocks found in xmlFileRead",
26428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026429 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026430 printf(" %d", n_context);
26431 printf(" %d", n_buffer);
26432 printf(" %d", n_len);
26433 printf("\n");
26434 }
26435 }
26436 }
26437 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026438 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026439
Daniel Veillard42595322004-11-08 10:52:06 +000026440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026441}
26442
26443
26444static int
26445test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026447
William M. Brack21e4ef22005-01-02 09:53:13 +000026448#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026449 int mem_base;
26450 int ret_val;
26451 void * context; /* the I/O context */
26452 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026453
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026454 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026456 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026457
26458 ret_val = xmlIOFTPClose(context);
26459 desret_int(ret_val);
26460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026461 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026462 xmlResetLastError();
26463 if (mem_base != xmlMemBlocks()) {
26464 printf("Leak of %d blocks found in xmlIOFTPClose",
26465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026466 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026467 printf(" %d", n_context);
26468 printf("\n");
26469 }
26470 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026471 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026472#endif
26473
Daniel Veillard42595322004-11-08 10:52:06 +000026474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026475}
26476
26477
26478static int
26479test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026481
William M. Brack21e4ef22005-01-02 09:53:13 +000026482#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026483 int mem_base;
26484 int ret_val;
26485 const char * filename; /* the URI for matching */
26486 int n_filename;
26487
26488 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26489 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026490 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026491
26492 ret_val = xmlIOFTPMatch(filename);
26493 desret_int(ret_val);
26494 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026495 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026496 xmlResetLastError();
26497 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026498 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026500 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026501 printf(" %d", n_filename);
26502 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026503 }
26504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026505 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026506#endif
26507
Daniel Veillard42595322004-11-08 10:52:06 +000026508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026509}
26510
26511
26512static int
26513test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026515
William M. Brack21e4ef22005-01-02 09:53:13 +000026516#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026517 int mem_base;
26518 void * ret_val;
26519 const char * filename; /* the URI for matching */
26520 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026521
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026522 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026524 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026525
26526 ret_val = xmlIOFTPOpen(filename);
26527 desret_void_ptr(ret_val);
26528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026529 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026530 xmlResetLastError();
26531 if (mem_base != xmlMemBlocks()) {
26532 printf("Leak of %d blocks found in xmlIOFTPOpen",
26533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026534 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026535 printf(" %d", n_filename);
26536 printf("\n");
26537 }
26538 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026539 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026540#endif
26541
Daniel Veillard42595322004-11-08 10:52:06 +000026542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026543}
26544
26545
26546static int
26547test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026549
William M. Brack21e4ef22005-01-02 09:53:13 +000026550#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026551 int mem_base;
26552 int ret_val;
26553 void * context; /* the I/O context */
26554 int n_context;
26555 char * buffer; /* where to drop data */
26556 int n_buffer;
26557 int len; /* number of bytes to write */
26558 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026559
Daniel Veillardce682bc2004-11-05 17:22:25 +000026560 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26561 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26562 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26563 mem_base = xmlMemBlocks();
26564 context = gen_void_ptr(n_context, 0);
26565 buffer = gen_char_ptr(n_buffer, 1);
26566 len = gen_int(n_len, 2);
26567
26568 ret_val = xmlIOFTPRead(context, buffer, len);
26569 desret_int(ret_val);
26570 call_tests++;
26571 des_void_ptr(n_context, context, 0);
26572 des_char_ptr(n_buffer, buffer, 1);
26573 des_int(n_len, len, 2);
26574 xmlResetLastError();
26575 if (mem_base != xmlMemBlocks()) {
26576 printf("Leak of %d blocks found in xmlIOFTPRead",
26577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026578 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026579 printf(" %d", n_context);
26580 printf(" %d", n_buffer);
26581 printf(" %d", n_len);
26582 printf("\n");
26583 }
26584 }
26585 }
26586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026587 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026588#endif
26589
Daniel Veillard42595322004-11-08 10:52:06 +000026590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026591}
26592
26593
26594static int
26595test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026597
William M. Brack21e4ef22005-01-02 09:53:13 +000026598#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026599 int mem_base;
26600 int ret_val;
26601 void * context; /* the I/O context */
26602 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026603
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026604 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26605 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026606 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026607
26608 ret_val = xmlIOHTTPClose(context);
26609 desret_int(ret_val);
26610 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026611 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026612 xmlResetLastError();
26613 if (mem_base != xmlMemBlocks()) {
26614 printf("Leak of %d blocks found in xmlIOHTTPClose",
26615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026616 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026617 printf(" %d", n_context);
26618 printf("\n");
26619 }
26620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026621 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026622#endif
26623
Daniel Veillard42595322004-11-08 10:52:06 +000026624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026625}
26626
26627
26628static int
26629test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026631
William M. Brack21e4ef22005-01-02 09:53:13 +000026632#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026633 int mem_base;
26634 int ret_val;
26635 const char * filename; /* the URI for matching */
26636 int n_filename;
26637
26638 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026640 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026641
26642 ret_val = xmlIOHTTPMatch(filename);
26643 desret_int(ret_val);
26644 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026645 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026646 xmlResetLastError();
26647 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026648 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026650 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026651 printf(" %d", n_filename);
26652 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026653 }
26654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026655 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026656#endif
26657
Daniel Veillard42595322004-11-08 10:52:06 +000026658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026659}
26660
26661
26662static int
26663test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026665
William M. Brack21e4ef22005-01-02 09:53:13 +000026666#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026667 int mem_base;
26668 void * ret_val;
26669 const char * filename; /* the URI for matching */
26670 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026671
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026672 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26673 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026674 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026675
26676 ret_val = xmlIOHTTPOpen(filename);
26677 desret_void_ptr(ret_val);
26678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026679 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026680 xmlResetLastError();
26681 if (mem_base != xmlMemBlocks()) {
26682 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026684 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026685 printf(" %d", n_filename);
26686 printf("\n");
26687 }
26688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026689 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026690#endif
26691
Daniel Veillard42595322004-11-08 10:52:06 +000026692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026693}
26694
26695
26696static int
26697test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026699
26700
26701 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026703}
26704
26705
26706static int
26707test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026709
William M. Brack21e4ef22005-01-02 09:53:13 +000026710#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026711 int mem_base;
26712 int ret_val;
26713 void * context; /* the I/O context */
26714 int n_context;
26715 char * buffer; /* where to drop data */
26716 int n_buffer;
26717 int len; /* number of bytes to write */
26718 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026719
Daniel Veillardce682bc2004-11-05 17:22:25 +000026720 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26721 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26722 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26723 mem_base = xmlMemBlocks();
26724 context = gen_void_ptr(n_context, 0);
26725 buffer = gen_char_ptr(n_buffer, 1);
26726 len = gen_int(n_len, 2);
26727
26728 ret_val = xmlIOHTTPRead(context, buffer, len);
26729 desret_int(ret_val);
26730 call_tests++;
26731 des_void_ptr(n_context, context, 0);
26732 des_char_ptr(n_buffer, buffer, 1);
26733 des_int(n_len, len, 2);
26734 xmlResetLastError();
26735 if (mem_base != xmlMemBlocks()) {
26736 printf("Leak of %d blocks found in xmlIOHTTPRead",
26737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026738 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026739 printf(" %d", n_context);
26740 printf(" %d", n_buffer);
26741 printf(" %d", n_len);
26742 printf("\n");
26743 }
26744 }
26745 }
26746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026747 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026748#endif
26749
Daniel Veillard42595322004-11-08 10:52:06 +000026750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026751}
26752
26753
26754static int
26755test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026757
Daniel Veillard42595322004-11-08 10:52:06 +000026758 int mem_base;
26759 xmlParserInputPtr ret_val;
26760 const char * URL; /* the URL for the entity to load */
26761 int n_URL;
26762 char * ID; /* the System ID for the entity to load */
26763 int n_ID;
26764 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26765 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026766
Daniel Veillard42595322004-11-08 10:52:06 +000026767 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26768 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26769 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26770 mem_base = xmlMemBlocks();
26771 URL = gen_filepath(n_URL, 0);
26772 ID = gen_const_char_ptr(n_ID, 1);
26773 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26774
William M. Brackf13f77f2004-11-12 16:03:48 +000026775 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026776 desret_xmlParserInputPtr(ret_val);
26777 call_tests++;
26778 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026779 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026780 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26781 xmlResetLastError();
26782 if (mem_base != xmlMemBlocks()) {
26783 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26784 xmlMemBlocks() - mem_base);
26785 test_ret++;
26786 printf(" %d", n_URL);
26787 printf(" %d", n_ID);
26788 printf(" %d", n_ctxt);
26789 printf("\n");
26790 }
26791 }
26792 }
26793 }
Daniel Veillard42595322004-11-08 10:52:06 +000026794 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026795
Daniel Veillard42595322004-11-08 10:52:06 +000026796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026797}
26798
26799
26800static int
26801test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026803
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026804 int mem_base;
26805 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026806 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026807 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026809 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26810 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026811 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026812
William M. Brackf13f77f2004-11-12 16:03:48 +000026813 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026814 desret_xmlChar_ptr(ret_val);
26815 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026816 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026817 xmlResetLastError();
26818 if (mem_base != xmlMemBlocks()) {
26819 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026821 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026822 printf(" %d", n_path);
26823 printf("\n");
26824 }
26825 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026826 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026827
Daniel Veillard42595322004-11-08 10:52:06 +000026828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026829}
26830
26831
26832static int
26833test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026835
William M. Brack21e4ef22005-01-02 09:53:13 +000026836#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026837 int mem_base;
26838 xmlOutputBufferPtr ret_val;
26839 int fd; /* a file descriptor number */
26840 int n_fd;
26841 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26842 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026843
Daniel Veillard3d95c732004-11-06 22:25:14 +000026844 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26845 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26846 mem_base = xmlMemBlocks();
26847 fd = gen_int(n_fd, 0);
26848 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26849
26850 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26851 desret_xmlOutputBufferPtr(ret_val);
26852 call_tests++;
26853 des_int(n_fd, fd, 0);
26854 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26855 xmlResetLastError();
26856 if (mem_base != xmlMemBlocks()) {
26857 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026859 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026860 printf(" %d", n_fd);
26861 printf(" %d", n_encoder);
26862 printf("\n");
26863 }
26864 }
26865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026866 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026867#endif
26868
Daniel Veillard42595322004-11-08 10:52:06 +000026869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026870}
26871
26872
26873static int
26874test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026876
William M. Brack21e4ef22005-01-02 09:53:13 +000026877#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026878 int mem_base;
26879 xmlOutputBufferPtr ret_val;
26880 FILE * file; /* a FILE* */
26881 int n_file;
26882 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26883 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026884
Daniel Veillard3d95c732004-11-06 22:25:14 +000026885 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26886 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26887 mem_base = xmlMemBlocks();
26888 file = gen_FILE_ptr(n_file, 0);
26889 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26890
26891 ret_val = xmlOutputBufferCreateFile(file, encoder);
26892 desret_xmlOutputBufferPtr(ret_val);
26893 call_tests++;
26894 des_FILE_ptr(n_file, file, 0);
26895 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26896 xmlResetLastError();
26897 if (mem_base != xmlMemBlocks()) {
26898 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026900 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026901 printf(" %d", n_file);
26902 printf(" %d", n_encoder);
26903 printf("\n");
26904 }
26905 }
26906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026907 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026908#endif
26909
Daniel Veillard42595322004-11-08 10:52:06 +000026910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026911}
26912
26913
26914static int
26915test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026917
William M. Brack21e4ef22005-01-02 09:53:13 +000026918#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026919 int mem_base;
26920 xmlOutputBufferPtr ret_val;
26921 const char * URI; /* a C string containing the URI or filename */
26922 int n_URI;
26923 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26924 int n_encoder;
26925 int compression; /* the compression ration (0 none, 9 max). */
26926 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026927
Daniel Veillard42595322004-11-08 10:52:06 +000026928 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000026929 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26930 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
26931 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026932 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026933 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26934 compression = gen_int(n_compression, 2);
26935
26936 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
26937 desret_xmlOutputBufferPtr(ret_val);
26938 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026939 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026940 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26941 des_int(n_compression, compression, 2);
26942 xmlResetLastError();
26943 if (mem_base != xmlMemBlocks()) {
26944 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
26945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026946 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026947 printf(" %d", n_URI);
26948 printf(" %d", n_encoder);
26949 printf(" %d", n_compression);
26950 printf("\n");
26951 }
26952 }
26953 }
26954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026955 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026956#endif
26957
Daniel Veillard42595322004-11-08 10:52:06 +000026958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026959}
26960
26961
26962static int
26963test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026965
William M. Brack21e4ef22005-01-02 09:53:13 +000026966#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000026967 int mem_base;
26968 int ret_val;
26969 xmlOutputBufferPtr out; /* a buffered output */
26970 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026971
Daniel Veillard3d97e662004-11-04 10:49:00 +000026972 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26973 mem_base = xmlMemBlocks();
26974 out = gen_xmlOutputBufferPtr(n_out, 0);
26975
26976 ret_val = xmlOutputBufferFlush(out);
26977 desret_int(ret_val);
26978 call_tests++;
26979 des_xmlOutputBufferPtr(n_out, out, 0);
26980 xmlResetLastError();
26981 if (mem_base != xmlMemBlocks()) {
26982 printf("Leak of %d blocks found in xmlOutputBufferFlush",
26983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026984 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026985 printf(" %d", n_out);
26986 printf("\n");
26987 }
26988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026989 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026990#endif
26991
Daniel Veillard42595322004-11-08 10:52:06 +000026992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026993}
26994
26995
26996static int
26997test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026999
William M. Brack21e4ef22005-01-02 09:53:13 +000027000#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027001 int mem_base;
27002 int ret_val;
27003 xmlOutputBufferPtr out; /* a buffered parser output */
27004 int n_out;
27005 int len; /* the size in bytes of the array. */
27006 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027007 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027008 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027009
Daniel Veillard3d97e662004-11-04 10:49:00 +000027010 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27011 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27012 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27013 mem_base = xmlMemBlocks();
27014 out = gen_xmlOutputBufferPtr(n_out, 0);
27015 len = gen_int(n_len, 1);
27016 buf = gen_const_char_ptr(n_buf, 2);
27017
William M. Brackf13f77f2004-11-12 16:03:48 +000027018 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027019 desret_int(ret_val);
27020 call_tests++;
27021 des_xmlOutputBufferPtr(n_out, out, 0);
27022 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027023 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027024 xmlResetLastError();
27025 if (mem_base != xmlMemBlocks()) {
27026 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027028 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027029 printf(" %d", n_out);
27030 printf(" %d", n_len);
27031 printf(" %d", n_buf);
27032 printf("\n");
27033 }
27034 }
27035 }
27036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027037 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027038#endif
27039
Daniel Veillard42595322004-11-08 10:52:06 +000027040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027041}
27042
27043
27044static int
27045test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027047
27048
27049 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027051}
27052
27053
27054static int
27055test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027057
William M. Brack21e4ef22005-01-02 09:53:13 +000027058#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027059 int mem_base;
27060 int ret_val;
27061 xmlOutputBufferPtr out; /* a buffered parser output */
27062 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027063 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027064 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027065
Daniel Veillard3d97e662004-11-04 10:49:00 +000027066 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27067 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27068 mem_base = xmlMemBlocks();
27069 out = gen_xmlOutputBufferPtr(n_out, 0);
27070 str = gen_const_char_ptr(n_str, 1);
27071
William M. Brackf13f77f2004-11-12 16:03:48 +000027072 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027073 desret_int(ret_val);
27074 call_tests++;
27075 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027076 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027077 xmlResetLastError();
27078 if (mem_base != xmlMemBlocks()) {
27079 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027081 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027082 printf(" %d", n_out);
27083 printf(" %d", n_str);
27084 printf("\n");
27085 }
27086 }
27087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027088 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027089#endif
27090
Daniel Veillard42595322004-11-08 10:52:06 +000027091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027092}
27093
27094
27095static int
27096test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027098
27099
27100 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027102}
27103
27104
27105static int
27106test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027108
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027109 int mem_base;
27110 xmlParserInputBufferPtr ret_val;
27111 int fd; /* a file descriptor number */
27112 int n_fd;
27113 xmlCharEncoding enc; /* the charset encoding if known */
27114 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027115
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027116 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27117 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27118 mem_base = xmlMemBlocks();
27119 fd = gen_int(n_fd, 0);
27120 enc = gen_xmlCharEncoding(n_enc, 1);
27121 if (fd >= 0) fd = -1;
27122
27123 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27124 desret_xmlParserInputBufferPtr(ret_val);
27125 call_tests++;
27126 des_int(n_fd, fd, 0);
27127 des_xmlCharEncoding(n_enc, enc, 1);
27128 xmlResetLastError();
27129 if (mem_base != xmlMemBlocks()) {
27130 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027132 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027133 printf(" %d", n_fd);
27134 printf(" %d", n_enc);
27135 printf("\n");
27136 }
27137 }
27138 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027139 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027140
Daniel Veillard42595322004-11-08 10:52:06 +000027141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027142}
27143
27144
27145static int
27146test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027148
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027149 int mem_base;
27150 xmlParserInputBufferPtr ret_val;
27151 FILE * file; /* a FILE* */
27152 int n_file;
27153 xmlCharEncoding enc; /* the charset encoding if known */
27154 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027155
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027156 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27157 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27158 mem_base = xmlMemBlocks();
27159 file = gen_FILE_ptr(n_file, 0);
27160 enc = gen_xmlCharEncoding(n_enc, 1);
27161
27162 ret_val = xmlParserInputBufferCreateFile(file, enc);
27163 desret_xmlParserInputBufferPtr(ret_val);
27164 call_tests++;
27165 des_FILE_ptr(n_file, file, 0);
27166 des_xmlCharEncoding(n_enc, enc, 1);
27167 xmlResetLastError();
27168 if (mem_base != xmlMemBlocks()) {
27169 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027171 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027172 printf(" %d", n_file);
27173 printf(" %d", n_enc);
27174 printf("\n");
27175 }
27176 }
27177 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027179
Daniel Veillard42595322004-11-08 10:52:06 +000027180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027181}
27182
27183
27184static int
27185test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027187
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027188 int mem_base;
27189 xmlParserInputBufferPtr ret_val;
27190 const char * URI; /* a C string containing the URI or filename */
27191 int n_URI;
27192 xmlCharEncoding enc; /* the charset encoding if known */
27193 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027194
Daniel Veillard42595322004-11-08 10:52:06 +000027195 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027196 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27197 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027198 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027199 enc = gen_xmlCharEncoding(n_enc, 1);
27200
27201 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27202 desret_xmlParserInputBufferPtr(ret_val);
27203 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027204 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027205 des_xmlCharEncoding(n_enc, enc, 1);
27206 xmlResetLastError();
27207 if (mem_base != xmlMemBlocks()) {
27208 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027210 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027211 printf(" %d", n_URI);
27212 printf(" %d", n_enc);
27213 printf("\n");
27214 }
27215 }
27216 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027217 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027218
Daniel Veillard42595322004-11-08 10:52:06 +000027219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027220}
27221
27222
27223static int
27224test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027226
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027227 int mem_base;
27228 xmlParserInputBufferPtr ret_val;
27229 char * mem; /* the memory input */
27230 int n_mem;
27231 int size; /* the length of the memory block */
27232 int n_size;
27233 xmlCharEncoding enc; /* the charset encoding if known */
27234 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027235
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027236 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27237 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27238 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27239 mem_base = xmlMemBlocks();
27240 mem = gen_const_char_ptr(n_mem, 0);
27241 size = gen_int(n_size, 1);
27242 enc = gen_xmlCharEncoding(n_enc, 2);
27243
William M. Brackf13f77f2004-11-12 16:03:48 +000027244 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027245 desret_xmlParserInputBufferPtr(ret_val);
27246 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027247 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027248 des_int(n_size, size, 1);
27249 des_xmlCharEncoding(n_enc, enc, 2);
27250 xmlResetLastError();
27251 if (mem_base != xmlMemBlocks()) {
27252 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027254 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027255 printf(" %d", n_mem);
27256 printf(" %d", n_size);
27257 printf(" %d", n_enc);
27258 printf("\n");
27259 }
27260 }
27261 }
27262 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027263 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027264
Daniel Veillard42595322004-11-08 10:52:06 +000027265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027266}
27267
27268
27269static int
27270test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027272
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027273 int mem_base;
27274 xmlParserInputBufferPtr ret_val;
27275 char * mem; /* the memory input */
27276 int n_mem;
27277 int size; /* the length of the memory block */
27278 int n_size;
27279 xmlCharEncoding enc; /* the charset encoding if known */
27280 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027281
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027282 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27283 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27284 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27285 mem_base = xmlMemBlocks();
27286 mem = gen_const_char_ptr(n_mem, 0);
27287 size = gen_int(n_size, 1);
27288 enc = gen_xmlCharEncoding(n_enc, 2);
27289
William M. Brackf13f77f2004-11-12 16:03:48 +000027290 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027291 desret_xmlParserInputBufferPtr(ret_val);
27292 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027293 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027294 des_int(n_size, size, 1);
27295 des_xmlCharEncoding(n_enc, enc, 2);
27296 xmlResetLastError();
27297 if (mem_base != xmlMemBlocks()) {
27298 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027300 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027301 printf(" %d", n_mem);
27302 printf(" %d", n_size);
27303 printf(" %d", n_enc);
27304 printf("\n");
27305 }
27306 }
27307 }
27308 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027310
Daniel Veillard42595322004-11-08 10:52:06 +000027311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027312}
27313
27314
27315static int
27316test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027318
Daniel Veillard34099b42004-11-04 17:34:35 +000027319 int mem_base;
27320 int ret_val;
27321 xmlParserInputBufferPtr in; /* a buffered parser input */
27322 int n_in;
27323 int len; /* indicative value of the amount of chars to read */
27324 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027325
Daniel Veillard34099b42004-11-04 17:34:35 +000027326 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27327 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27328 mem_base = xmlMemBlocks();
27329 in = gen_xmlParserInputBufferPtr(n_in, 0);
27330 len = gen_int(n_len, 1);
27331
27332 ret_val = xmlParserInputBufferGrow(in, len);
27333 desret_int(ret_val);
27334 call_tests++;
27335 des_xmlParserInputBufferPtr(n_in, in, 0);
27336 des_int(n_len, len, 1);
27337 xmlResetLastError();
27338 if (mem_base != xmlMemBlocks()) {
27339 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027341 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027342 printf(" %d", n_in);
27343 printf(" %d", n_len);
27344 printf("\n");
27345 }
27346 }
27347 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027348 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027349
Daniel Veillard42595322004-11-08 10:52:06 +000027350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027351}
27352
27353
27354static int
27355test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027357
Daniel Veillard34099b42004-11-04 17:34:35 +000027358 int mem_base;
27359 int ret_val;
27360 xmlParserInputBufferPtr in; /* a buffered parser input */
27361 int n_in;
27362 int len; /* the size in bytes of the array. */
27363 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027364 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027365 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027366
Daniel Veillard34099b42004-11-04 17:34:35 +000027367 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27368 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27369 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27370 mem_base = xmlMemBlocks();
27371 in = gen_xmlParserInputBufferPtr(n_in, 0);
27372 len = gen_int(n_len, 1);
27373 buf = gen_const_char_ptr(n_buf, 2);
27374
William M. Brackf13f77f2004-11-12 16:03:48 +000027375 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027376 desret_int(ret_val);
27377 call_tests++;
27378 des_xmlParserInputBufferPtr(n_in, in, 0);
27379 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027380 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027381 xmlResetLastError();
27382 if (mem_base != xmlMemBlocks()) {
27383 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027385 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027386 printf(" %d", n_in);
27387 printf(" %d", n_len);
27388 printf(" %d", n_buf);
27389 printf("\n");
27390 }
27391 }
27392 }
27393 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027395
Daniel Veillard42595322004-11-08 10:52:06 +000027396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027397}
27398
27399
27400static int
27401test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027403
Daniel Veillard34099b42004-11-04 17:34:35 +000027404 int mem_base;
27405 int ret_val;
27406 xmlParserInputBufferPtr in; /* a buffered parser input */
27407 int n_in;
27408 int len; /* indicative value of the amount of chars to read */
27409 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027410
Daniel Veillard34099b42004-11-04 17:34:35 +000027411 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27412 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27413 mem_base = xmlMemBlocks();
27414 in = gen_xmlParserInputBufferPtr(n_in, 0);
27415 len = gen_int(n_len, 1);
27416
27417 ret_val = xmlParserInputBufferRead(in, len);
27418 desret_int(ret_val);
27419 call_tests++;
27420 des_xmlParserInputBufferPtr(n_in, in, 0);
27421 des_int(n_len, len, 1);
27422 xmlResetLastError();
27423 if (mem_base != xmlMemBlocks()) {
27424 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027426 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027427 printf(" %d", n_in);
27428 printf(" %d", n_len);
27429 printf("\n");
27430 }
27431 }
27432 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027433 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027434
Daniel Veillard42595322004-11-08 10:52:06 +000027435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027436}
27437
27438
27439static int
27440test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027442
27443 int mem_base;
27444 int ret_val;
27445
27446 mem_base = xmlMemBlocks();
27447
27448 ret_val = xmlPopInputCallbacks();
27449 desret_int(ret_val);
27450 call_tests++;
27451 xmlResetLastError();
27452 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027453 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027455 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027456 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027457 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027458 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027459
Daniel Veillard42595322004-11-08 10:52:06 +000027460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027461}
27462
27463
27464static int
27465test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027467
27468 int mem_base;
27469
27470 mem_base = xmlMemBlocks();
27471
27472 xmlRegisterDefaultInputCallbacks();
27473 call_tests++;
27474 xmlResetLastError();
27475 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027476 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027478 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027480 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027481 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027482
Daniel Veillard42595322004-11-08 10:52:06 +000027483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027484}
27485
27486
27487static int
27488test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027490
William M. Brack21e4ef22005-01-02 09:53:13 +000027491#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027492 int mem_base;
27493
27494 mem_base = xmlMemBlocks();
27495
27496 xmlRegisterDefaultOutputCallbacks();
27497 call_tests++;
27498 xmlResetLastError();
27499 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027500 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027502 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027503 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027505 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027506#endif
27507
Daniel Veillard42595322004-11-08 10:52:06 +000027508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027509}
27510
27511
27512static int
27513test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027515
William M. Brack21e4ef22005-01-02 09:53:13 +000027516#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027517 int mem_base;
27518
27519 mem_base = xmlMemBlocks();
27520
27521 xmlRegisterHTTPPostCallbacks();
27522 call_tests++;
27523 xmlResetLastError();
27524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027525 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027530 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027531#endif
27532
Daniel Veillard42595322004-11-08 10:52:06 +000027533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027534}
27535
27536static int
27537test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027539
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027540 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027541 test_ret += test_xmlAllocOutputBuffer();
27542 test_ret += test_xmlAllocParserInputBuffer();
27543 test_ret += test_xmlCheckFilename();
27544 test_ret += test_xmlCheckHTTPInput();
27545 test_ret += test_xmlCleanupInputCallbacks();
27546 test_ret += test_xmlCleanupOutputCallbacks();
27547 test_ret += test_xmlFileClose();
27548 test_ret += test_xmlFileMatch();
27549 test_ret += test_xmlFileOpen();
27550 test_ret += test_xmlFileRead();
27551 test_ret += test_xmlIOFTPClose();
27552 test_ret += test_xmlIOFTPMatch();
27553 test_ret += test_xmlIOFTPOpen();
27554 test_ret += test_xmlIOFTPRead();
27555 test_ret += test_xmlIOHTTPClose();
27556 test_ret += test_xmlIOHTTPMatch();
27557 test_ret += test_xmlIOHTTPOpen();
27558 test_ret += test_xmlIOHTTPOpenW();
27559 test_ret += test_xmlIOHTTPRead();
27560 test_ret += test_xmlNoNetExternalEntityLoader();
27561 test_ret += test_xmlNormalizeWindowsPath();
27562 test_ret += test_xmlOutputBufferCreateFd();
27563 test_ret += test_xmlOutputBufferCreateFile();
27564 test_ret += test_xmlOutputBufferCreateFilename();
27565 test_ret += test_xmlOutputBufferFlush();
27566 test_ret += test_xmlOutputBufferWrite();
27567 test_ret += test_xmlOutputBufferWriteEscape();
27568 test_ret += test_xmlOutputBufferWriteString();
27569 test_ret += test_xmlParserGetDirectory();
27570 test_ret += test_xmlParserInputBufferCreateFd();
27571 test_ret += test_xmlParserInputBufferCreateFile();
27572 test_ret += test_xmlParserInputBufferCreateFilename();
27573 test_ret += test_xmlParserInputBufferCreateMem();
27574 test_ret += test_xmlParserInputBufferCreateStatic();
27575 test_ret += test_xmlParserInputBufferGrow();
27576 test_ret += test_xmlParserInputBufferPush();
27577 test_ret += test_xmlParserInputBufferRead();
27578 test_ret += test_xmlPopInputCallbacks();
27579 test_ret += test_xmlRegisterDefaultInputCallbacks();
27580 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27581 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027582
Daniel Veillard42595322004-11-08 10:52:06 +000027583 if (test_ret != 0)
27584 printf("Module xmlIO: %d errors\n", test_ret);
27585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027586}
Daniel Veillarda521d282004-11-09 14:59:59 +000027587#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027588
Daniel Veillarda82b1822004-11-08 16:24:57 +000027589#define gen_nb_xmlAutomataPtr 1
27590static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27591 return(NULL);
27592}
27593static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27594}
Daniel Veillarda521d282004-11-09 14:59:59 +000027595#endif
27596
Daniel Veillarda82b1822004-11-08 16:24:57 +000027597
27598static int
27599test_xmlAutomataCompile(void) {
27600 int test_ret = 0;
27601
27602
27603 /* missing type support */
27604 return(test_ret);
27605}
27606
27607
27608static int
27609test_xmlAutomataGetInitState(void) {
27610 int test_ret = 0;
27611
27612
27613 /* missing type support */
27614 return(test_ret);
27615}
27616
27617
27618static int
27619test_xmlAutomataIsDeterminist(void) {
27620 int test_ret = 0;
27621
William M. Brack21e4ef22005-01-02 09:53:13 +000027622#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027623 int mem_base;
27624 int ret_val;
27625 xmlAutomataPtr am; /* an automata */
27626 int n_am;
27627
27628 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27629 mem_base = xmlMemBlocks();
27630 am = gen_xmlAutomataPtr(n_am, 0);
27631
27632 ret_val = xmlAutomataIsDeterminist(am);
27633 desret_int(ret_val);
27634 call_tests++;
27635 des_xmlAutomataPtr(n_am, am, 0);
27636 xmlResetLastError();
27637 if (mem_base != xmlMemBlocks()) {
27638 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27639 xmlMemBlocks() - mem_base);
27640 test_ret++;
27641 printf(" %d", n_am);
27642 printf("\n");
27643 }
27644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027645 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027646#endif
27647
Daniel Veillarda82b1822004-11-08 16:24:57 +000027648 return(test_ret);
27649}
27650
Daniel Veillarda521d282004-11-09 14:59:59 +000027651#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027652
27653#define gen_nb_xmlAutomataStatePtr 1
27654static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27655 return(NULL);
27656}
27657static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27658}
Daniel Veillarda521d282004-11-09 14:59:59 +000027659#endif
27660
Daniel Veillarda82b1822004-11-08 16:24:57 +000027661
27662static int
27663test_xmlAutomataNewAllTrans(void) {
27664 int test_ret = 0;
27665
27666
27667 /* missing type support */
27668 return(test_ret);
27669}
27670
27671
27672static int
27673test_xmlAutomataNewCountTrans(void) {
27674 int test_ret = 0;
27675
27676
27677 /* missing type support */
27678 return(test_ret);
27679}
27680
27681
27682static int
27683test_xmlAutomataNewCountTrans2(void) {
27684 int test_ret = 0;
27685
27686
27687 /* missing type support */
27688 return(test_ret);
27689}
27690
27691
27692static int
27693test_xmlAutomataNewCountedTrans(void) {
27694 int test_ret = 0;
27695
27696
27697 /* missing type support */
27698 return(test_ret);
27699}
27700
27701
27702static int
27703test_xmlAutomataNewCounter(void) {
27704 int test_ret = 0;
27705
William M. Brack21e4ef22005-01-02 09:53:13 +000027706#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027707 int mem_base;
27708 int ret_val;
27709 xmlAutomataPtr am; /* an automata */
27710 int n_am;
27711 int min; /* the minimal value on the counter */
27712 int n_min;
27713 int max; /* the maximal value on the counter */
27714 int n_max;
27715
27716 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27717 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27718 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27719 mem_base = xmlMemBlocks();
27720 am = gen_xmlAutomataPtr(n_am, 0);
27721 min = gen_int(n_min, 1);
27722 max = gen_int(n_max, 2);
27723
27724 ret_val = xmlAutomataNewCounter(am, min, max);
27725 desret_int(ret_val);
27726 call_tests++;
27727 des_xmlAutomataPtr(n_am, am, 0);
27728 des_int(n_min, min, 1);
27729 des_int(n_max, max, 2);
27730 xmlResetLastError();
27731 if (mem_base != xmlMemBlocks()) {
27732 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27733 xmlMemBlocks() - mem_base);
27734 test_ret++;
27735 printf(" %d", n_am);
27736 printf(" %d", n_min);
27737 printf(" %d", n_max);
27738 printf("\n");
27739 }
27740 }
27741 }
27742 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027743 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027744#endif
27745
Daniel Veillarda82b1822004-11-08 16:24:57 +000027746 return(test_ret);
27747}
27748
27749
27750static int
27751test_xmlAutomataNewCounterTrans(void) {
27752 int test_ret = 0;
27753
27754
27755 /* missing type support */
27756 return(test_ret);
27757}
27758
27759
27760static int
27761test_xmlAutomataNewEpsilon(void) {
27762 int test_ret = 0;
27763
27764
27765 /* missing type support */
27766 return(test_ret);
27767}
27768
27769
27770static int
27771test_xmlAutomataNewOnceTrans(void) {
27772 int test_ret = 0;
27773
27774
27775 /* missing type support */
27776 return(test_ret);
27777}
27778
27779
27780static int
27781test_xmlAutomataNewOnceTrans2(void) {
27782 int test_ret = 0;
27783
27784
27785 /* missing type support */
27786 return(test_ret);
27787}
27788
27789
27790static int
27791test_xmlAutomataNewState(void) {
27792 int test_ret = 0;
27793
27794
27795 /* missing type support */
27796 return(test_ret);
27797}
27798
27799
27800static int
27801test_xmlAutomataNewTransition(void) {
27802 int test_ret = 0;
27803
27804
27805 /* missing type support */
27806 return(test_ret);
27807}
27808
27809
27810static int
27811test_xmlAutomataNewTransition2(void) {
27812 int test_ret = 0;
27813
27814
27815 /* missing type support */
27816 return(test_ret);
27817}
27818
27819
27820static int
27821test_xmlAutomataSetFinalState(void) {
27822 int test_ret = 0;
27823
William M. Brack21e4ef22005-01-02 09:53:13 +000027824#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027825 int mem_base;
27826 int ret_val;
27827 xmlAutomataPtr am; /* an automata */
27828 int n_am;
27829 xmlAutomataStatePtr state; /* a state in this automata */
27830 int n_state;
27831
27832 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27833 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27834 mem_base = xmlMemBlocks();
27835 am = gen_xmlAutomataPtr(n_am, 0);
27836 state = gen_xmlAutomataStatePtr(n_state, 1);
27837
27838 ret_val = xmlAutomataSetFinalState(am, state);
27839 desret_int(ret_val);
27840 call_tests++;
27841 des_xmlAutomataPtr(n_am, am, 0);
27842 des_xmlAutomataStatePtr(n_state, state, 1);
27843 xmlResetLastError();
27844 if (mem_base != xmlMemBlocks()) {
27845 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27846 xmlMemBlocks() - mem_base);
27847 test_ret++;
27848 printf(" %d", n_am);
27849 printf(" %d", n_state);
27850 printf("\n");
27851 }
27852 }
27853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027854 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027855#endif
27856
Daniel Veillarda82b1822004-11-08 16:24:57 +000027857 return(test_ret);
27858}
27859
27860
27861static int
27862test_xmlNewAutomata(void) {
27863 int test_ret = 0;
27864
27865
27866 /* missing type support */
27867 return(test_ret);
27868}
27869
27870static int
27871test_xmlautomata(void) {
27872 int test_ret = 0;
27873
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027874 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000027875 test_ret += test_xmlAutomataCompile();
27876 test_ret += test_xmlAutomataGetInitState();
27877 test_ret += test_xmlAutomataIsDeterminist();
27878 test_ret += test_xmlAutomataNewAllTrans();
27879 test_ret += test_xmlAutomataNewCountTrans();
27880 test_ret += test_xmlAutomataNewCountTrans2();
27881 test_ret += test_xmlAutomataNewCountedTrans();
27882 test_ret += test_xmlAutomataNewCounter();
27883 test_ret += test_xmlAutomataNewCounterTrans();
27884 test_ret += test_xmlAutomataNewEpsilon();
27885 test_ret += test_xmlAutomataNewOnceTrans();
27886 test_ret += test_xmlAutomataNewOnceTrans2();
27887 test_ret += test_xmlAutomataNewState();
27888 test_ret += test_xmlAutomataNewTransition();
27889 test_ret += test_xmlAutomataNewTransition2();
27890 test_ret += test_xmlAutomataSetFinalState();
27891 test_ret += test_xmlNewAutomata();
27892
27893 if (test_ret != 0)
27894 printf("Module xmlautomata: %d errors\n", test_ret);
27895 return(test_ret);
27896}
27897
Daniel Veillardce682bc2004-11-05 17:22:25 +000027898#define gen_nb_xmlGenericErrorFunc_ptr 1
27899static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27900 return(NULL);
27901}
27902static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27903}
27904
Daniel Veillardd93f6252004-11-02 15:53:51 +000027905static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027906test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027908
Daniel Veillardce682bc2004-11-05 17:22:25 +000027909 int mem_base;
27910 xmlGenericErrorFunc * handler; /* the handler */
27911 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027912
Daniel Veillardce682bc2004-11-05 17:22:25 +000027913 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27914 mem_base = xmlMemBlocks();
27915 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27916
27917 initGenericErrorDefaultFunc(handler);
27918 call_tests++;
27919 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27920 xmlResetLastError();
27921 if (mem_base != xmlMemBlocks()) {
27922 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
27923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027924 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027925 printf(" %d", n_handler);
27926 printf("\n");
27927 }
27928 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027929 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027930
Daniel Veillard42595322004-11-08 10:52:06 +000027931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027932}
27933
27934
Daniel Veillardce682bc2004-11-05 17:22:25 +000027935#define gen_nb_xmlErrorPtr 1
27936static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27937 return(NULL);
27938}
27939static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27940}
27941
Daniel Veillardd93f6252004-11-02 15:53:51 +000027942static int
27943test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027945
Daniel Veillardce682bc2004-11-05 17:22:25 +000027946 int mem_base;
27947 int ret_val;
27948 xmlErrorPtr from; /* a source error */
27949 int n_from;
27950 xmlErrorPtr to; /* a target error */
27951 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027952
Daniel Veillardce682bc2004-11-05 17:22:25 +000027953 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
27954 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
27955 mem_base = xmlMemBlocks();
27956 from = gen_xmlErrorPtr(n_from, 0);
27957 to = gen_xmlErrorPtr(n_to, 1);
27958
27959 ret_val = xmlCopyError(from, to);
27960 desret_int(ret_val);
27961 call_tests++;
27962 des_xmlErrorPtr(n_from, from, 0);
27963 des_xmlErrorPtr(n_to, to, 1);
27964 xmlResetLastError();
27965 if (mem_base != xmlMemBlocks()) {
27966 printf("Leak of %d blocks found in xmlCopyError",
27967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027968 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027969 printf(" %d", n_from);
27970 printf(" %d", n_to);
27971 printf("\n");
27972 }
27973 }
27974 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027975 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027976
Daniel Veillard42595322004-11-08 10:52:06 +000027977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027978}
27979
27980
27981static int
27982test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027984
27985
27986 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027988}
27989
27990
27991static int
27992test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027994
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027995 int mem_base;
27996 void * ctx; /* an XML parser context */
27997 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027998
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027999 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28000 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028001 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028002
28003 xmlCtxtResetLastError(ctx);
28004 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028005 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028006 xmlResetLastError();
28007 if (mem_base != xmlMemBlocks()) {
28008 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028010 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028011 printf(" %d", n_ctx);
28012 printf("\n");
28013 }
28014 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028015 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028016
Daniel Veillard42595322004-11-08 10:52:06 +000028017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028018}
28019
28020
28021static int
28022test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028024
28025
28026 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028028}
28029
28030
28031static int
28032test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028034
28035
28036 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028038}
28039
28040
28041static int
28042test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028044
Daniel Veillardce682bc2004-11-05 17:22:25 +000028045 int mem_base;
28046 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28047 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028048
Daniel Veillardce682bc2004-11-05 17:22:25 +000028049 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28050 mem_base = xmlMemBlocks();
28051 input = gen_xmlParserInputPtr(n_input, 0);
28052
28053 xmlParserPrintFileContext(input);
28054 call_tests++;
28055 des_xmlParserInputPtr(n_input, input, 0);
28056 xmlResetLastError();
28057 if (mem_base != xmlMemBlocks()) {
28058 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028060 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028061 printf(" %d", n_input);
28062 printf("\n");
28063 }
28064 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028065 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028066
Daniel Veillard42595322004-11-08 10:52:06 +000028067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028068}
28069
28070
28071static int
28072test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028074
Daniel Veillardce682bc2004-11-05 17:22:25 +000028075 int mem_base;
28076 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28077 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028078
Daniel Veillardce682bc2004-11-05 17:22:25 +000028079 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28080 mem_base = xmlMemBlocks();
28081 input = gen_xmlParserInputPtr(n_input, 0);
28082
28083 xmlParserPrintFileInfo(input);
28084 call_tests++;
28085 des_xmlParserInputPtr(n_input, input, 0);
28086 xmlResetLastError();
28087 if (mem_base != xmlMemBlocks()) {
28088 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028090 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028091 printf(" %d", n_input);
28092 printf("\n");
28093 }
28094 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028095 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028096
Daniel Veillard42595322004-11-08 10:52:06 +000028097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028098}
28099
28100
28101static int
28102test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028104
28105
28106 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028108}
28109
28110
28111static int
28112test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028114
28115
28116 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028118}
28119
28120
28121static int
28122test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028124
28125
28126 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028128}
28129
28130
28131static int
28132test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028134
Daniel Veillardce682bc2004-11-05 17:22:25 +000028135 int mem_base;
28136 xmlErrorPtr err; /* pointer to the error. */
28137 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028138
Daniel Veillardce682bc2004-11-05 17:22:25 +000028139 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28140 mem_base = xmlMemBlocks();
28141 err = gen_xmlErrorPtr(n_err, 0);
28142
28143 xmlResetError(err);
28144 call_tests++;
28145 des_xmlErrorPtr(n_err, err, 0);
28146 xmlResetLastError();
28147 if (mem_base != xmlMemBlocks()) {
28148 printf("Leak of %d blocks found in xmlResetError",
28149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028150 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028151 printf(" %d", n_err);
28152 printf("\n");
28153 }
28154 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028155 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028156
Daniel Veillard42595322004-11-08 10:52:06 +000028157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028158}
28159
28160
28161static int
28162test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028164
28165
28166
28167 xmlResetLastError();
28168 call_tests++;
28169 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028171
Daniel Veillard42595322004-11-08 10:52:06 +000028172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028173}
28174
28175
28176static int
28177test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028179
28180
28181 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028183}
28184
28185
28186static int
28187test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028189
28190
28191 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028193}
28194
28195static int
28196test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028198
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028199 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028200 test_ret += test_initGenericErrorDefaultFunc();
28201 test_ret += test_xmlCopyError();
28202 test_ret += test_xmlCtxtGetLastError();
28203 test_ret += test_xmlCtxtResetLastError();
28204 test_ret += test_xmlGetLastError();
28205 test_ret += test_xmlParserError();
28206 test_ret += test_xmlParserPrintFileContext();
28207 test_ret += test_xmlParserPrintFileInfo();
28208 test_ret += test_xmlParserValidityError();
28209 test_ret += test_xmlParserValidityWarning();
28210 test_ret += test_xmlParserWarning();
28211 test_ret += test_xmlResetError();
28212 test_ret += test_xmlResetLastError();
28213 test_ret += test_xmlSetGenericErrorFunc();
28214 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028215
Daniel Veillard42595322004-11-08 10:52:06 +000028216 if (test_ret != 0)
28217 printf("Module xmlerror: %d errors\n", test_ret);
28218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028219}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028220
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028221#define gen_nb_xmlModulePtr 1
28222static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28223 return(NULL);
28224}
28225static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28226}
28227
28228static int
28229test_xmlModuleClose(void) {
28230 int test_ret = 0;
28231
28232#if defined(LIBXML_MODULES_ENABLED)
28233 int mem_base;
28234 int ret_val;
28235 xmlModulePtr module; /* the module handle */
28236 int n_module;
28237
28238 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28239 mem_base = xmlMemBlocks();
28240 module = gen_xmlModulePtr(n_module, 0);
28241
28242 ret_val = xmlModuleClose(module);
28243 desret_int(ret_val);
28244 call_tests++;
28245 des_xmlModulePtr(n_module, module, 0);
28246 xmlResetLastError();
28247 if (mem_base != xmlMemBlocks()) {
28248 printf("Leak of %d blocks found in xmlModuleClose",
28249 xmlMemBlocks() - mem_base);
28250 test_ret++;
28251 printf(" %d", n_module);
28252 printf("\n");
28253 }
28254 }
28255 function_tests++;
28256#endif
28257
28258 return(test_ret);
28259}
28260
28261
28262static int
28263test_xmlModuleOpen(void) {
28264 int test_ret = 0;
28265
28266
28267 /* missing type support */
28268 return(test_ret);
28269}
28270
28271
28272static int
28273test_xmlModuleSymbol(void) {
28274 int test_ret = 0;
28275
28276#if defined(LIBXML_MODULES_ENABLED)
28277 int mem_base;
28278 void * ret_val;
28279 xmlModulePtr module; /* the module */
28280 int n_module;
28281 char * name; /* the name of the symbol */
28282 int n_name;
28283
28284 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28285 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
28286 mem_base = xmlMemBlocks();
28287 module = gen_xmlModulePtr(n_module, 0);
28288 name = gen_const_char_ptr(n_name, 1);
28289
28290 ret_val = xmlModuleSymbol(module, (const char *)name);
28291 desret_void_ptr(ret_val);
28292 call_tests++;
28293 des_xmlModulePtr(n_module, module, 0);
28294 des_const_char_ptr(n_name, (const char *)name, 1);
28295 xmlResetLastError();
28296 if (mem_base != xmlMemBlocks()) {
28297 printf("Leak of %d blocks found in xmlModuleSymbol",
28298 xmlMemBlocks() - mem_base);
28299 test_ret++;
28300 printf(" %d", n_module);
28301 printf(" %d", n_name);
28302 printf("\n");
28303 }
28304 }
28305 }
28306 function_tests++;
28307#endif
28308
28309 return(test_ret);
28310}
28311
28312static int
28313test_xmlmodule(void) {
28314 int test_ret = 0;
28315
28316 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28317 test_ret += test_xmlModuleClose();
28318 test_ret += test_xmlModuleOpen();
28319 test_ret += test_xmlModuleSymbol();
28320
28321 if (test_ret != 0)
28322 printf("Module xmlmodule: %d errors\n", test_ret);
28323 return(test_ret);
28324}
28325
Daniel Veillardd93f6252004-11-02 15:53:51 +000028326static int
28327test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028329
William M. Brack21e4ef22005-01-02 09:53:13 +000028330#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028331 int mem_base;
28332 xmlTextReaderPtr ret_val;
28333 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28334 int n_input;
28335 const char * URI; /* the URI information for the source if available */
28336 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028337
Daniel Veillard34099b42004-11-04 17:34:35 +000028338 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28339 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28340 mem_base = xmlMemBlocks();
28341 input = gen_xmlParserInputBufferPtr(n_input, 0);
28342 URI = gen_filepath(n_URI, 1);
28343
28344 ret_val = xmlNewTextReader(input, URI);
28345 desret_xmlTextReaderPtr(ret_val);
28346 call_tests++;
28347 des_xmlParserInputBufferPtr(n_input, input, 0);
28348 des_filepath(n_URI, URI, 1);
28349 xmlResetLastError();
28350 if (mem_base != xmlMemBlocks()) {
28351 printf("Leak of %d blocks found in xmlNewTextReader",
28352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028353 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028354 printf(" %d", n_input);
28355 printf(" %d", n_URI);
28356 printf("\n");
28357 }
28358 }
28359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028360 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028361#endif
28362
Daniel Veillard42595322004-11-08 10:52:06 +000028363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028364}
28365
28366
28367static int
28368test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028370
William M. Brack21e4ef22005-01-02 09:53:13 +000028371#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028372 int mem_base;
28373 xmlTextReaderPtr ret_val;
28374 const char * URI; /* the URI of the resource to process */
28375 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028376
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028377 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28378 mem_base = xmlMemBlocks();
28379 URI = gen_filepath(n_URI, 0);
28380
28381 ret_val = xmlNewTextReaderFilename(URI);
28382 desret_xmlTextReaderPtr(ret_val);
28383 call_tests++;
28384 des_filepath(n_URI, URI, 0);
28385 xmlResetLastError();
28386 if (mem_base != xmlMemBlocks()) {
28387 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028389 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028390 printf(" %d", n_URI);
28391 printf("\n");
28392 }
28393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028394 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028395#endif
28396
Daniel Veillard42595322004-11-08 10:52:06 +000028397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028398}
28399
28400
28401static int
28402test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028404
William M. Brack21e4ef22005-01-02 09:53:13 +000028405#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028406 int mem_base;
28407 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028408 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028409 int n_cur;
28410 const char * URL; /* the base URL to use for the document */
28411 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028412 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028413 int n_encoding;
28414 int options; /* a combination of xmlParserOption */
28415 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028416
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028417 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28418 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28419 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028420 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028421 mem_base = xmlMemBlocks();
28422 cur = gen_const_xmlChar_ptr(n_cur, 0);
28423 URL = gen_filepath(n_URL, 1);
28424 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028425 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028426
William M. Brackf13f77f2004-11-12 16:03:48 +000028427 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028428 desret_xmlTextReaderPtr(ret_val);
28429 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028430 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028431 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028432 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028433 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028434 xmlResetLastError();
28435 if (mem_base != xmlMemBlocks()) {
28436 printf("Leak of %d blocks found in xmlReaderForDoc",
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_cur);
28440 printf(" %d", n_URL);
28441 printf(" %d", n_encoding);
28442 printf(" %d", n_options);
28443 printf("\n");
28444 }
28445 }
28446 }
28447 }
28448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028449 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028450#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028451
Daniel Veillard42595322004-11-08 10:52:06 +000028452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028453}
28454
28455
28456static int
28457test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028459
William M. Brack21e4ef22005-01-02 09:53:13 +000028460#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028461 int mem_base;
28462 xmlTextReaderPtr ret_val;
28463 const char * filename; /* a file or URL */
28464 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028465 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028466 int n_encoding;
28467 int options; /* a combination of xmlParserOption */
28468 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028469
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028470 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28471 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028472 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028473 mem_base = xmlMemBlocks();
28474 filename = gen_filepath(n_filename, 0);
28475 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028476 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028477
William M. Brackf13f77f2004-11-12 16:03:48 +000028478 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028479 desret_xmlTextReaderPtr(ret_val);
28480 call_tests++;
28481 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028482 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028483 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028484 xmlResetLastError();
28485 if (mem_base != xmlMemBlocks()) {
28486 printf("Leak of %d blocks found in xmlReaderForFile",
28487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028488 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028489 printf(" %d", n_filename);
28490 printf(" %d", n_encoding);
28491 printf(" %d", n_options);
28492 printf("\n");
28493 }
28494 }
28495 }
28496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028497 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028498#endif
28499
Daniel Veillard42595322004-11-08 10:52:06 +000028500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028501}
28502
28503
28504static int
28505test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028507
William M. Brack21e4ef22005-01-02 09:53:13 +000028508#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028509 int mem_base;
28510 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028511 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028512 int n_buffer;
28513 int size; /* the size of the array */
28514 int n_size;
28515 const char * URL; /* the base URL to use for the document */
28516 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028517 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028518 int n_encoding;
28519 int options; /* a combination of xmlParserOption */
28520 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028521
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028522 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28523 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28524 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28525 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028526 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028527 mem_base = xmlMemBlocks();
28528 buffer = gen_const_char_ptr(n_buffer, 0);
28529 size = gen_int(n_size, 1);
28530 URL = gen_filepath(n_URL, 2);
28531 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028532 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028533
William M. Brackf13f77f2004-11-12 16:03:48 +000028534 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028535 desret_xmlTextReaderPtr(ret_val);
28536 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028537 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028538 des_int(n_size, size, 1);
28539 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028540 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028541 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028542 xmlResetLastError();
28543 if (mem_base != xmlMemBlocks()) {
28544 printf("Leak of %d blocks found in xmlReaderForMemory",
28545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028546 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028547 printf(" %d", n_buffer);
28548 printf(" %d", n_size);
28549 printf(" %d", n_URL);
28550 printf(" %d", n_encoding);
28551 printf(" %d", n_options);
28552 printf("\n");
28553 }
28554 }
28555 }
28556 }
28557 }
28558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028559 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028560#endif
28561
Daniel Veillard42595322004-11-08 10:52:06 +000028562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028563}
28564
28565
28566static int
28567test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028569
William M. Brack21e4ef22005-01-02 09:53:13 +000028570#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028571 int mem_base;
28572 int ret_val;
28573 xmlTextReaderPtr reader; /* an XML reader */
28574 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028575 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028576 int n_cur;
28577 const char * URL; /* the base URL to use for the document */
28578 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028579 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028580 int n_encoding;
28581 int options; /* a combination of xmlParserOption */
28582 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028583
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028584 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28585 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28586 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28587 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028588 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028590 reader = gen_xmlTextReaderPtr(n_reader, 0);
28591 cur = gen_const_xmlChar_ptr(n_cur, 1);
28592 URL = gen_filepath(n_URL, 2);
28593 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028594 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028595
William M. Brackf13f77f2004-11-12 16:03:48 +000028596 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028597 desret_int(ret_val);
28598 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028599 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028600 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028601 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028602 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028603 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028604 xmlResetLastError();
28605 if (mem_base != xmlMemBlocks()) {
28606 printf("Leak of %d blocks found in xmlReaderNewDoc",
28607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028608 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028609 printf(" %d", n_reader);
28610 printf(" %d", n_cur);
28611 printf(" %d", n_URL);
28612 printf(" %d", n_encoding);
28613 printf(" %d", n_options);
28614 printf("\n");
28615 }
28616 }
28617 }
28618 }
28619 }
28620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028621 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028622#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028623
Daniel Veillard42595322004-11-08 10:52:06 +000028624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028625}
28626
28627
28628static int
28629test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028631
William M. Brack21e4ef22005-01-02 09:53:13 +000028632#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028633 int mem_base;
28634 int ret_val;
28635 xmlTextReaderPtr reader; /* an XML reader */
28636 int n_reader;
28637 const char * filename; /* a file or URL */
28638 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028639 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028640 int n_encoding;
28641 int options; /* a combination of xmlParserOption */
28642 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028643
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028644 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28645 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28646 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028647 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028648 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028649 reader = gen_xmlTextReaderPtr(n_reader, 0);
28650 filename = gen_filepath(n_filename, 1);
28651 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028652 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028653
William M. Brackf13f77f2004-11-12 16:03:48 +000028654 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028655 desret_int(ret_val);
28656 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028657 des_xmlTextReaderPtr(n_reader, reader, 0);
28658 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028659 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028660 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028661 xmlResetLastError();
28662 if (mem_base != xmlMemBlocks()) {
28663 printf("Leak of %d blocks found in xmlReaderNewFile",
28664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028665 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028666 printf(" %d", n_reader);
28667 printf(" %d", n_filename);
28668 printf(" %d", n_encoding);
28669 printf(" %d", n_options);
28670 printf("\n");
28671 }
28672 }
28673 }
28674 }
28675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028676 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028677#endif
28678
Daniel Veillard42595322004-11-08 10:52:06 +000028679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028680}
28681
28682
28683static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028684test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028686
William M. Brack21e4ef22005-01-02 09:53:13 +000028687#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028688 int mem_base;
28689 int ret_val;
28690 xmlTextReaderPtr reader; /* an XML reader */
28691 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028692 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028693 int n_buffer;
28694 int size; /* the size of the array */
28695 int n_size;
28696 const char * URL; /* the base URL to use for the document */
28697 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028698 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028699 int n_encoding;
28700 int options; /* a combination of xmlParserOption */
28701 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028702
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028703 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28704 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28705 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28706 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28707 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028708 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028710 reader = gen_xmlTextReaderPtr(n_reader, 0);
28711 buffer = gen_const_char_ptr(n_buffer, 1);
28712 size = gen_int(n_size, 2);
28713 URL = gen_filepath(n_URL, 3);
28714 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028715 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028716
William M. Brackf13f77f2004-11-12 16:03:48 +000028717 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028718 desret_int(ret_val);
28719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028720 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028721 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028722 des_int(n_size, size, 2);
28723 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028724 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028725 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028726 xmlResetLastError();
28727 if (mem_base != xmlMemBlocks()) {
28728 printf("Leak of %d blocks found in xmlReaderNewMemory",
28729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028730 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028731 printf(" %d", n_reader);
28732 printf(" %d", n_buffer);
28733 printf(" %d", n_size);
28734 printf(" %d", n_URL);
28735 printf(" %d", n_encoding);
28736 printf(" %d", n_options);
28737 printf("\n");
28738 }
28739 }
28740 }
28741 }
28742 }
28743 }
28744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028745 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028746#endif
28747
Daniel Veillard42595322004-11-08 10:52:06 +000028748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028749}
28750
28751
28752static int
28753test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028755
William M. Brack21e4ef22005-01-02 09:53:13 +000028756#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028757 int mem_base;
28758 int ret_val;
28759 xmlTextReaderPtr reader; /* an XML reader */
28760 int n_reader;
28761 xmlDocPtr doc; /* a preparsed document */
28762 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028763
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028764 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28765 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28766 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028767 reader = gen_xmlTextReaderPtr(n_reader, 0);
28768 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028769
28770 ret_val = xmlReaderNewWalker(reader, doc);
28771 desret_int(ret_val);
28772 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028773 des_xmlTextReaderPtr(n_reader, reader, 0);
28774 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028775 xmlResetLastError();
28776 if (mem_base != xmlMemBlocks()) {
28777 printf("Leak of %d blocks found in xmlReaderNewWalker",
28778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028779 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028780 printf(" %d", n_reader);
28781 printf(" %d", n_doc);
28782 printf("\n");
28783 }
28784 }
28785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028786 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028787#endif
28788
Daniel Veillard42595322004-11-08 10:52:06 +000028789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028790}
28791
28792
28793static int
28794test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028796
William M. Brack21e4ef22005-01-02 09:53:13 +000028797#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028798 int mem_base;
28799 xmlTextReaderPtr ret_val;
28800 xmlDocPtr doc; /* a preparsed document */
28801 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028802
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028803 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28804 mem_base = xmlMemBlocks();
28805 doc = gen_xmlDocPtr(n_doc, 0);
28806
28807 ret_val = xmlReaderWalker(doc);
28808 desret_xmlTextReaderPtr(ret_val);
28809 call_tests++;
28810 des_xmlDocPtr(n_doc, doc, 0);
28811 xmlResetLastError();
28812 if (mem_base != xmlMemBlocks()) {
28813 printf("Leak of %d blocks found in xmlReaderWalker",
28814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028815 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028816 printf(" %d", n_doc);
28817 printf("\n");
28818 }
28819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028820 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028821#endif
28822
Daniel Veillard42595322004-11-08 10:52:06 +000028823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028824}
28825
28826
28827static int
28828test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028830
William M. Brack21e4ef22005-01-02 09:53:13 +000028831#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028832 int mem_base;
28833 int ret_val;
28834 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28835 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028836
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028837 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28838 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028839 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028840
28841 ret_val = xmlTextReaderAttributeCount(reader);
28842 desret_int(ret_val);
28843 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028844 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028845 xmlResetLastError();
28846 if (mem_base != xmlMemBlocks()) {
28847 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028849 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028850 printf(" %d", n_reader);
28851 printf("\n");
28852 }
28853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028854 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028855#endif
28856
Daniel Veillard42595322004-11-08 10:52:06 +000028857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028858}
28859
28860
28861static int
28862test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028864
William M. Brack21e4ef22005-01-02 09:53:13 +000028865#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028866 int mem_base;
28867 xmlChar * ret_val;
28868 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28869 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028870
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028871 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028873 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028874
28875 ret_val = xmlTextReaderBaseUri(reader);
28876 desret_xmlChar_ptr(ret_val);
28877 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028878 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028879 xmlResetLastError();
28880 if (mem_base != xmlMemBlocks()) {
28881 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028883 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028884 printf(" %d", n_reader);
28885 printf("\n");
28886 }
28887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028888 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028889#endif
28890
Daniel Veillard42595322004-11-08 10:52:06 +000028891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028892}
28893
28894
28895static int
28896test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028898
William M. Brack21e4ef22005-01-02 09:53:13 +000028899#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028900 int mem_base;
28901 int ret_val;
28902 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28903 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028904
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028905 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28906 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028907 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028908
28909 ret_val = xmlTextReaderClose(reader);
28910 desret_int(ret_val);
28911 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028912 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028913 xmlResetLastError();
28914 if (mem_base != xmlMemBlocks()) {
28915 printf("Leak of %d blocks found in xmlTextReaderClose",
28916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028917 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028918 printf(" %d", n_reader);
28919 printf("\n");
28920 }
28921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028922 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028923#endif
28924
Daniel Veillard42595322004-11-08 10:52:06 +000028925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028926}
28927
28928
28929static int
28930test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028932
William M. Brack21e4ef22005-01-02 09:53:13 +000028933#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028934 int mem_base;
28935 const xmlChar * ret_val;
28936 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28937 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028938
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028939 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28940 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028941 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028942
28943 ret_val = xmlTextReaderConstBaseUri(reader);
28944 desret_const_xmlChar_ptr(ret_val);
28945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028946 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028947 xmlResetLastError();
28948 if (mem_base != xmlMemBlocks()) {
28949 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028951 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028952 printf(" %d", n_reader);
28953 printf("\n");
28954 }
28955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028956 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028957#endif
28958
Daniel Veillard42595322004-11-08 10:52:06 +000028959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028960}
28961
28962
28963static int
28964test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028966
William M. Brack21e4ef22005-01-02 09:53:13 +000028967#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028968 int mem_base;
28969 const xmlChar * ret_val;
28970 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28971 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028972
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028973 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28974 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028975 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028976
28977 ret_val = xmlTextReaderConstEncoding(reader);
28978 desret_const_xmlChar_ptr(ret_val);
28979 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028980 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028981 xmlResetLastError();
28982 if (mem_base != xmlMemBlocks()) {
28983 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028985 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028986 printf(" %d", n_reader);
28987 printf("\n");
28988 }
28989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028990 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028991#endif
28992
Daniel Veillard42595322004-11-08 10:52:06 +000028993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028994}
28995
28996
28997static int
28998test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029000
William M. Brack21e4ef22005-01-02 09:53:13 +000029001#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029002 int mem_base;
29003 const xmlChar * ret_val;
29004 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29005 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029006
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029007 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29008 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029009 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029010
29011 ret_val = xmlTextReaderConstLocalName(reader);
29012 desret_const_xmlChar_ptr(ret_val);
29013 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029014 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029015 xmlResetLastError();
29016 if (mem_base != xmlMemBlocks()) {
29017 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029019 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029020 printf(" %d", n_reader);
29021 printf("\n");
29022 }
29023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029024 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029025#endif
29026
Daniel Veillard42595322004-11-08 10:52:06 +000029027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029028}
29029
29030
29031static int
29032test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029034
William M. Brack21e4ef22005-01-02 09:53:13 +000029035#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029036 int mem_base;
29037 const xmlChar * ret_val;
29038 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29039 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029040
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029041 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29042 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029043 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029044
29045 ret_val = xmlTextReaderConstName(reader);
29046 desret_const_xmlChar_ptr(ret_val);
29047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029048 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029049 xmlResetLastError();
29050 if (mem_base != xmlMemBlocks()) {
29051 printf("Leak of %d blocks found in xmlTextReaderConstName",
29052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029053 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029054 printf(" %d", n_reader);
29055 printf("\n");
29056 }
29057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029058 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029059#endif
29060
Daniel Veillard42595322004-11-08 10:52:06 +000029061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029062}
29063
29064
29065static int
29066test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029068
William M. Brack21e4ef22005-01-02 09:53:13 +000029069#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029070 int mem_base;
29071 const xmlChar * ret_val;
29072 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29073 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029074
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029075 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029077 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029078
29079 ret_val = xmlTextReaderConstNamespaceUri(reader);
29080 desret_const_xmlChar_ptr(ret_val);
29081 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029082 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029083 xmlResetLastError();
29084 if (mem_base != xmlMemBlocks()) {
29085 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029087 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029088 printf(" %d", n_reader);
29089 printf("\n");
29090 }
29091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029092 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029093#endif
29094
Daniel Veillard42595322004-11-08 10:52:06 +000029095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029096}
29097
29098
29099static int
29100test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029102
William M. Brack21e4ef22005-01-02 09:53:13 +000029103#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029104 int mem_base;
29105 const xmlChar * ret_val;
29106 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29107 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029108
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029109 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29110 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029111 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029112
29113 ret_val = xmlTextReaderConstPrefix(reader);
29114 desret_const_xmlChar_ptr(ret_val);
29115 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029116 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029117 xmlResetLastError();
29118 if (mem_base != xmlMemBlocks()) {
29119 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029121 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029122 printf(" %d", n_reader);
29123 printf("\n");
29124 }
29125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029126 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029127#endif
29128
Daniel Veillard42595322004-11-08 10:52:06 +000029129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029130}
29131
29132
29133static int
29134test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029136
William M. Brack21e4ef22005-01-02 09:53:13 +000029137#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029138 int mem_base;
29139 const xmlChar * ret_val;
29140 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29141 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029142 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029143 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029144
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029145 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29146 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29147 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029148 reader = gen_xmlTextReaderPtr(n_reader, 0);
29149 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029150
William M. Brackf13f77f2004-11-12 16:03:48 +000029151 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029152 desret_const_xmlChar_ptr(ret_val);
29153 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029154 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029155 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029156 xmlResetLastError();
29157 if (mem_base != xmlMemBlocks()) {
29158 printf("Leak of %d blocks found in xmlTextReaderConstString",
29159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029160 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029161 printf(" %d", n_reader);
29162 printf(" %d", n_str);
29163 printf("\n");
29164 }
29165 }
29166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029167 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029168#endif
29169
Daniel Veillard42595322004-11-08 10:52:06 +000029170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029171}
29172
29173
29174static int
29175test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029177
William M. Brack21e4ef22005-01-02 09:53:13 +000029178#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029179 int mem_base;
29180 const xmlChar * ret_val;
29181 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29182 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029183
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029184 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29185 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029186 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029187
29188 ret_val = xmlTextReaderConstValue(reader);
29189 desret_const_xmlChar_ptr(ret_val);
29190 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029191 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029192 xmlResetLastError();
29193 if (mem_base != xmlMemBlocks()) {
29194 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029196 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029197 printf(" %d", n_reader);
29198 printf("\n");
29199 }
29200 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029201 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029202#endif
29203
Daniel Veillard42595322004-11-08 10:52:06 +000029204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029205}
29206
29207
29208static int
29209test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029211
William M. Brack21e4ef22005-01-02 09:53:13 +000029212#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029213 int mem_base;
29214 const xmlChar * ret_val;
29215 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29216 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029217
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029218 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29219 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029220 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029221
29222 ret_val = xmlTextReaderConstXmlLang(reader);
29223 desret_const_xmlChar_ptr(ret_val);
29224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029225 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029226 xmlResetLastError();
29227 if (mem_base != xmlMemBlocks()) {
29228 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029230 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029231 printf(" %d", n_reader);
29232 printf("\n");
29233 }
29234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029235 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029236#endif
29237
Daniel Veillard42595322004-11-08 10:52:06 +000029238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029239}
29240
29241
29242static int
29243test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029245
William M. Brack21e4ef22005-01-02 09:53:13 +000029246#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029247 int mem_base;
29248 const xmlChar * ret_val;
29249 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29250 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029251
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029252 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29253 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029254 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029255
29256 ret_val = xmlTextReaderConstXmlVersion(reader);
29257 desret_const_xmlChar_ptr(ret_val);
29258 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029259 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029260 xmlResetLastError();
29261 if (mem_base != xmlMemBlocks()) {
29262 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029264 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029265 printf(" %d", n_reader);
29266 printf("\n");
29267 }
29268 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029269 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029270#endif
29271
Daniel Veillard42595322004-11-08 10:52:06 +000029272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029273}
29274
29275
29276static int
29277test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029279
William M. Brack21e4ef22005-01-02 09:53:13 +000029280#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029281 int mem_base;
29282 xmlDocPtr ret_val;
29283 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29284 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029285
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029286 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29287 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029288 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029289
29290 ret_val = xmlTextReaderCurrentDoc(reader);
29291 desret_xmlDocPtr(ret_val);
29292 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029293 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029294 xmlResetLastError();
29295 if (mem_base != xmlMemBlocks()) {
29296 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029298 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029299 printf(" %d", n_reader);
29300 printf("\n");
29301 }
29302 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029303 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029304#endif
29305
Daniel Veillard42595322004-11-08 10:52:06 +000029306 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029307}
29308
29309
29310static int
29311test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029313
William M. Brack21e4ef22005-01-02 09:53:13 +000029314#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029315 int mem_base;
29316 xmlNodePtr ret_val;
29317 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29318 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029319
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029320 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29321 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029322 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029323
29324 ret_val = xmlTextReaderCurrentNode(reader);
29325 desret_xmlNodePtr(ret_val);
29326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029327 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029328 xmlResetLastError();
29329 if (mem_base != xmlMemBlocks()) {
29330 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029332 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029333 printf(" %d", n_reader);
29334 printf("\n");
29335 }
29336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029337 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029338#endif
29339
Daniel Veillard42595322004-11-08 10:52:06 +000029340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029341}
29342
29343
29344static int
29345test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029347
William M. Brack21e4ef22005-01-02 09:53:13 +000029348#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029349 int mem_base;
29350 int ret_val;
29351 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29352 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029353
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029354 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29355 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029356 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029357
29358 ret_val = xmlTextReaderDepth(reader);
29359 desret_int(ret_val);
29360 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029361 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029362 xmlResetLastError();
29363 if (mem_base != xmlMemBlocks()) {
29364 printf("Leak of %d blocks found in xmlTextReaderDepth",
29365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029366 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029367 printf(" %d", n_reader);
29368 printf("\n");
29369 }
29370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029371 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029372#endif
29373
Daniel Veillard42595322004-11-08 10:52:06 +000029374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029375}
29376
29377
29378static int
29379test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029381
William M. Brack21e4ef22005-01-02 09:53:13 +000029382#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029383 int mem_base;
29384 xmlNodePtr ret_val;
29385 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29386 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029387
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029388 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29389 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029390 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029391
29392 ret_val = xmlTextReaderExpand(reader);
29393 desret_xmlNodePtr(ret_val);
29394 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029395 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029396 xmlResetLastError();
29397 if (mem_base != xmlMemBlocks()) {
29398 printf("Leak of %d blocks found in xmlTextReaderExpand",
29399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029400 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029401 printf(" %d", n_reader);
29402 printf("\n");
29403 }
29404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029405 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029406#endif
29407
Daniel Veillard42595322004-11-08 10:52:06 +000029408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029409}
29410
29411
29412static int
29413test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029415
William M. Brack21e4ef22005-01-02 09:53:13 +000029416#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029417 int mem_base;
29418 xmlChar * ret_val;
29419 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29420 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029421 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029422 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029423
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029424 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29425 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29426 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029427 reader = gen_xmlTextReaderPtr(n_reader, 0);
29428 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029429
William M. Brackf13f77f2004-11-12 16:03:48 +000029430 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029431 desret_xmlChar_ptr(ret_val);
29432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029433 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029434 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029435 xmlResetLastError();
29436 if (mem_base != xmlMemBlocks()) {
29437 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029439 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029440 printf(" %d", n_reader);
29441 printf(" %d", n_name);
29442 printf("\n");
29443 }
29444 }
29445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029446 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029447#endif
29448
Daniel Veillard42595322004-11-08 10:52:06 +000029449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029450}
29451
29452
29453static int
29454test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029456
William M. Brack21e4ef22005-01-02 09:53:13 +000029457#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029458 int mem_base;
29459 xmlChar * ret_val;
29460 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29461 int n_reader;
29462 int no; /* the zero-based index of the attribute relative to the containing element */
29463 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029464
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029465 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29466 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029468 reader = gen_xmlTextReaderPtr(n_reader, 0);
29469 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029470
29471 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29472 desret_xmlChar_ptr(ret_val);
29473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029474 des_xmlTextReaderPtr(n_reader, reader, 0);
29475 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029476 xmlResetLastError();
29477 if (mem_base != xmlMemBlocks()) {
29478 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029480 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029481 printf(" %d", n_reader);
29482 printf(" %d", n_no);
29483 printf("\n");
29484 }
29485 }
29486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029487 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029488#endif
29489
Daniel Veillard42595322004-11-08 10:52:06 +000029490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029491}
29492
29493
29494static int
29495test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029497
William M. Brack21e4ef22005-01-02 09:53:13 +000029498#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029499 int mem_base;
29500 xmlChar * ret_val;
29501 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29502 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029503 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029504 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029505 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029506 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029507
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029508 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29509 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29510 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029512 reader = gen_xmlTextReaderPtr(n_reader, 0);
29513 localName = gen_const_xmlChar_ptr(n_localName, 1);
29514 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029515
William M. Brackf13f77f2004-11-12 16:03:48 +000029516 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029517 desret_xmlChar_ptr(ret_val);
29518 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029519 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029520 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29521 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029522 xmlResetLastError();
29523 if (mem_base != xmlMemBlocks()) {
29524 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029526 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029527 printf(" %d", n_reader);
29528 printf(" %d", n_localName);
29529 printf(" %d", n_namespaceURI);
29530 printf("\n");
29531 }
29532 }
29533 }
29534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029535 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029536#endif
29537
Daniel Veillard42595322004-11-08 10:52:06 +000029538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029539}
29540
Daniel Veillarda521d282004-11-09 14:59:59 +000029541#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029542
Daniel Veillardce682bc2004-11-05 17:22:25 +000029543#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29544static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29545 return(NULL);
29546}
29547static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29548}
Daniel Veillarda521d282004-11-09 14:59:59 +000029549#endif
29550
Daniel Veillardce682bc2004-11-05 17:22:25 +000029551
Daniel Veillardd93f6252004-11-02 15:53:51 +000029552static int
29553test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029555
William M. Brack21e4ef22005-01-02 09:53:13 +000029556#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029557 int mem_base;
29558 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29559 int n_reader;
29560 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29561 int n_f;
29562 void ** arg; /* a user argument */
29563 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029564
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029565 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29566 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29567 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29568 mem_base = xmlMemBlocks();
29569 reader = gen_xmlTextReaderPtr(n_reader, 0);
29570 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29571 arg = gen_void_ptr_ptr(n_arg, 2);
29572
29573 xmlTextReaderGetErrorHandler(reader, f, arg);
29574 call_tests++;
29575 des_xmlTextReaderPtr(n_reader, reader, 0);
29576 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29577 des_void_ptr_ptr(n_arg, arg, 2);
29578 xmlResetLastError();
29579 if (mem_base != xmlMemBlocks()) {
29580 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029582 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029583 printf(" %d", n_reader);
29584 printf(" %d", n_f);
29585 printf(" %d", n_arg);
29586 printf("\n");
29587 }
29588 }
29589 }
29590 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029591 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029592#endif
29593
Daniel Veillard42595322004-11-08 10:52:06 +000029594 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029595}
29596
29597
29598static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029599test_xmlTextReaderGetParserColumnNumber(void) {
29600 int test_ret = 0;
29601
29602#if defined(LIBXML_READER_ENABLED)
29603 int mem_base;
29604 int ret_val;
29605 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29606 int n_reader;
29607
29608 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29609 mem_base = xmlMemBlocks();
29610 reader = gen_xmlTextReaderPtr(n_reader, 0);
29611
29612 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29613 desret_int(ret_val);
29614 call_tests++;
29615 des_xmlTextReaderPtr(n_reader, reader, 0);
29616 xmlResetLastError();
29617 if (mem_base != xmlMemBlocks()) {
29618 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29619 xmlMemBlocks() - mem_base);
29620 test_ret++;
29621 printf(" %d", n_reader);
29622 printf("\n");
29623 }
29624 }
29625 function_tests++;
29626#endif
29627
29628 return(test_ret);
29629}
29630
29631
29632static int
29633test_xmlTextReaderGetParserLineNumber(void) {
29634 int test_ret = 0;
29635
29636#if defined(LIBXML_READER_ENABLED)
29637 int mem_base;
29638 int ret_val;
29639 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29640 int n_reader;
29641
29642 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29643 mem_base = xmlMemBlocks();
29644 reader = gen_xmlTextReaderPtr(n_reader, 0);
29645
29646 ret_val = xmlTextReaderGetParserLineNumber(reader);
29647 desret_int(ret_val);
29648 call_tests++;
29649 des_xmlTextReaderPtr(n_reader, reader, 0);
29650 xmlResetLastError();
29651 if (mem_base != xmlMemBlocks()) {
29652 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29653 xmlMemBlocks() - mem_base);
29654 test_ret++;
29655 printf(" %d", n_reader);
29656 printf("\n");
29657 }
29658 }
29659 function_tests++;
29660#endif
29661
29662 return(test_ret);
29663}
29664
29665
29666static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029667test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029669
William M. Brack21e4ef22005-01-02 09:53:13 +000029670#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029671 int mem_base;
29672 int ret_val;
29673 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29674 int n_reader;
29675 int prop; /* the xmlParserProperties to get */
29676 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029677
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029678 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29679 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29680 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029681 reader = gen_xmlTextReaderPtr(n_reader, 0);
29682 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029683
29684 ret_val = xmlTextReaderGetParserProp(reader, prop);
29685 desret_int(ret_val);
29686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029687 des_xmlTextReaderPtr(n_reader, reader, 0);
29688 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029689 xmlResetLastError();
29690 if (mem_base != xmlMemBlocks()) {
29691 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029693 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029694 printf(" %d", n_reader);
29695 printf(" %d", n_prop);
29696 printf("\n");
29697 }
29698 }
29699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029700 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029701#endif
29702
Daniel Veillard42595322004-11-08 10:52:06 +000029703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029704}
29705
29706
29707static int
29708test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029710
William M. Brack21e4ef22005-01-02 09:53:13 +000029711#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029712 int mem_base;
29713 xmlParserInputBufferPtr ret_val;
29714 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29715 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029716
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029717 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29718 mem_base = xmlMemBlocks();
29719 reader = gen_xmlTextReaderPtr(n_reader, 0);
29720
29721 ret_val = xmlTextReaderGetRemainder(reader);
29722 desret_xmlParserInputBufferPtr(ret_val);
29723 call_tests++;
29724 des_xmlTextReaderPtr(n_reader, reader, 0);
29725 xmlResetLastError();
29726 if (mem_base != xmlMemBlocks()) {
29727 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029729 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029730 printf(" %d", n_reader);
29731 printf("\n");
29732 }
29733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029734 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029735#endif
29736
Daniel Veillard42595322004-11-08 10:52:06 +000029737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029738}
29739
29740
29741static int
29742test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029744
William M. Brack21e4ef22005-01-02 09:53:13 +000029745#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029746 int mem_base;
29747 int ret_val;
29748 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29749 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029750
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029751 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029753 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029754
29755 ret_val = xmlTextReaderHasAttributes(reader);
29756 desret_int(ret_val);
29757 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029758 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029759 xmlResetLastError();
29760 if (mem_base != xmlMemBlocks()) {
29761 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029763 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029764 printf(" %d", n_reader);
29765 printf("\n");
29766 }
29767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029768 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029769#endif
29770
Daniel Veillard42595322004-11-08 10:52:06 +000029771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029772}
29773
29774
29775static int
29776test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029778
William M. Brack21e4ef22005-01-02 09:53:13 +000029779#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029780 int mem_base;
29781 int ret_val;
29782 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29783 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029784
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029785 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029787 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029788
29789 ret_val = xmlTextReaderHasValue(reader);
29790 desret_int(ret_val);
29791 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029792 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029793 xmlResetLastError();
29794 if (mem_base != xmlMemBlocks()) {
29795 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029797 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029798 printf(" %d", n_reader);
29799 printf("\n");
29800 }
29801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029802 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029803#endif
29804
Daniel Veillard42595322004-11-08 10:52:06 +000029805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029806}
29807
29808
29809static int
29810test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029812
William M. Brack21e4ef22005-01-02 09:53:13 +000029813#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029814 int mem_base;
29815 int ret_val;
29816 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29817 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029818
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029819 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29820 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029821 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029822
29823 ret_val = xmlTextReaderIsDefault(reader);
29824 desret_int(ret_val);
29825 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029826 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029827 xmlResetLastError();
29828 if (mem_base != xmlMemBlocks()) {
29829 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029831 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029832 printf(" %d", n_reader);
29833 printf("\n");
29834 }
29835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029836 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029837#endif
29838
Daniel Veillard42595322004-11-08 10:52:06 +000029839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029840}
29841
29842
29843static int
29844test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029846
William M. Brack21e4ef22005-01-02 09:53:13 +000029847#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029848 int mem_base;
29849 int ret_val;
29850 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29851 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029852
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029853 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29854 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029855 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029856
29857 ret_val = xmlTextReaderIsEmptyElement(reader);
29858 desret_int(ret_val);
29859 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029860 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029861 xmlResetLastError();
29862 if (mem_base != xmlMemBlocks()) {
29863 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029865 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029866 printf(" %d", n_reader);
29867 printf("\n");
29868 }
29869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029870 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029871#endif
29872
Daniel Veillard42595322004-11-08 10:52:06 +000029873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029874}
29875
29876
29877static int
29878test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029880
William M. Brack21e4ef22005-01-02 09:53:13 +000029881#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029882 int mem_base;
29883 int ret_val;
29884 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29885 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029886
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029887 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29888 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029889 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029890
29891 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29892 desret_int(ret_val);
29893 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029894 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029895 xmlResetLastError();
29896 if (mem_base != xmlMemBlocks()) {
29897 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029899 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029900 printf(" %d", n_reader);
29901 printf("\n");
29902 }
29903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029904 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029905#endif
29906
Daniel Veillard42595322004-11-08 10:52:06 +000029907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029908}
29909
29910
29911static int
29912test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029914
William M. Brack21e4ef22005-01-02 09:53:13 +000029915#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029916 int mem_base;
29917 int ret_val;
29918 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29919 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029920
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029921 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29922 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029923 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029924
29925 ret_val = xmlTextReaderIsValid(reader);
29926 desret_int(ret_val);
29927 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029928 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029929 xmlResetLastError();
29930 if (mem_base != xmlMemBlocks()) {
29931 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029933 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029934 printf(" %d", n_reader);
29935 printf("\n");
29936 }
29937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029938 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939#endif
29940
Daniel Veillard42595322004-11-08 10:52:06 +000029941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029942}
29943
29944
29945static int
29946test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029948
William M. Brack21e4ef22005-01-02 09:53:13 +000029949#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029950 int mem_base;
29951 xmlChar * ret_val;
29952 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29953 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029954
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029955 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029957 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029958
29959 ret_val = xmlTextReaderLocalName(reader);
29960 desret_xmlChar_ptr(ret_val);
29961 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029962 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029963 xmlResetLastError();
29964 if (mem_base != xmlMemBlocks()) {
29965 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029967 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029968 printf(" %d", n_reader);
29969 printf("\n");
29970 }
29971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029972 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029973#endif
29974
Daniel Veillard42595322004-11-08 10:52:06 +000029975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029976}
29977
Daniel Veillarda521d282004-11-09 14:59:59 +000029978#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029979
Daniel Veillardce682bc2004-11-05 17:22:25 +000029980#define gen_nb_xmlTextReaderLocatorPtr 1
29981static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29982 return(NULL);
29983}
29984static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29985}
Daniel Veillarda521d282004-11-09 14:59:59 +000029986#endif
29987
Daniel Veillardce682bc2004-11-05 17:22:25 +000029988
Daniel Veillardd93f6252004-11-02 15:53:51 +000029989static int
29990test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029992
William M. Brack21e4ef22005-01-02 09:53:13 +000029993#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000029994 int mem_base;
29995 xmlChar * ret_val;
29996 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29997 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029998
Daniel Veillardce682bc2004-11-05 17:22:25 +000029999 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30000 mem_base = xmlMemBlocks();
30001 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30002
30003 ret_val = xmlTextReaderLocatorBaseURI(locator);
30004 desret_xmlChar_ptr(ret_val);
30005 call_tests++;
30006 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30007 xmlResetLastError();
30008 if (mem_base != xmlMemBlocks()) {
30009 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030011 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030012 printf(" %d", n_locator);
30013 printf("\n");
30014 }
30015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030016 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030017#endif
30018
Daniel Veillard42595322004-11-08 10:52:06 +000030019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030020}
30021
30022
30023static int
30024test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030026
William M. Brack21e4ef22005-01-02 09:53:13 +000030027#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030028 int mem_base;
30029 int ret_val;
30030 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30031 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030032
Daniel Veillardce682bc2004-11-05 17:22:25 +000030033 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30034 mem_base = xmlMemBlocks();
30035 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30036
30037 ret_val = xmlTextReaderLocatorLineNumber(locator);
30038 desret_int(ret_val);
30039 call_tests++;
30040 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30041 xmlResetLastError();
30042 if (mem_base != xmlMemBlocks()) {
30043 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030045 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030046 printf(" %d", n_locator);
30047 printf("\n");
30048 }
30049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030050 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030051#endif
30052
Daniel Veillard42595322004-11-08 10:52:06 +000030053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030054}
30055
30056
30057static int
30058test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030060
William M. Brack21e4ef22005-01-02 09:53:13 +000030061#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030062 int mem_base;
30063 xmlChar * ret_val;
30064 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30065 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030066 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 +000030067 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030068
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030069 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30070 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30071 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030072 reader = gen_xmlTextReaderPtr(n_reader, 0);
30073 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030074
William M. Brackf13f77f2004-11-12 16:03:48 +000030075 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030076 desret_xmlChar_ptr(ret_val);
30077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030078 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030079 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080 xmlResetLastError();
30081 if (mem_base != xmlMemBlocks()) {
30082 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030084 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030085 printf(" %d", n_reader);
30086 printf(" %d", n_prefix);
30087 printf("\n");
30088 }
30089 }
30090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030091 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030092#endif
30093
Daniel Veillard42595322004-11-08 10:52:06 +000030094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030095}
30096
30097
30098static int
30099test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030101
William M. Brack21e4ef22005-01-02 09:53:13 +000030102#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030103 int mem_base;
30104 int ret_val;
30105 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30106 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030107 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030108 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030109
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030110 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30111 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030113 reader = gen_xmlTextReaderPtr(n_reader, 0);
30114 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030115
William M. Brackf13f77f2004-11-12 16:03:48 +000030116 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030117 desret_int(ret_val);
30118 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030119 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030120 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030121 xmlResetLastError();
30122 if (mem_base != xmlMemBlocks()) {
30123 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030125 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030126 printf(" %d", n_reader);
30127 printf(" %d", n_name);
30128 printf("\n");
30129 }
30130 }
30131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030132 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030133#endif
30134
Daniel Veillard42595322004-11-08 10:52:06 +000030135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030136}
30137
30138
30139static int
30140test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030142
William M. Brack21e4ef22005-01-02 09:53:13 +000030143#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030144 int mem_base;
30145 int ret_val;
30146 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30147 int n_reader;
30148 int no; /* the zero-based index of the attribute relative to the containing element. */
30149 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030150
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030151 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30152 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030154 reader = gen_xmlTextReaderPtr(n_reader, 0);
30155 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030156
30157 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30158 desret_int(ret_val);
30159 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030160 des_xmlTextReaderPtr(n_reader, reader, 0);
30161 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030162 xmlResetLastError();
30163 if (mem_base != xmlMemBlocks()) {
30164 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030166 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030167 printf(" %d", n_reader);
30168 printf(" %d", n_no);
30169 printf("\n");
30170 }
30171 }
30172 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030173 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174#endif
30175
Daniel Veillard42595322004-11-08 10:52:06 +000030176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030177}
30178
30179
30180static int
30181test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030183
William M. Brack21e4ef22005-01-02 09:53:13 +000030184#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030185 int mem_base;
30186 int ret_val;
30187 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30188 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030189 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030190 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030191 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030192 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030193
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030194 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30195 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30196 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030198 reader = gen_xmlTextReaderPtr(n_reader, 0);
30199 localName = gen_const_xmlChar_ptr(n_localName, 1);
30200 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030201
William M. Brackf13f77f2004-11-12 16:03:48 +000030202 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030203 desret_int(ret_val);
30204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030205 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030206 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30207 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030208 xmlResetLastError();
30209 if (mem_base != xmlMemBlocks()) {
30210 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030212 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030213 printf(" %d", n_reader);
30214 printf(" %d", n_localName);
30215 printf(" %d", n_namespaceURI);
30216 printf("\n");
30217 }
30218 }
30219 }
30220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030221 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030222#endif
30223
Daniel Veillard42595322004-11-08 10:52:06 +000030224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030225}
30226
30227
30228static int
30229test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030231
William M. Brack21e4ef22005-01-02 09:53:13 +000030232#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030233 int mem_base;
30234 int ret_val;
30235 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30236 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030237
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030238 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30239 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030240 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030241
30242 ret_val = xmlTextReaderMoveToElement(reader);
30243 desret_int(ret_val);
30244 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030245 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030246 xmlResetLastError();
30247 if (mem_base != xmlMemBlocks()) {
30248 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030250 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030251 printf(" %d", n_reader);
30252 printf("\n");
30253 }
30254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030255 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030256#endif
30257
Daniel Veillard42595322004-11-08 10:52:06 +000030258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030259}
30260
30261
30262static int
30263test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030265
William M. Brack21e4ef22005-01-02 09:53:13 +000030266#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030267 int mem_base;
30268 int ret_val;
30269 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30270 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030271
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030272 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30273 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030274 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030275
30276 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30277 desret_int(ret_val);
30278 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030279 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030280 xmlResetLastError();
30281 if (mem_base != xmlMemBlocks()) {
30282 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030284 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030285 printf(" %d", n_reader);
30286 printf("\n");
30287 }
30288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030289 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030290#endif
30291
Daniel Veillard42595322004-11-08 10:52:06 +000030292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030293}
30294
30295
30296static int
30297test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030299
William M. Brack21e4ef22005-01-02 09:53:13 +000030300#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030301 int mem_base;
30302 int ret_val;
30303 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30304 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030305
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030306 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030308 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030309
30310 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30311 desret_int(ret_val);
30312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030313 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030314 xmlResetLastError();
30315 if (mem_base != xmlMemBlocks()) {
30316 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030318 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030319 printf(" %d", n_reader);
30320 printf("\n");
30321 }
30322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030323 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030324#endif
30325
Daniel Veillard42595322004-11-08 10:52:06 +000030326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030327}
30328
30329
30330static int
30331test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030333
William M. Brack21e4ef22005-01-02 09:53:13 +000030334#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030335 int mem_base;
30336 xmlChar * ret_val;
30337 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30338 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030339
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030340 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30341 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030342 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030343
30344 ret_val = xmlTextReaderName(reader);
30345 desret_xmlChar_ptr(ret_val);
30346 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030347 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030348 xmlResetLastError();
30349 if (mem_base != xmlMemBlocks()) {
30350 printf("Leak of %d blocks found in xmlTextReaderName",
30351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030352 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030353 printf(" %d", n_reader);
30354 printf("\n");
30355 }
30356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030357 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030358#endif
30359
Daniel Veillard42595322004-11-08 10:52:06 +000030360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030361}
30362
30363
30364static int
30365test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030367
William M. Brack21e4ef22005-01-02 09:53:13 +000030368#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030369 int mem_base;
30370 xmlChar * ret_val;
30371 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30372 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030373
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030374 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30375 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030376 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030377
30378 ret_val = xmlTextReaderNamespaceUri(reader);
30379 desret_xmlChar_ptr(ret_val);
30380 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030381 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030382 xmlResetLastError();
30383 if (mem_base != xmlMemBlocks()) {
30384 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030386 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030387 printf(" %d", n_reader);
30388 printf("\n");
30389 }
30390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030391 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030392#endif
30393
Daniel Veillard42595322004-11-08 10:52:06 +000030394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030395}
30396
30397
30398static int
30399test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030401
William M. Brack21e4ef22005-01-02 09:53:13 +000030402#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030403 int mem_base;
30404 int ret_val;
30405 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30406 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030407
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030408 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030410 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030411
30412 ret_val = xmlTextReaderNext(reader);
30413 desret_int(ret_val);
30414 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030415 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030416 xmlResetLastError();
30417 if (mem_base != xmlMemBlocks()) {
30418 printf("Leak of %d blocks found in xmlTextReaderNext",
30419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030420 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030421 printf(" %d", n_reader);
30422 printf("\n");
30423 }
30424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030425 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030426#endif
30427
Daniel Veillard42595322004-11-08 10:52:06 +000030428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030429}
30430
30431
30432static int
30433test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030435
William M. Brack21e4ef22005-01-02 09:53:13 +000030436#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030437 int mem_base;
30438 int ret_val;
30439 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30440 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030441
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030442 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30443 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030444 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030445
30446 ret_val = xmlTextReaderNextSibling(reader);
30447 desret_int(ret_val);
30448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030449 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030450 xmlResetLastError();
30451 if (mem_base != xmlMemBlocks()) {
30452 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030454 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030455 printf(" %d", n_reader);
30456 printf("\n");
30457 }
30458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030459 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030460#endif
30461
Daniel Veillard42595322004-11-08 10:52:06 +000030462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030463}
30464
30465
30466static int
30467test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030469
William M. Brack21e4ef22005-01-02 09:53:13 +000030470#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030471 int mem_base;
30472 int ret_val;
30473 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30474 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030475
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030476 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030478 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030479
30480 ret_val = xmlTextReaderNodeType(reader);
30481 desret_int(ret_val);
30482 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030483 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030484 xmlResetLastError();
30485 if (mem_base != xmlMemBlocks()) {
30486 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030488 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030489 printf(" %d", n_reader);
30490 printf("\n");
30491 }
30492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030493 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030494#endif
30495
Daniel Veillard42595322004-11-08 10:52:06 +000030496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030497}
30498
30499
30500static int
30501test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030503
William M. Brack21e4ef22005-01-02 09:53:13 +000030504#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030505 int mem_base;
30506 int ret_val;
30507 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30508 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030509
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030510 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030512 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030513
30514 ret_val = xmlTextReaderNormalization(reader);
30515 desret_int(ret_val);
30516 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030517 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030518 xmlResetLastError();
30519 if (mem_base != xmlMemBlocks()) {
30520 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030522 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030523 printf(" %d", n_reader);
30524 printf("\n");
30525 }
30526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030527 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030528#endif
30529
Daniel Veillard42595322004-11-08 10:52:06 +000030530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030531}
30532
30533
30534static int
30535test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030537
William M. Brack21e4ef22005-01-02 09:53:13 +000030538#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030539 int mem_base;
30540 xmlChar * ret_val;
30541 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30542 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030543
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030544 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030546 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030547
30548 ret_val = xmlTextReaderPrefix(reader);
30549 desret_xmlChar_ptr(ret_val);
30550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030551 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030552 xmlResetLastError();
30553 if (mem_base != xmlMemBlocks()) {
30554 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030556 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030557 printf(" %d", n_reader);
30558 printf("\n");
30559 }
30560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030561 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030562#endif
30563
Daniel Veillard42595322004-11-08 10:52:06 +000030564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030565}
30566
30567
30568static int
30569test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030571
William M. Brack21e4ef22005-01-02 09:53:13 +000030572#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030573 int mem_base;
30574 xmlNodePtr ret_val;
30575 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30576 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030577
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030578 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30579 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030580 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030581
30582 ret_val = xmlTextReaderPreserve(reader);
30583 desret_xmlNodePtr(ret_val);
30584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030585 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030586 xmlResetLastError();
30587 if (mem_base != xmlMemBlocks()) {
30588 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030590 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030591 printf(" %d", n_reader);
30592 printf("\n");
30593 }
30594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030595 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030596#endif
30597
Daniel Veillard42595322004-11-08 10:52:06 +000030598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030599}
30600
30601
30602static int
30603test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030605
William M. Brack21e4ef22005-01-02 09:53:13 +000030606#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030607#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030608 int mem_base;
30609 int ret_val;
30610 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30611 int n_reader;
30612 xmlChar * pattern; /* an XPath subset pattern */
30613 int n_pattern;
30614 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30615 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030616
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030617 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30618 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30619 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30620 mem_base = xmlMemBlocks();
30621 reader = gen_xmlTextReaderPtr(n_reader, 0);
30622 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30623 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30624
William M. Brackf13f77f2004-11-12 16:03:48 +000030625 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030626 desret_int(ret_val);
30627 call_tests++;
30628 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030629 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30630 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030631 xmlResetLastError();
30632 if (mem_base != xmlMemBlocks()) {
30633 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030635 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030636 printf(" %d", n_reader);
30637 printf(" %d", n_pattern);
30638 printf(" %d", n_namespaces);
30639 printf("\n");
30640 }
30641 }
30642 }
30643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030644 function_tests++;
30645#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030646#endif
30647
Daniel Veillard42595322004-11-08 10:52:06 +000030648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030649}
30650
30651
30652static int
30653test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030655
William M. Brack21e4ef22005-01-02 09:53:13 +000030656#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030657 int mem_base;
30658 int ret_val;
30659 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30660 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030661
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030662 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30663 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030664 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030665
30666 ret_val = xmlTextReaderQuoteChar(reader);
30667 desret_int(ret_val);
30668 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030669 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030670 xmlResetLastError();
30671 if (mem_base != xmlMemBlocks()) {
30672 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030674 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030675 printf(" %d", n_reader);
30676 printf("\n");
30677 }
30678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030679 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030680#endif
30681
Daniel Veillard42595322004-11-08 10:52:06 +000030682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030683}
30684
30685
30686static int
30687test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030689
William M. Brack21e4ef22005-01-02 09:53:13 +000030690#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030691 int mem_base;
30692 int ret_val;
30693 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30694 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030695
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030696 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30697 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030698 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030699
30700 ret_val = xmlTextReaderRead(reader);
30701 desret_int(ret_val);
30702 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030703 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030704 xmlResetLastError();
30705 if (mem_base != xmlMemBlocks()) {
30706 printf("Leak of %d blocks found in xmlTextReaderRead",
30707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030708 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030709 printf(" %d", n_reader);
30710 printf("\n");
30711 }
30712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030713 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030714#endif
30715
Daniel Veillard42595322004-11-08 10:52:06 +000030716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030717}
30718
30719
30720static int
30721test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030723
William M. Brack21e4ef22005-01-02 09:53:13 +000030724#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030725 int mem_base;
30726 int ret_val;
30727 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30728 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030729
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030730 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030732 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030733
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030734 ret_val = xmlTextReaderReadAttributeValue(reader);
30735 desret_int(ret_val);
30736 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030737 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030738 xmlResetLastError();
30739 if (mem_base != xmlMemBlocks()) {
30740 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030742 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030743 printf(" %d", n_reader);
30744 printf("\n");
30745 }
30746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030747 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030748#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030749
Daniel Veillard42595322004-11-08 10:52:06 +000030750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030751}
30752
30753
30754static int
30755test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030757
William M. Brack21e4ef22005-01-02 09:53:13 +000030758#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030759 int mem_base;
30760 int ret_val;
30761 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30762 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030763
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030764 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030766 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030767
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030768 ret_val = xmlTextReaderReadState(reader);
30769 desret_int(ret_val);
30770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030771 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030772 xmlResetLastError();
30773 if (mem_base != xmlMemBlocks()) {
30774 printf("Leak of %d blocks found in xmlTextReaderReadState",
30775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030776 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030777 printf(" %d", n_reader);
30778 printf("\n");
30779 }
30780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030781 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030782#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030783
Daniel Veillard42595322004-11-08 10:52:06 +000030784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030785}
30786
30787
30788static int
30789test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030791
William M. Brack21e4ef22005-01-02 09:53:13 +000030792#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030793 int mem_base;
30794 int ret_val;
30795 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30796 int n_reader;
30797 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30798 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030799
Daniel Veillardce682bc2004-11-05 17:22:25 +000030800 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30801 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30802 mem_base = xmlMemBlocks();
30803 reader = gen_xmlTextReaderPtr(n_reader, 0);
30804 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30805
30806 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30807 desret_int(ret_val);
30808 call_tests++;
30809 des_xmlTextReaderPtr(n_reader, reader, 0);
30810 des_xmlRelaxNGPtr(n_schema, schema, 1);
30811 xmlResetLastError();
30812 if (mem_base != xmlMemBlocks()) {
30813 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030815 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030816 printf(" %d", n_reader);
30817 printf(" %d", n_schema);
30818 printf("\n");
30819 }
30820 }
30821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030822 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030823#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000030824
Daniel Veillard42595322004-11-08 10:52:06 +000030825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030826}
30827
30828
30829static int
30830test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030832
William M. Brack21e4ef22005-01-02 09:53:13 +000030833#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030834 int mem_base;
30835 int ret_val;
30836 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30837 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030838 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030839 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030840
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030841 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30842 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030844 reader = gen_xmlTextReaderPtr(n_reader, 0);
30845 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030846
William M. Brackf13f77f2004-11-12 16:03:48 +000030847 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030848 desret_int(ret_val);
30849 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030850 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030851 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030852 xmlResetLastError();
30853 if (mem_base != xmlMemBlocks()) {
30854 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030856 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030857 printf(" %d", n_reader);
30858 printf(" %d", n_rng);
30859 printf("\n");
30860 }
30861 }
30862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030863 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030864#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030865
Daniel Veillard42595322004-11-08 10:52:06 +000030866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030867}
30868
30869
30870static int
30871test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030873
30874
30875 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030877}
30878
30879
30880static int
30881test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030883
William M. Brack21e4ef22005-01-02 09:53:13 +000030884#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030885 int mem_base;
30886 int ret_val;
30887 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30888 int n_reader;
30889 int prop; /* the xmlParserProperties to set */
30890 int n_prop;
30891 int value; /* usually 0 or 1 to (de)activate it */
30892 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030893
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030894 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30895 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30896 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30897 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030898 reader = gen_xmlTextReaderPtr(n_reader, 0);
30899 prop = gen_int(n_prop, 1);
30900 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030901
30902 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30903 desret_int(ret_val);
30904 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030905 des_xmlTextReaderPtr(n_reader, reader, 0);
30906 des_int(n_prop, prop, 1);
30907 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030908 xmlResetLastError();
30909 if (mem_base != xmlMemBlocks()) {
30910 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030912 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030913 printf(" %d", n_reader);
30914 printf(" %d", n_prop);
30915 printf(" %d", n_value);
30916 printf("\n");
30917 }
30918 }
30919 }
30920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030921 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030922#endif
30923
Daniel Veillard42595322004-11-08 10:52:06 +000030924 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030925}
30926
30927
30928static int
30929test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030930 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030931
30932
30933 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030935}
30936
30937
30938static int
30939test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030941
William M. Brack21e4ef22005-01-02 09:53:13 +000030942#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030943 int mem_base;
30944 int ret_val;
30945 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30946 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030947
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030948 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30949 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030950 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030951
30952 ret_val = xmlTextReaderStandalone(reader);
30953 desret_int(ret_val);
30954 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030955 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030956 xmlResetLastError();
30957 if (mem_base != xmlMemBlocks()) {
30958 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030960 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030961 printf(" %d", n_reader);
30962 printf("\n");
30963 }
30964 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030965 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030966#endif
30967
Daniel Veillard42595322004-11-08 10:52:06 +000030968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030969}
30970
30971
30972static int
30973test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030975
William M. Brack21e4ef22005-01-02 09:53:13 +000030976#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030977 int mem_base;
30978 xmlChar * ret_val;
30979 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30980 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030981
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030982 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30983 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030984 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030985
30986 ret_val = xmlTextReaderValue(reader);
30987 desret_xmlChar_ptr(ret_val);
30988 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030989 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030990 xmlResetLastError();
30991 if (mem_base != xmlMemBlocks()) {
30992 printf("Leak of %d blocks found in xmlTextReaderValue",
30993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030994 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030995 printf(" %d", n_reader);
30996 printf("\n");
30997 }
30998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030999 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031000#endif
31001
Daniel Veillard42595322004-11-08 10:52:06 +000031002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031003}
31004
31005
31006static int
31007test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031009
William M. Brack21e4ef22005-01-02 09:53:13 +000031010#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031011 int mem_base;
31012 xmlChar * ret_val;
31013 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31014 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031015
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031016 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31017 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031018 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031019
31020 ret_val = xmlTextReaderXmlLang(reader);
31021 desret_xmlChar_ptr(ret_val);
31022 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031023 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031024 xmlResetLastError();
31025 if (mem_base != xmlMemBlocks()) {
31026 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031028 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031029 printf(" %d", n_reader);
31030 printf("\n");
31031 }
31032 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031033 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031034#endif
31035
Daniel Veillard42595322004-11-08 10:52:06 +000031036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031037}
31038
31039static int
31040test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031042
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031043 if (quiet == 0) printf("Testing xmlreader : 70 of 80 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031044 test_ret += test_xmlNewTextReader();
31045 test_ret += test_xmlNewTextReaderFilename();
31046 test_ret += test_xmlReaderForDoc();
31047 test_ret += test_xmlReaderForFile();
31048 test_ret += test_xmlReaderForMemory();
31049 test_ret += test_xmlReaderNewDoc();
31050 test_ret += test_xmlReaderNewFile();
31051 test_ret += test_xmlReaderNewMemory();
31052 test_ret += test_xmlReaderNewWalker();
31053 test_ret += test_xmlReaderWalker();
31054 test_ret += test_xmlTextReaderAttributeCount();
31055 test_ret += test_xmlTextReaderBaseUri();
31056 test_ret += test_xmlTextReaderClose();
31057 test_ret += test_xmlTextReaderConstBaseUri();
31058 test_ret += test_xmlTextReaderConstEncoding();
31059 test_ret += test_xmlTextReaderConstLocalName();
31060 test_ret += test_xmlTextReaderConstName();
31061 test_ret += test_xmlTextReaderConstNamespaceUri();
31062 test_ret += test_xmlTextReaderConstPrefix();
31063 test_ret += test_xmlTextReaderConstString();
31064 test_ret += test_xmlTextReaderConstValue();
31065 test_ret += test_xmlTextReaderConstXmlLang();
31066 test_ret += test_xmlTextReaderConstXmlVersion();
31067 test_ret += test_xmlTextReaderCurrentDoc();
31068 test_ret += test_xmlTextReaderCurrentNode();
31069 test_ret += test_xmlTextReaderDepth();
31070 test_ret += test_xmlTextReaderExpand();
31071 test_ret += test_xmlTextReaderGetAttribute();
31072 test_ret += test_xmlTextReaderGetAttributeNo();
31073 test_ret += test_xmlTextReaderGetAttributeNs();
31074 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031075 test_ret += test_xmlTextReaderGetParserColumnNumber();
31076 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031077 test_ret += test_xmlTextReaderGetParserProp();
31078 test_ret += test_xmlTextReaderGetRemainder();
31079 test_ret += test_xmlTextReaderHasAttributes();
31080 test_ret += test_xmlTextReaderHasValue();
31081 test_ret += test_xmlTextReaderIsDefault();
31082 test_ret += test_xmlTextReaderIsEmptyElement();
31083 test_ret += test_xmlTextReaderIsNamespaceDecl();
31084 test_ret += test_xmlTextReaderIsValid();
31085 test_ret += test_xmlTextReaderLocalName();
31086 test_ret += test_xmlTextReaderLocatorBaseURI();
31087 test_ret += test_xmlTextReaderLocatorLineNumber();
31088 test_ret += test_xmlTextReaderLookupNamespace();
31089 test_ret += test_xmlTextReaderMoveToAttribute();
31090 test_ret += test_xmlTextReaderMoveToAttributeNo();
31091 test_ret += test_xmlTextReaderMoveToAttributeNs();
31092 test_ret += test_xmlTextReaderMoveToElement();
31093 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31094 test_ret += test_xmlTextReaderMoveToNextAttribute();
31095 test_ret += test_xmlTextReaderName();
31096 test_ret += test_xmlTextReaderNamespaceUri();
31097 test_ret += test_xmlTextReaderNext();
31098 test_ret += test_xmlTextReaderNextSibling();
31099 test_ret += test_xmlTextReaderNodeType();
31100 test_ret += test_xmlTextReaderNormalization();
31101 test_ret += test_xmlTextReaderPrefix();
31102 test_ret += test_xmlTextReaderPreserve();
31103 test_ret += test_xmlTextReaderPreservePattern();
31104 test_ret += test_xmlTextReaderQuoteChar();
31105 test_ret += test_xmlTextReaderRead();
31106 test_ret += test_xmlTextReaderReadAttributeValue();
31107 test_ret += test_xmlTextReaderReadState();
31108 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31109 test_ret += test_xmlTextReaderRelaxNGValidate();
31110 test_ret += test_xmlTextReaderSetErrorHandler();
31111 test_ret += test_xmlTextReaderSetParserProp();
31112 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31113 test_ret += test_xmlTextReaderStandalone();
31114 test_ret += test_xmlTextReaderValue();
31115 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031116
Daniel Veillard42595322004-11-08 10:52:06 +000031117 if (test_ret != 0)
31118 printf("Module xmlreader: %d errors\n", test_ret);
31119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031120}
Daniel Veillarda521d282004-11-09 14:59:59 +000031121#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031122
Daniel Veillarda82b1822004-11-08 16:24:57 +000031123#define gen_nb_xmlRegExecCtxtPtr 1
31124static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31125 return(NULL);
31126}
31127static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31128}
Daniel Veillarda521d282004-11-09 14:59:59 +000031129#endif
31130
Daniel Veillarda82b1822004-11-08 16:24:57 +000031131
31132static int
31133test_xmlRegExecPushString(void) {
31134 int test_ret = 0;
31135
William M. Brack21e4ef22005-01-02 09:53:13 +000031136#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031137 int mem_base;
31138 int ret_val;
31139 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31140 int n_exec;
31141 xmlChar * value; /* a string token input */
31142 int n_value;
31143 void * data; /* data associated to the token to reuse in callbacks */
31144 int n_data;
31145
31146 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31147 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31148 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31149 mem_base = xmlMemBlocks();
31150 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31151 value = gen_const_xmlChar_ptr(n_value, 1);
31152 data = gen_userdata(n_data, 2);
31153
William M. Brackf13f77f2004-11-12 16:03:48 +000031154 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031155 desret_int(ret_val);
31156 call_tests++;
31157 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031158 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031159 des_userdata(n_data, data, 2);
31160 xmlResetLastError();
31161 if (mem_base != xmlMemBlocks()) {
31162 printf("Leak of %d blocks found in xmlRegExecPushString",
31163 xmlMemBlocks() - mem_base);
31164 test_ret++;
31165 printf(" %d", n_exec);
31166 printf(" %d", n_value);
31167 printf(" %d", n_data);
31168 printf("\n");
31169 }
31170 }
31171 }
31172 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031173 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031174#endif
31175
Daniel Veillarda82b1822004-11-08 16:24:57 +000031176 return(test_ret);
31177}
31178
31179
31180static int
31181test_xmlRegExecPushString2(void) {
31182 int test_ret = 0;
31183
William M. Brack21e4ef22005-01-02 09:53:13 +000031184#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031185 int mem_base;
31186 int ret_val;
31187 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31188 int n_exec;
31189 xmlChar * value; /* the first string token input */
31190 int n_value;
31191 xmlChar * value2; /* the second string token input */
31192 int n_value2;
31193 void * data; /* data associated to the token to reuse in callbacks */
31194 int n_data;
31195
31196 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31197 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31198 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31199 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31200 mem_base = xmlMemBlocks();
31201 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31202 value = gen_const_xmlChar_ptr(n_value, 1);
31203 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31204 data = gen_userdata(n_data, 3);
31205
William M. Brackf13f77f2004-11-12 16:03:48 +000031206 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031207 desret_int(ret_val);
31208 call_tests++;
31209 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031210 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31211 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031212 des_userdata(n_data, data, 3);
31213 xmlResetLastError();
31214 if (mem_base != xmlMemBlocks()) {
31215 printf("Leak of %d blocks found in xmlRegExecPushString2",
31216 xmlMemBlocks() - mem_base);
31217 test_ret++;
31218 printf(" %d", n_exec);
31219 printf(" %d", n_value);
31220 printf(" %d", n_value2);
31221 printf(" %d", n_data);
31222 printf("\n");
31223 }
31224 }
31225 }
31226 }
31227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031228 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031229#endif
31230
Daniel Veillarda82b1822004-11-08 16:24:57 +000031231 return(test_ret);
31232}
31233
Daniel Veillarda521d282004-11-09 14:59:59 +000031234#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031235
31236#define gen_nb_xmlRegexpPtr 1
31237static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31238 return(NULL);
31239}
31240static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31241}
Daniel Veillarda521d282004-11-09 14:59:59 +000031242#endif
31243
Daniel Veillarda82b1822004-11-08 16:24:57 +000031244
31245static int
31246test_xmlRegNewExecCtxt(void) {
31247 int test_ret = 0;
31248
31249
31250 /* missing type support */
31251 return(test_ret);
31252}
31253
31254
31255static int
31256test_xmlRegexpCompile(void) {
31257 int test_ret = 0;
31258
31259
31260 /* missing type support */
31261 return(test_ret);
31262}
31263
31264
31265static int
31266test_xmlRegexpExec(void) {
31267 int test_ret = 0;
31268
William M. Brack21e4ef22005-01-02 09:53:13 +000031269#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031270 int mem_base;
31271 int ret_val;
31272 xmlRegexpPtr comp; /* the compiled regular expression */
31273 int n_comp;
31274 xmlChar * content; /* the value to check against the regular expression */
31275 int n_content;
31276
31277 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31278 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31279 mem_base = xmlMemBlocks();
31280 comp = gen_xmlRegexpPtr(n_comp, 0);
31281 content = gen_const_xmlChar_ptr(n_content, 1);
31282
William M. Brackf13f77f2004-11-12 16:03:48 +000031283 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031284 desret_int(ret_val);
31285 call_tests++;
31286 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031287 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031288 xmlResetLastError();
31289 if (mem_base != xmlMemBlocks()) {
31290 printf("Leak of %d blocks found in xmlRegexpExec",
31291 xmlMemBlocks() - mem_base);
31292 test_ret++;
31293 printf(" %d", n_comp);
31294 printf(" %d", n_content);
31295 printf("\n");
31296 }
31297 }
31298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031299 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031300#endif
31301
Daniel Veillarda82b1822004-11-08 16:24:57 +000031302 return(test_ret);
31303}
31304
31305
31306static int
31307test_xmlRegexpIsDeterminist(void) {
31308 int test_ret = 0;
31309
William M. Brack21e4ef22005-01-02 09:53:13 +000031310#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031311 int mem_base;
31312 int ret_val;
31313 xmlRegexpPtr comp; /* the compiled regular expression */
31314 int n_comp;
31315
31316 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31317 mem_base = xmlMemBlocks();
31318 comp = gen_xmlRegexpPtr(n_comp, 0);
31319
31320 ret_val = xmlRegexpIsDeterminist(comp);
31321 desret_int(ret_val);
31322 call_tests++;
31323 des_xmlRegexpPtr(n_comp, comp, 0);
31324 xmlResetLastError();
31325 if (mem_base != xmlMemBlocks()) {
31326 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31327 xmlMemBlocks() - mem_base);
31328 test_ret++;
31329 printf(" %d", n_comp);
31330 printf("\n");
31331 }
31332 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031333 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031334#endif
31335
Daniel Veillarda82b1822004-11-08 16:24:57 +000031336 return(test_ret);
31337}
31338
31339
31340static int
31341test_xmlRegexpPrint(void) {
31342 int test_ret = 0;
31343
William M. Brack21e4ef22005-01-02 09:53:13 +000031344#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031345 int mem_base;
31346 FILE * output; /* the file for the output debug */
31347 int n_output;
31348 xmlRegexpPtr regexp; /* the compiled regexp */
31349 int n_regexp;
31350
31351 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31352 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31353 mem_base = xmlMemBlocks();
31354 output = gen_FILE_ptr(n_output, 0);
31355 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31356
31357 xmlRegexpPrint(output, regexp);
31358 call_tests++;
31359 des_FILE_ptr(n_output, output, 0);
31360 des_xmlRegexpPtr(n_regexp, regexp, 1);
31361 xmlResetLastError();
31362 if (mem_base != xmlMemBlocks()) {
31363 printf("Leak of %d blocks found in xmlRegexpPrint",
31364 xmlMemBlocks() - mem_base);
31365 test_ret++;
31366 printf(" %d", n_output);
31367 printf(" %d", n_regexp);
31368 printf("\n");
31369 }
31370 }
31371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031372 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031373#endif
31374
Daniel Veillarda82b1822004-11-08 16:24:57 +000031375 return(test_ret);
31376}
31377
31378static int
31379test_xmlregexp(void) {
31380 int test_ret = 0;
31381
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031382 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031383 test_ret += test_xmlRegExecPushString();
31384 test_ret += test_xmlRegExecPushString2();
31385 test_ret += test_xmlRegNewExecCtxt();
31386 test_ret += test_xmlRegexpCompile();
31387 test_ret += test_xmlRegexpExec();
31388 test_ret += test_xmlRegexpIsDeterminist();
31389 test_ret += test_xmlRegexpPrint();
31390
31391 if (test_ret != 0)
31392 printf("Module xmlregexp: %d errors\n", test_ret);
31393 return(test_ret);
31394}
Daniel Veillarda521d282004-11-09 14:59:59 +000031395#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031396
Daniel Veillardce682bc2004-11-05 17:22:25 +000031397#define gen_nb_xmlSaveCtxtPtr 1
31398static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31399 return(NULL);
31400}
31401static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31402}
Daniel Veillarda521d282004-11-09 14:59:59 +000031403#endif
31404
Daniel Veillardce682bc2004-11-05 17:22:25 +000031405
Daniel Veillardd93f6252004-11-02 15:53:51 +000031406static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031407test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031409
William M. Brack21e4ef22005-01-02 09:53:13 +000031410#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031411 int mem_base;
31412 int ret_val;
31413 xmlSaveCtxtPtr ctxt; /* a document saving context */
31414 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031415
Daniel Veillardce682bc2004-11-05 17:22:25 +000031416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31417 mem_base = xmlMemBlocks();
31418 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31419
31420 ret_val = xmlSaveClose(ctxt);
31421 desret_int(ret_val);
31422 call_tests++;
31423 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31424 xmlResetLastError();
31425 if (mem_base != xmlMemBlocks()) {
31426 printf("Leak of %d blocks found in xmlSaveClose",
31427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031428 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031429 printf(" %d", n_ctxt);
31430 printf("\n");
31431 }
31432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031433 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031434#endif
31435
Daniel Veillard42595322004-11-08 10:52:06 +000031436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031437}
31438
31439
31440static int
31441test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031443
William M. Brack21e4ef22005-01-02 09:53:13 +000031444#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031445 int mem_base;
31446 long ret_val;
31447 xmlSaveCtxtPtr ctxt; /* a document saving context */
31448 int n_ctxt;
31449 xmlDocPtr doc; /* a document */
31450 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031451
Daniel Veillardce682bc2004-11-05 17:22:25 +000031452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31453 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31454 mem_base = xmlMemBlocks();
31455 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31456 doc = gen_xmlDocPtr(n_doc, 1);
31457
31458 ret_val = xmlSaveDoc(ctxt, doc);
31459 desret_long(ret_val);
31460 call_tests++;
31461 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31462 des_xmlDocPtr(n_doc, doc, 1);
31463 xmlResetLastError();
31464 if (mem_base != xmlMemBlocks()) {
31465 printf("Leak of %d blocks found in xmlSaveDoc",
31466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031467 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031468 printf(" %d", n_ctxt);
31469 printf(" %d", n_doc);
31470 printf("\n");
31471 }
31472 }
31473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031474 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031475#endif
31476
Daniel Veillard42595322004-11-08 10:52:06 +000031477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031478}
31479
31480
31481static int
31482test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031484
William M. Brack21e4ef22005-01-02 09:53:13 +000031485#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031486 int mem_base;
31487 int ret_val;
31488 xmlSaveCtxtPtr ctxt; /* a document saving context */
31489 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031490
Daniel Veillardce682bc2004-11-05 17:22:25 +000031491 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31492 mem_base = xmlMemBlocks();
31493 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31494
31495 ret_val = xmlSaveFlush(ctxt);
31496 desret_int(ret_val);
31497 call_tests++;
31498 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31499 xmlResetLastError();
31500 if (mem_base != xmlMemBlocks()) {
31501 printf("Leak of %d blocks found in xmlSaveFlush",
31502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031503 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031504 printf(" %d", n_ctxt);
31505 printf("\n");
31506 }
31507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031508 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031509#endif
31510
Daniel Veillard42595322004-11-08 10:52:06 +000031511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031512}
31513
31514
31515static int
31516test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031518
31519
31520 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031522}
31523
31524
31525static int
31526test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031528
31529
31530 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031532}
31533
31534
31535static int
31536test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031538
31539
31540 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031542}
31543
31544
31545static int
31546test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031548
31549
31550 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031552}
31553
31554
31555static int
31556test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031558
William M. Brack21e4ef22005-01-02 09:53:13 +000031559#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031560 int mem_base;
31561 long ret_val;
31562 xmlSaveCtxtPtr ctxt; /* a document saving context */
31563 int n_ctxt;
31564 xmlNodePtr node; /* a document */
31565 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031566
Daniel Veillardce682bc2004-11-05 17:22:25 +000031567 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31568 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31569 mem_base = xmlMemBlocks();
31570 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31571 node = gen_xmlNodePtr(n_node, 1);
31572
31573 ret_val = xmlSaveTree(ctxt, node);
31574 desret_long(ret_val);
31575 call_tests++;
31576 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31577 des_xmlNodePtr(n_node, node, 1);
31578 xmlResetLastError();
31579 if (mem_base != xmlMemBlocks()) {
31580 printf("Leak of %d blocks found in xmlSaveTree",
31581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031582 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031583 printf(" %d", n_ctxt);
31584 printf(" %d", n_node);
31585 printf("\n");
31586 }
31587 }
31588 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031589 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031590#endif
31591
Daniel Veillard42595322004-11-08 10:52:06 +000031592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031593}
31594
31595static int
31596test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031598
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031599 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031600 test_ret += test_xmlSaveClose();
31601 test_ret += test_xmlSaveDoc();
31602 test_ret += test_xmlSaveFlush();
31603 test_ret += test_xmlSaveSetAttrEscape();
31604 test_ret += test_xmlSaveSetEscape();
31605 test_ret += test_xmlSaveToFd();
31606 test_ret += test_xmlSaveToFilename();
31607 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031608
Daniel Veillard42595322004-11-08 10:52:06 +000031609 if (test_ret != 0)
31610 printf("Module xmlsave: %d errors\n", test_ret);
31611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031612}
Daniel Veillarda521d282004-11-09 14:59:59 +000031613#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031614
Daniel Veillardce682bc2004-11-05 17:22:25 +000031615#define gen_nb_xmlSchemaPtr 1
31616static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31617 return(NULL);
31618}
31619static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31620}
Daniel Veillarda521d282004-11-09 14:59:59 +000031621#endif
31622
Daniel Veillardce682bc2004-11-05 17:22:25 +000031623
Daniel Veillardd93f6252004-11-02 15:53:51 +000031624static int
31625test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031627
William M. Brack21e4ef22005-01-02 09:53:13 +000031628#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031629 int mem_base;
31630 FILE * output; /* the file output */
31631 int n_output;
31632 xmlSchemaPtr schema; /* a schema structure */
31633 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031634
Daniel Veillardce682bc2004-11-05 17:22:25 +000031635 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31636 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31637 mem_base = xmlMemBlocks();
31638 output = gen_FILE_ptr(n_output, 0);
31639 schema = gen_xmlSchemaPtr(n_schema, 1);
31640
31641 xmlSchemaDump(output, schema);
31642 call_tests++;
31643 des_FILE_ptr(n_output, output, 0);
31644 des_xmlSchemaPtr(n_schema, schema, 1);
31645 xmlResetLastError();
31646 if (mem_base != xmlMemBlocks()) {
31647 printf("Leak of %d blocks found in xmlSchemaDump",
31648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031649 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031650 printf(" %d", n_output);
31651 printf(" %d", n_schema);
31652 printf("\n");
31653 }
31654 }
31655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031656 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031657#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031658
Daniel Veillard42595322004-11-08 10:52:06 +000031659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031660}
31661
Daniel Veillarda521d282004-11-09 14:59:59 +000031662#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031663
Daniel Veillardce682bc2004-11-05 17:22:25 +000031664#define gen_nb_xmlSchemaParserCtxtPtr 1
31665static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31666 return(NULL);
31667}
31668static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31669}
Daniel Veillarda521d282004-11-09 14:59:59 +000031670#endif
31671
31672#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031673
31674#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31675static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31676 return(NULL);
31677}
31678static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31679}
Daniel Veillarda521d282004-11-09 14:59:59 +000031680#endif
31681
31682#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031683
31684#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31685static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31686 return(NULL);
31687}
31688static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31689}
Daniel Veillarda521d282004-11-09 14:59:59 +000031690#endif
31691
Daniel Veillardce682bc2004-11-05 17:22:25 +000031692
Daniel Veillardd93f6252004-11-02 15:53:51 +000031693static int
31694test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031696
William M. Brack21e4ef22005-01-02 09:53:13 +000031697#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031698 int mem_base;
31699 int ret_val;
31700 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31701 int n_ctxt;
31702 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31703 int n_err;
31704 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31705 int n_warn;
31706 void ** ctx; /* contextual data for the callbacks result */
31707 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031708
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031709 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31710 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31711 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31712 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31713 mem_base = xmlMemBlocks();
31714 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31715 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31716 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31717 ctx = gen_void_ptr_ptr(n_ctx, 3);
31718
31719 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31720 desret_int(ret_val);
31721 call_tests++;
31722 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31723 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31724 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31725 des_void_ptr_ptr(n_ctx, ctx, 3);
31726 xmlResetLastError();
31727 if (mem_base != xmlMemBlocks()) {
31728 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031730 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031731 printf(" %d", n_ctxt);
31732 printf(" %d", n_err);
31733 printf(" %d", n_warn);
31734 printf(" %d", n_ctx);
31735 printf("\n");
31736 }
31737 }
31738 }
31739 }
31740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031741 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031742#endif
31743
Daniel Veillard42595322004-11-08 10:52:06 +000031744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031745}
31746
Daniel Veillarda521d282004-11-09 14:59:59 +000031747#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031748
Daniel Veillardce682bc2004-11-05 17:22:25 +000031749#define gen_nb_xmlSchemaValidCtxtPtr 1
31750static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31751 return(NULL);
31752}
31753static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31754}
Daniel Veillarda521d282004-11-09 14:59:59 +000031755#endif
31756
Daniel Veillardce682bc2004-11-05 17:22:25 +000031757
Daniel Veillardd93f6252004-11-02 15:53:51 +000031758static int
31759test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031761
William M. Brack21e4ef22005-01-02 09:53:13 +000031762#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031763 int mem_base;
31764 int ret_val;
31765 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31766 int n_ctxt;
31767 xmlSchemaValidityErrorFunc * err; /* the error function result */
31768 int n_err;
31769 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31770 int n_warn;
31771 void ** ctx; /* the functions context result */
31772 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031773
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031774 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31775 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31776 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31777 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31778 mem_base = xmlMemBlocks();
31779 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31780 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31781 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31782 ctx = gen_void_ptr_ptr(n_ctx, 3);
31783
31784 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31785 desret_int(ret_val);
31786 call_tests++;
31787 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31788 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31789 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31790 des_void_ptr_ptr(n_ctx, ctx, 3);
31791 xmlResetLastError();
31792 if (mem_base != xmlMemBlocks()) {
31793 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031795 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031796 printf(" %d", n_ctxt);
31797 printf(" %d", n_err);
31798 printf(" %d", n_warn);
31799 printf(" %d", n_ctx);
31800 printf("\n");
31801 }
31802 }
31803 }
31804 }
31805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031806 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031807#endif
31808
Daniel Veillard42595322004-11-08 10:52:06 +000031809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031810}
31811
31812
31813static int
31814test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031816
William M. Brack21e4ef22005-01-02 09:53:13 +000031817#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031818 int mem_base;
31819 xmlSchemaParserCtxtPtr ret_val;
31820 xmlDocPtr doc; /* a preparsed document tree */
31821 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031822
Daniel Veillard42595322004-11-08 10:52:06 +000031823 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31824 mem_base = xmlMemBlocks();
31825 doc = gen_xmlDocPtr(n_doc, 0);
31826
31827 ret_val = xmlSchemaNewDocParserCtxt(doc);
31828 desret_xmlSchemaParserCtxtPtr(ret_val);
31829 call_tests++;
31830 des_xmlDocPtr(n_doc, doc, 0);
31831 xmlResetLastError();
31832 if (mem_base != xmlMemBlocks()) {
31833 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31834 xmlMemBlocks() - mem_base);
31835 test_ret++;
31836 printf(" %d", n_doc);
31837 printf("\n");
31838 }
31839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031840 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031841#endif
31842
Daniel Veillard42595322004-11-08 10:52:06 +000031843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031844}
31845
31846
31847static int
31848test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031850
William M. Brack21e4ef22005-01-02 09:53:13 +000031851#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031852 int mem_base;
31853 xmlSchemaParserCtxtPtr ret_val;
31854 char * buffer; /* a pointer to a char array containing the schemas */
31855 int n_buffer;
31856 int size; /* the size of the array */
31857 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031858
Daniel Veillard42595322004-11-08 10:52:06 +000031859 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31860 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31861 mem_base = xmlMemBlocks();
31862 buffer = gen_const_char_ptr(n_buffer, 0);
31863 size = gen_int(n_size, 1);
31864
William M. Brackf13f77f2004-11-12 16:03:48 +000031865 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000031866 desret_xmlSchemaParserCtxtPtr(ret_val);
31867 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031868 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031869 des_int(n_size, size, 1);
31870 xmlResetLastError();
31871 if (mem_base != xmlMemBlocks()) {
31872 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31873 xmlMemBlocks() - mem_base);
31874 test_ret++;
31875 printf(" %d", n_buffer);
31876 printf(" %d", n_size);
31877 printf("\n");
31878 }
31879 }
31880 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031881 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031882#endif
31883
Daniel Veillard42595322004-11-08 10:52:06 +000031884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031885}
31886
31887
31888static int
31889test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031891
William M. Brack21e4ef22005-01-02 09:53:13 +000031892#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031893 int mem_base;
31894 xmlSchemaParserCtxtPtr ret_val;
31895 char * URL; /* the location of the schema */
31896 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031897
Daniel Veillard42595322004-11-08 10:52:06 +000031898 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31899 mem_base = xmlMemBlocks();
31900 URL = gen_const_char_ptr(n_URL, 0);
31901
William M. Brackf13f77f2004-11-12 16:03:48 +000031902 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000031903 desret_xmlSchemaParserCtxtPtr(ret_val);
31904 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031905 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031906 xmlResetLastError();
31907 if (mem_base != xmlMemBlocks()) {
31908 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31909 xmlMemBlocks() - mem_base);
31910 test_ret++;
31911 printf(" %d", n_URL);
31912 printf("\n");
31913 }
31914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031915 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031916#endif
31917
Daniel Veillard42595322004-11-08 10:52:06 +000031918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031919}
31920
31921
31922static int
31923test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031925
31926
31927 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031929}
31930
31931
31932static int
31933test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031935
31936
31937 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031939}
31940
31941
31942static int
31943test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031945
31946
31947 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031949}
31950
31951
31952static int
31953test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031955
31956
31957 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031959}
31960
31961
31962static int
31963test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031965
William M. Brack21e4ef22005-01-02 09:53:13 +000031966#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031967 int mem_base;
31968 int ret_val;
31969 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31970 int n_ctxt;
31971 int options; /* a combination of xmlSchemaValidOption */
31972 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031973
Daniel Veillardce682bc2004-11-05 17:22:25 +000031974 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31975 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31976 mem_base = xmlMemBlocks();
31977 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31978 options = gen_int(n_options, 1);
31979
31980 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31981 desret_int(ret_val);
31982 call_tests++;
31983 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31984 des_int(n_options, options, 1);
31985 xmlResetLastError();
31986 if (mem_base != xmlMemBlocks()) {
31987 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031989 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031990 printf(" %d", n_ctxt);
31991 printf(" %d", n_options);
31992 printf("\n");
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
32002
32003static int
32004test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032006
William M. Brack21e4ef22005-01-02 09:53:13 +000032007#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032008 int mem_base;
32009 int ret_val;
32010 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32011 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032012
Daniel Veillardce682bc2004-11-05 17:22:25 +000032013 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32014 mem_base = xmlMemBlocks();
32015 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32016
32017 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32018 desret_int(ret_val);
32019 call_tests++;
32020 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32021 xmlResetLastError();
32022 if (mem_base != xmlMemBlocks()) {
32023 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032025 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032026 printf(" %d", n_ctxt);
32027 printf("\n");
32028 }
32029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032030 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032031#endif
32032
Daniel Veillard42595322004-11-08 10:52:06 +000032033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032034}
32035
32036
32037static int
32038test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032040
William M. Brack21e4ef22005-01-02 09:53:13 +000032041#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032042 int mem_base;
32043 int ret_val;
32044 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32045 int n_ctxt;
32046 xmlDocPtr doc; /* a parsed document tree */
32047 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032048
Daniel Veillardce682bc2004-11-05 17:22:25 +000032049 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32050 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32051 mem_base = xmlMemBlocks();
32052 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32053 doc = gen_xmlDocPtr(n_doc, 1);
32054
32055 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32056 desret_int(ret_val);
32057 call_tests++;
32058 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32059 des_xmlDocPtr(n_doc, doc, 1);
32060 xmlResetLastError();
32061 if (mem_base != xmlMemBlocks()) {
32062 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032064 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032065 printf(" %d", n_ctxt);
32066 printf(" %d", n_doc);
32067 printf("\n");
32068 }
32069 }
32070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032071 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032072#endif
32073
Daniel Veillard42595322004-11-08 10:52:06 +000032074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032075}
32076
32077
32078static int
32079test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032081
William M. Brack21e4ef22005-01-02 09:53:13 +000032082#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032083 int mem_base;
32084 int ret_val;
32085 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32086 int n_ctxt;
32087 xmlNodePtr elem; /* an element node */
32088 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032089
Daniel Veillardce682bc2004-11-05 17:22:25 +000032090 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32091 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32092 mem_base = xmlMemBlocks();
32093 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32094 elem = gen_xmlNodePtr(n_elem, 1);
32095
32096 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32097 desret_int(ret_val);
32098 call_tests++;
32099 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32100 des_xmlNodePtr(n_elem, elem, 1);
32101 xmlResetLastError();
32102 if (mem_base != xmlMemBlocks()) {
32103 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032105 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032106 printf(" %d", n_ctxt);
32107 printf(" %d", n_elem);
32108 printf("\n");
32109 }
32110 }
32111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032112 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032113#endif
32114
Daniel Veillard42595322004-11-08 10:52:06 +000032115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032116}
32117
32118
32119static int
32120test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122
William M. Brack21e4ef22005-01-02 09:53:13 +000032123#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032124 int mem_base;
32125 int ret_val;
32126 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32127 int n_ctxt;
32128 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32129 int n_input;
32130 xmlCharEncoding enc; /* an optional encoding information */
32131 int n_enc;
32132 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32133 int n_sax;
32134 void * user_data; /* the context to provide to the SAX handler. */
32135 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032136
Daniel Veillardce682bc2004-11-05 17:22:25 +000032137 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32138 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32139 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32140 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32141 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32142 mem_base = xmlMemBlocks();
32143 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32144 input = gen_xmlParserInputBufferPtr(n_input, 1);
32145 enc = gen_xmlCharEncoding(n_enc, 2);
32146 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32147 user_data = gen_userdata(n_user_data, 4);
32148
32149 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32150 desret_int(ret_val);
32151 call_tests++;
32152 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32153 des_xmlParserInputBufferPtr(n_input, input, 1);
32154 des_xmlCharEncoding(n_enc, enc, 2);
32155 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32156 des_userdata(n_user_data, user_data, 4);
32157 xmlResetLastError();
32158 if (mem_base != xmlMemBlocks()) {
32159 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032161 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032162 printf(" %d", n_ctxt);
32163 printf(" %d", n_input);
32164 printf(" %d", n_enc);
32165 printf(" %d", n_sax);
32166 printf(" %d", n_user_data);
32167 printf("\n");
32168 }
32169 }
32170 }
32171 }
32172 }
32173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032174 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032175#endif
32176
Daniel Veillard42595322004-11-08 10:52:06 +000032177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032178}
32179
32180static int
32181test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032183
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032184 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032185 test_ret += test_xmlSchemaDump();
32186 test_ret += test_xmlSchemaGetParserErrors();
32187 test_ret += test_xmlSchemaGetValidErrors();
32188 test_ret += test_xmlSchemaNewDocParserCtxt();
32189 test_ret += test_xmlSchemaNewMemParserCtxt();
32190 test_ret += test_xmlSchemaNewParserCtxt();
32191 test_ret += test_xmlSchemaNewValidCtxt();
32192 test_ret += test_xmlSchemaParse();
32193 test_ret += test_xmlSchemaSetParserErrors();
32194 test_ret += test_xmlSchemaSetValidErrors();
32195 test_ret += test_xmlSchemaSetValidOptions();
32196 test_ret += test_xmlSchemaValidCtxtGetOptions();
32197 test_ret += test_xmlSchemaValidateDoc();
32198 test_ret += test_xmlSchemaValidateOneElement();
32199 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032200
Daniel Veillard42595322004-11-08 10:52:06 +000032201 if (test_ret != 0)
32202 printf("Module xmlschemas: %d errors\n", test_ret);
32203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032204}
Daniel Veillarda521d282004-11-09 14:59:59 +000032205#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032206
Daniel Veillardce682bc2004-11-05 17:22:25 +000032207#define gen_nb_xmlSchemaFacetPtr 1
32208static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32209 return(NULL);
32210}
32211static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32212}
Daniel Veillarda521d282004-11-09 14:59:59 +000032213#endif
32214
32215#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032216
32217#define gen_nb_xmlSchemaTypePtr 1
32218static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32219 return(NULL);
32220}
32221static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32222}
Daniel Veillarda521d282004-11-09 14:59:59 +000032223#endif
32224
Daniel Veillardce682bc2004-11-05 17:22:25 +000032225
Daniel Veillardd93f6252004-11-02 15:53:51 +000032226static int
32227test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032229
William M. Brack21e4ef22005-01-02 09:53:13 +000032230#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032231 int mem_base;
32232 int ret_val;
32233 xmlSchemaFacetPtr facet; /* the facet */
32234 int n_facet;
32235 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32236 int n_typeDecl;
32237 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32238 int n_ctxt;
32239 xmlChar * name; /* name of the type */
32240 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032241
Daniel Veillardce682bc2004-11-05 17:22:25 +000032242 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32243 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32244 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32245 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32246 mem_base = xmlMemBlocks();
32247 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32248 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32249 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32250 name = gen_const_xmlChar_ptr(n_name, 3);
32251
William M. Brackf13f77f2004-11-12 16:03:48 +000032252 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032253 desret_int(ret_val);
32254 call_tests++;
32255 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32256 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32257 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032258 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032259 xmlResetLastError();
32260 if (mem_base != xmlMemBlocks()) {
32261 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032263 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032264 printf(" %d", n_facet);
32265 printf(" %d", n_typeDecl);
32266 printf(" %d", n_ctxt);
32267 printf(" %d", n_name);
32268 printf("\n");
32269 }
32270 }
32271 }
32272 }
32273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032274 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032275#endif
32276
Daniel Veillard42595322004-11-08 10:52:06 +000032277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032278}
32279
32280
32281static int
32282test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032284
William M. Brack21e4ef22005-01-02 09:53:13 +000032285#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032286 int mem_base;
32287
32288 mem_base = xmlMemBlocks();
32289
32290 xmlSchemaCleanupTypes();
32291 call_tests++;
32292 xmlResetLastError();
32293 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032294 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032296 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032297 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032299 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032300#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_xmlSchemaCollapseString(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 Veillard8a32fe42004-11-02 22:10:16 +000032311 int mem_base;
32312 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032313 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032314 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032315
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032316 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32317 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032318 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032319
William M. Brackf13f77f2004-11-12 16:03:48 +000032320 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032321 desret_xmlChar_ptr(ret_val);
32322 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032323 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032324 xmlResetLastError();
32325 if (mem_base != xmlMemBlocks()) {
32326 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032328 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032329 printf(" %d", n_value);
32330 printf("\n");
32331 }
32332 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032333 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032334#endif
32335
Daniel Veillard42595322004-11-08 10:52:06 +000032336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032337}
32338
Daniel Veillarda521d282004-11-09 14:59:59 +000032339#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032340
Daniel Veillardce682bc2004-11-05 17:22:25 +000032341#define gen_nb_xmlSchemaValPtr 1
32342static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32343 return(NULL);
32344}
32345static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32346}
Daniel Veillarda521d282004-11-09 14:59:59 +000032347#endif
32348
Daniel Veillardce682bc2004-11-05 17:22:25 +000032349
Daniel Veillardd93f6252004-11-02 15:53:51 +000032350static int
32351test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032353
William M. Brack21e4ef22005-01-02 09:53:13 +000032354#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032355 int mem_base;
32356 int ret_val;
32357 xmlSchemaValPtr x; /* a first value */
32358 int n_x;
32359 xmlSchemaValPtr y; /* a second value */
32360 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032361
Daniel Veillardce682bc2004-11-05 17:22:25 +000032362 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32363 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32364 mem_base = xmlMemBlocks();
32365 x = gen_xmlSchemaValPtr(n_x, 0);
32366 y = gen_xmlSchemaValPtr(n_y, 1);
32367
32368 ret_val = xmlSchemaCompareValues(x, y);
32369 desret_int(ret_val);
32370 call_tests++;
32371 des_xmlSchemaValPtr(n_x, x, 0);
32372 des_xmlSchemaValPtr(n_y, y, 1);
32373 xmlResetLastError();
32374 if (mem_base != xmlMemBlocks()) {
32375 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032377 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032378 printf(" %d", n_x);
32379 printf(" %d", n_y);
32380 printf("\n");
32381 }
32382 }
32383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032384 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032385#endif
32386
Daniel Veillard42595322004-11-08 10:52:06 +000032387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032388}
32389
32390
32391static int
32392test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032394
William M. Brack21e4ef22005-01-02 09:53:13 +000032395#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032396 int mem_base;
32397 xmlSchemaTypePtr ret_val;
32398 xmlSchemaTypePtr type; /* the built-in simple type. */
32399 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032400
Daniel Veillard42595322004-11-08 10:52:06 +000032401 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32402 mem_base = xmlMemBlocks();
32403 type = gen_xmlSchemaTypePtr(n_type, 0);
32404
32405 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32406 desret_xmlSchemaTypePtr(ret_val);
32407 call_tests++;
32408 des_xmlSchemaTypePtr(n_type, type, 0);
32409 xmlResetLastError();
32410 if (mem_base != xmlMemBlocks()) {
32411 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32412 xmlMemBlocks() - mem_base);
32413 test_ret++;
32414 printf(" %d", n_type);
32415 printf("\n");
32416 }
32417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032419#endif
32420
Daniel Veillard42595322004-11-08 10:52:06 +000032421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032422}
32423
32424
32425static int
32426test_xmlSchemaGetBuiltInType(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 Veillard42595322004-11-08 10:52:06 +000032430 xmlSchemaTypePtr ret_val;
32431 xmlSchemaValType type; /* the type of the built in type */
32432 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032433
Daniel Veillard42595322004-11-08 10:52:06 +000032434 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32435 type = gen_xmlSchemaValType(n_type, 0);
32436
32437 ret_val = xmlSchemaGetBuiltInType(type);
32438 desret_xmlSchemaTypePtr(ret_val);
32439 call_tests++;
32440 des_xmlSchemaValType(n_type, type, 0);
32441 xmlResetLastError();
32442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032443 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032444#endif
32445
Daniel Veillard42595322004-11-08 10:52:06 +000032446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032447}
32448
32449
32450static int
32451test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032453
William M. Brack21e4ef22005-01-02 09:53:13 +000032454#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032455 int mem_base;
32456 unsigned long ret_val;
32457 xmlSchemaFacetPtr facet; /* an schemas type facet */
32458 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032459
William M. Brack094dd862004-11-14 14:28:34 +000032460 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32461 mem_base = xmlMemBlocks();
32462 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32463
32464 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32465 desret_unsigned_long(ret_val);
32466 call_tests++;
32467 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32468 xmlResetLastError();
32469 if (mem_base != xmlMemBlocks()) {
32470 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32471 xmlMemBlocks() - mem_base);
32472 test_ret++;
32473 printf(" %d", n_facet);
32474 printf("\n");
32475 }
32476 }
32477 function_tests++;
32478#endif
32479
Daniel Veillard42595322004-11-08 10:52:06 +000032480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032481}
32482
32483
32484static int
32485test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032487
William M. Brack21e4ef22005-01-02 09:53:13 +000032488#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032489 int mem_base;
32490 xmlSchemaTypePtr ret_val;
32491 xmlChar * name; /* the type name */
32492 int n_name;
32493 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32494 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032495
Daniel Veillard42595322004-11-08 10:52:06 +000032496 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32497 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32498 mem_base = xmlMemBlocks();
32499 name = gen_const_xmlChar_ptr(n_name, 0);
32500 ns = gen_const_xmlChar_ptr(n_ns, 1);
32501
William M. Brackf13f77f2004-11-12 16:03:48 +000032502 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032503 desret_xmlSchemaTypePtr(ret_val);
32504 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032505 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32506 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032507 xmlResetLastError();
32508 if (mem_base != xmlMemBlocks()) {
32509 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32510 xmlMemBlocks() - mem_base);
32511 test_ret++;
32512 printf(" %d", n_name);
32513 printf(" %d", n_ns);
32514 printf("\n");
32515 }
32516 }
32517 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032518 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032519#endif
32520
Daniel Veillard42595322004-11-08 10:52:06 +000032521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032522}
32523
32524
32525static int
32526test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032528
William M. Brack21e4ef22005-01-02 09:53:13 +000032529#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032530
32531
32532 xmlSchemaInitTypes();
32533 call_tests++;
32534 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032535 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032536#endif
32537
Daniel Veillard42595322004-11-08 10:52:06 +000032538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032539}
32540
32541
32542static int
32543test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032545
William M. Brack21e4ef22005-01-02 09:53:13 +000032546#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032547 int mem_base;
32548 int ret_val;
32549 xmlSchemaTypePtr type; /* the built-in type */
32550 int n_type;
32551 int facetType; /* the facet type */
32552 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032553
Daniel Veillardce682bc2004-11-05 17:22:25 +000032554 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32555 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32556 mem_base = xmlMemBlocks();
32557 type = gen_xmlSchemaTypePtr(n_type, 0);
32558 facetType = gen_int(n_facetType, 1);
32559
32560 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32561 desret_int(ret_val);
32562 call_tests++;
32563 des_xmlSchemaTypePtr(n_type, type, 0);
32564 des_int(n_facetType, facetType, 1);
32565 xmlResetLastError();
32566 if (mem_base != xmlMemBlocks()) {
32567 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032569 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032570 printf(" %d", n_type);
32571 printf(" %d", n_facetType);
32572 printf("\n");
32573 }
32574 }
32575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032576 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032577#endif
32578
Daniel Veillard42595322004-11-08 10:52:06 +000032579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032580}
32581
32582
32583static int
32584test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032586
32587
32588 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032590}
32591
Daniel Veillarda521d282004-11-09 14:59:59 +000032592#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032593
Daniel Veillardce682bc2004-11-05 17:22:25 +000032594#define gen_nb_xmlSchemaValPtr_ptr 1
32595static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32596 return(NULL);
32597}
32598static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32599}
Daniel Veillarda521d282004-11-09 14:59:59 +000032600#endif
32601
Daniel Veillardce682bc2004-11-05 17:22:25 +000032602
Daniel Veillardd93f6252004-11-02 15:53:51 +000032603static int
32604test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032606
William M. Brack21e4ef22005-01-02 09:53:13 +000032607#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032608 int mem_base;
32609 int ret_val;
32610 xmlSchemaTypePtr type; /* the predefined type */
32611 int n_type;
32612 xmlChar * value; /* the value to check */
32613 int n_value;
32614 xmlSchemaValPtr * val; /* the return computed value */
32615 int n_val;
32616 xmlNodePtr node; /* the node containing the value */
32617 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032618
Daniel Veillardce682bc2004-11-05 17:22:25 +000032619 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32620 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32621 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32622 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32623 mem_base = xmlMemBlocks();
32624 type = gen_xmlSchemaTypePtr(n_type, 0);
32625 value = gen_const_xmlChar_ptr(n_value, 1);
32626 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32627 node = gen_xmlNodePtr(n_node, 3);
32628
William M. Brackf13f77f2004-11-12 16:03:48 +000032629 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032630 desret_int(ret_val);
32631 call_tests++;
32632 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032633 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032634 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32635 des_xmlNodePtr(n_node, node, 3);
32636 xmlResetLastError();
32637 if (mem_base != xmlMemBlocks()) {
32638 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032640 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032641 printf(" %d", n_type);
32642 printf(" %d", n_value);
32643 printf(" %d", n_val);
32644 printf(" %d", n_node);
32645 printf("\n");
32646 }
32647 }
32648 }
32649 }
32650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032651 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032652#endif
32653
Daniel Veillard42595322004-11-08 10:52:06 +000032654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032655}
32656
32657
32658static int
32659test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032661
William M. Brack21e4ef22005-01-02 09:53:13 +000032662#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032663 int mem_base;
32664 int ret_val;
32665 xmlSchemaTypePtr type; /* the predefined type */
32666 int n_type;
32667 xmlChar * value; /* the value to check */
32668 int n_value;
32669 xmlSchemaValPtr * val; /* the return computed value */
32670 int n_val;
32671 xmlNodePtr node; /* the node containing the value */
32672 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032673
Daniel Veillardce682bc2004-11-05 17:22:25 +000032674 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32675 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32676 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32677 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32678 mem_base = xmlMemBlocks();
32679 type = gen_xmlSchemaTypePtr(n_type, 0);
32680 value = gen_const_xmlChar_ptr(n_value, 1);
32681 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32682 node = gen_xmlNodePtr(n_node, 3);
32683
William M. Brackf13f77f2004-11-12 16:03:48 +000032684 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032685 desret_int(ret_val);
32686 call_tests++;
32687 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032688 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032689 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32690 des_xmlNodePtr(n_node, node, 3);
32691 xmlResetLastError();
32692 if (mem_base != xmlMemBlocks()) {
32693 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032695 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032696 printf(" %d", n_type);
32697 printf(" %d", n_value);
32698 printf(" %d", n_val);
32699 printf(" %d", n_node);
32700 printf("\n");
32701 }
32702 }
32703 }
32704 }
32705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032706 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032707#endif
32708
Daniel Veillard42595322004-11-08 10:52:06 +000032709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032710}
32711
32712
32713static int
32714test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032716
William M. Brack21e4ef22005-01-02 09:53:13 +000032717#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032718 int mem_base;
32719 int ret_val;
32720 xmlSchemaTypePtr base; /* the base type */
32721 int n_base;
32722 xmlSchemaFacetPtr facet; /* the facet to check */
32723 int n_facet;
32724 xmlChar * value; /* the lexical repr of the value to validate */
32725 int n_value;
32726 xmlSchemaValPtr val; /* the precomputed value */
32727 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032728
Daniel Veillardce682bc2004-11-05 17:22:25 +000032729 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32730 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32731 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32732 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32733 mem_base = xmlMemBlocks();
32734 base = gen_xmlSchemaTypePtr(n_base, 0);
32735 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32736 value = gen_const_xmlChar_ptr(n_value, 2);
32737 val = gen_xmlSchemaValPtr(n_val, 3);
32738
William M. Brackf13f77f2004-11-12 16:03:48 +000032739 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032740 desret_int(ret_val);
32741 call_tests++;
32742 des_xmlSchemaTypePtr(n_base, base, 0);
32743 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032744 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032745 des_xmlSchemaValPtr(n_val, val, 3);
32746 xmlResetLastError();
32747 if (mem_base != xmlMemBlocks()) {
32748 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032750 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032751 printf(" %d", n_base);
32752 printf(" %d", n_facet);
32753 printf(" %d", n_value);
32754 printf(" %d", n_val);
32755 printf("\n");
32756 }
32757 }
32758 }
32759 }
32760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032761 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032762#endif
32763
Daniel Veillard42595322004-11-08 10:52:06 +000032764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032765}
32766
32767
32768static int
32769test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032771
William M. Brack21e4ef22005-01-02 09:53:13 +000032772#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032773 int mem_base;
32774 int ret_val;
32775 xmlSchemaTypePtr type; /* the built-in type */
32776 int n_type;
32777 xmlSchemaFacetPtr facet; /* the facet to check */
32778 int n_facet;
32779 xmlChar * value; /* the lexical repr. of the value to be validated */
32780 int n_value;
32781 xmlSchemaValPtr val; /* the precomputed value */
32782 int n_val;
32783 unsigned long * length; /* the actual length of the value */
32784 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032785
Daniel Veillardce682bc2004-11-05 17:22:25 +000032786 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32787 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32788 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32789 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32790 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32791 mem_base = xmlMemBlocks();
32792 type = gen_xmlSchemaTypePtr(n_type, 0);
32793 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32794 value = gen_const_xmlChar_ptr(n_value, 2);
32795 val = gen_xmlSchemaValPtr(n_val, 3);
32796 length = gen_unsigned_long_ptr(n_length, 4);
32797
William M. Brackf13f77f2004-11-12 16:03:48 +000032798 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032799 desret_int(ret_val);
32800 call_tests++;
32801 des_xmlSchemaTypePtr(n_type, type, 0);
32802 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032803 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032804 des_xmlSchemaValPtr(n_val, val, 3);
32805 des_unsigned_long_ptr(n_length, length, 4);
32806 xmlResetLastError();
32807 if (mem_base != xmlMemBlocks()) {
32808 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032810 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032811 printf(" %d", n_type);
32812 printf(" %d", n_facet);
32813 printf(" %d", n_value);
32814 printf(" %d", n_val);
32815 printf(" %d", n_length);
32816 printf("\n");
32817 }
32818 }
32819 }
32820 }
32821 }
32822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032823 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032824#endif
32825
Daniel Veillard42595322004-11-08 10:52:06 +000032826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032827}
32828
32829
32830static int
32831test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032833
William M. Brack21e4ef22005-01-02 09:53:13 +000032834#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032835 int mem_base;
32836 int ret_val;
32837 xmlSchemaFacetPtr facet; /* the facet to check */
32838 int n_facet;
32839 xmlChar * value; /* the lexical repr of the value to validate */
32840 int n_value;
32841 unsigned long actualLen; /* the number of list items */
32842 int n_actualLen;
32843 unsigned long * expectedLen; /* the resulting expected number of list items */
32844 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032845
Daniel Veillardce682bc2004-11-05 17:22:25 +000032846 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32847 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32848 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32849 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32850 mem_base = xmlMemBlocks();
32851 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32852 value = gen_const_xmlChar_ptr(n_value, 1);
32853 actualLen = gen_unsigned_long(n_actualLen, 2);
32854 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32855
William M. Brackf13f77f2004-11-12 16:03:48 +000032856 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032857 desret_int(ret_val);
32858 call_tests++;
32859 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032860 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032861 des_unsigned_long(n_actualLen, actualLen, 2);
32862 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32863 xmlResetLastError();
32864 if (mem_base != xmlMemBlocks()) {
32865 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032867 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032868 printf(" %d", n_facet);
32869 printf(" %d", n_value);
32870 printf(" %d", n_actualLen);
32871 printf(" %d", n_expectedLen);
32872 printf("\n");
32873 }
32874 }
32875 }
32876 }
32877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032878 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032879#endif
32880
Daniel Veillard42595322004-11-08 10:52:06 +000032881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032882}
32883
32884
32885static int
32886test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032888
William M. Brack21e4ef22005-01-02 09:53:13 +000032889#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032890 int mem_base;
32891 int ret_val;
32892 xmlSchemaTypePtr type; /* the predefined type */
32893 int n_type;
32894 xmlChar * value; /* the value to check */
32895 int n_value;
32896 xmlSchemaValPtr * val; /* the return computed value */
32897 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032898
Daniel Veillardce682bc2004-11-05 17:22:25 +000032899 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32900 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32901 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32902 mem_base = xmlMemBlocks();
32903 type = gen_xmlSchemaTypePtr(n_type, 0);
32904 value = gen_const_xmlChar_ptr(n_value, 1);
32905 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32906
William M. Brackf13f77f2004-11-12 16:03:48 +000032907 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032908 desret_int(ret_val);
32909 call_tests++;
32910 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032911 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032912 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32913 xmlResetLastError();
32914 if (mem_base != xmlMemBlocks()) {
32915 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032917 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032918 printf(" %d", n_type);
32919 printf(" %d", n_value);
32920 printf(" %d", n_val);
32921 printf("\n");
32922 }
32923 }
32924 }
32925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032926 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032927#endif
32928
Daniel Veillard42595322004-11-08 10:52:06 +000032929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032930}
32931
Daniel Veillard91b955c2004-12-10 10:26:42 +000032932
32933static int
32934test_xmlSchemaWhiteSpaceReplace(void) {
32935 int test_ret = 0;
32936
William M. Brack21e4ef22005-01-02 09:53:13 +000032937#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000032938 int mem_base;
32939 xmlChar * ret_val;
32940 xmlChar * value; /* a value */
32941 int n_value;
32942
32943 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32944 mem_base = xmlMemBlocks();
32945 value = gen_const_xmlChar_ptr(n_value, 0);
32946
32947 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
32948 desret_xmlChar_ptr(ret_val);
32949 call_tests++;
32950 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
32951 xmlResetLastError();
32952 if (mem_base != xmlMemBlocks()) {
32953 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
32954 xmlMemBlocks() - mem_base);
32955 test_ret++;
32956 printf(" %d", n_value);
32957 printf("\n");
32958 }
32959 }
32960 function_tests++;
32961#endif
32962
32963 return(test_ret);
32964}
32965
Daniel Veillardd93f6252004-11-02 15:53:51 +000032966static int
32967test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032969
Daniel Veillard91b955c2004-12-10 10:26:42 +000032970 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032971 test_ret += test_xmlSchemaCheckFacet();
32972 test_ret += test_xmlSchemaCleanupTypes();
32973 test_ret += test_xmlSchemaCollapseString();
32974 test_ret += test_xmlSchemaCompareValues();
32975 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32976 test_ret += test_xmlSchemaGetBuiltInType();
32977 test_ret += test_xmlSchemaGetFacetValueAsULong();
32978 test_ret += test_xmlSchemaGetPredefinedType();
32979 test_ret += test_xmlSchemaInitTypes();
32980 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32981 test_ret += test_xmlSchemaNewFacet();
32982 test_ret += test_xmlSchemaValPredefTypeNode();
32983 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32984 test_ret += test_xmlSchemaValidateFacet();
32985 test_ret += test_xmlSchemaValidateLengthFacet();
32986 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32987 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000032988 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032989
Daniel Veillard42595322004-11-08 10:52:06 +000032990 if (test_ret != 0)
32991 printf("Module xmlschemastypes: %d errors\n", test_ret);
32992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032993}
32994
32995static int
32996test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032998
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032999 int mem_base;
33000 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033001 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033002 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033003
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033004 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033006 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033007
William M. Brackf13f77f2004-11-12 16:03:48 +000033008 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033009 desret_xmlChar_ptr(ret_val);
33010 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033011 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033012 xmlResetLastError();
33013 if (mem_base != xmlMemBlocks()) {
33014 printf("Leak of %d blocks found in xmlCharStrdup",
33015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033016 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033017 printf(" %d", n_cur);
33018 printf("\n");
33019 }
33020 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033021 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033022
Daniel Veillard42595322004-11-08 10:52:06 +000033023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033024}
33025
33026
33027static int
33028test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033030
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033031 int mem_base;
33032 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033033 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033034 int n_cur;
33035 int len; /* the len of @cur */
33036 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033037
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033038 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33039 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33040 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033041 cur = gen_const_char_ptr(n_cur, 0);
33042 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033043
William M. Brackf13f77f2004-11-12 16:03:48 +000033044 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033045 desret_xmlChar_ptr(ret_val);
33046 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033047 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033048 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033049 xmlResetLastError();
33050 if (mem_base != xmlMemBlocks()) {
33051 printf("Leak of %d blocks found in xmlCharStrndup",
33052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033053 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033054 printf(" %d", n_cur);
33055 printf(" %d", n_len);
33056 printf("\n");
33057 }
33058 }
33059 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033060 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033061
Daniel Veillard42595322004-11-08 10:52:06 +000033062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033063}
33064
33065
33066static int
33067test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033069
Daniel Veillardce682bc2004-11-05 17:22:25 +000033070 int mem_base;
33071 int ret_val;
33072 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33073 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033074
Daniel Veillardce682bc2004-11-05 17:22:25 +000033075 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33076 mem_base = xmlMemBlocks();
33077 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33078
William M. Brackf13f77f2004-11-12 16:03:48 +000033079 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033080 desret_int(ret_val);
33081 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033082 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033083 xmlResetLastError();
33084 if (mem_base != xmlMemBlocks()) {
33085 printf("Leak of %d blocks found in xmlCheckUTF8",
33086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033087 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033088 printf(" %d", n_utf);
33089 printf("\n");
33090 }
33091 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033093
Daniel Veillard42595322004-11-08 10:52:06 +000033094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033095}
33096
33097
33098static int
33099test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033101
Daniel Veillardce682bc2004-11-05 17:22:25 +000033102 int mem_base;
33103 int ret_val;
33104 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33105 int n_utf;
33106 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. */
33107 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033108
Daniel Veillardce682bc2004-11-05 17:22:25 +000033109 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33110 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33111 mem_base = xmlMemBlocks();
33112 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33113 len = gen_int_ptr(n_len, 1);
33114
William M. Brackf13f77f2004-11-12 16:03:48 +000033115 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033116 desret_int(ret_val);
33117 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033118 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033119 des_int_ptr(n_len, len, 1);
33120 xmlResetLastError();
33121 if (mem_base != xmlMemBlocks()) {
33122 printf("Leak of %d blocks found in xmlGetUTF8Char",
33123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033124 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033125 printf(" %d", n_utf);
33126 printf(" %d", n_len);
33127 printf("\n");
33128 }
33129 }
33130 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033131 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033132
Daniel Veillard42595322004-11-08 10:52:06 +000033133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033134}
33135
33136
33137static int
33138test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033140
33141 int mem_base;
33142 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033143 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033144 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033145 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033146 int n_str2;
33147
33148 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33149 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33150 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033151 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33152 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033153
William M. Brackf13f77f2004-11-12 16:03:48 +000033154 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033155 desret_int(ret_val);
33156 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033157 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33158 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033159 xmlResetLastError();
33160 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033161 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033163 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033164 printf(" %d", n_str1);
33165 printf(" %d", n_str2);
33166 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033167 }
33168 }
33169 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033171
Daniel Veillard42595322004-11-08 10:52:06 +000033172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033173}
33174
33175
33176static int
33177test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033179
33180
33181 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033183}
33184
33185
33186static int
33187test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033189
33190 int mem_base;
33191 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033192 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033193 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033194 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033195 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033196 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033197 int n_str;
33198
33199 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33200 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33201 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33202 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033203 pref = gen_const_xmlChar_ptr(n_pref, 0);
33204 name = gen_const_xmlChar_ptr(n_name, 1);
33205 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033206
William M. Brackf13f77f2004-11-12 16:03:48 +000033207 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033208 desret_int(ret_val);
33209 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033210 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33211 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33212 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033213 xmlResetLastError();
33214 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033215 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033217 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033218 printf(" %d", n_pref);
33219 printf(" %d", n_name);
33220 printf(" %d", n_str);
33221 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033222 }
33223 }
33224 }
33225 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033226 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033227
Daniel Veillard42595322004-11-08 10:52:06 +000033228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033229}
33230
33231
33232static int
33233test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033235
33236
33237 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033239}
33240
33241
33242static int
33243test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033245
33246 int mem_base;
33247 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033248 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033249 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033250 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033251 int n_str2;
33252
33253 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33254 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33255 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033256 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33257 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033258
William M. Brackf13f77f2004-11-12 16:03:48 +000033259 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033260 desret_int(ret_val);
33261 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033262 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33263 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033264 xmlResetLastError();
33265 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033266 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033268 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033269 printf(" %d", n_str1);
33270 printf(" %d", n_str2);
33271 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033272 }
33273 }
33274 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033276
Daniel Veillard42595322004-11-08 10:52:06 +000033277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033278}
33279
33280
33281static int
33282test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033284
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033285 int mem_base;
33286 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033287 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033288 int n_str;
33289 xmlChar * val; /* the xmlChar to search (needle) */
33290 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033291
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033292 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33293 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033295 str = gen_const_xmlChar_ptr(n_str, 0);
33296 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033297
William M. Brackf13f77f2004-11-12 16:03:48 +000033298 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033299 desret_const_xmlChar_ptr(ret_val);
33300 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033301 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033302 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033303 xmlResetLastError();
33304 if (mem_base != xmlMemBlocks()) {
33305 printf("Leak of %d blocks found in xmlStrcasestr",
33306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033307 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033308 printf(" %d", n_str);
33309 printf(" %d", n_val);
33310 printf("\n");
33311 }
33312 }
33313 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033314 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033315
Daniel Veillard42595322004-11-08 10:52:06 +000033316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033317}
33318
33319
33320static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033321test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033323
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033324 int mem_base;
33325 const xmlChar * ret_val;
33326 xmlChar * str; /* the xmlChar * array */
33327 int n_str;
33328 xmlChar val; /* the xmlChar to search */
33329 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033330
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033331 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33332 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33333 mem_base = xmlMemBlocks();
33334 str = gen_const_xmlChar_ptr(n_str, 0);
33335 val = gen_xmlChar(n_val, 1);
33336
William M. Brackf13f77f2004-11-12 16:03:48 +000033337 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033338 desret_const_xmlChar_ptr(ret_val);
33339 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033340 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033341 des_xmlChar(n_val, val, 1);
33342 xmlResetLastError();
33343 if (mem_base != xmlMemBlocks()) {
33344 printf("Leak of %d blocks found in xmlStrchr",
33345 xmlMemBlocks() - mem_base);
33346 test_ret++;
33347 printf(" %d", n_str);
33348 printf(" %d", n_val);
33349 printf("\n");
33350 }
33351 }
33352 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033353 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033354
Daniel Veillard42595322004-11-08 10:52:06 +000033355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033356}
33357
33358
33359static int
33360test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033362
33363 int mem_base;
33364 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033365 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033366 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033367 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033368 int n_str2;
33369
33370 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33371 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033373 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33374 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033375
William M. Brackf13f77f2004-11-12 16:03:48 +000033376 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033377 desret_int(ret_val);
33378 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033379 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33380 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033381 xmlResetLastError();
33382 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033383 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033385 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033386 printf(" %d", n_str1);
33387 printf(" %d", n_str2);
33388 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033389 }
33390 }
33391 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033393
Daniel Veillard42595322004-11-08 10:52:06 +000033394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033395}
33396
33397
33398static int
33399test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033401
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033402 int mem_base;
33403 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033404 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033405 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033406
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033407 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33408 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033409 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033410
William M. Brackf13f77f2004-11-12 16:03:48 +000033411 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033412 desret_xmlChar_ptr(ret_val);
33413 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033414 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033415 xmlResetLastError();
33416 if (mem_base != xmlMemBlocks()) {
33417 printf("Leak of %d blocks found in xmlStrdup",
33418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033419 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033420 printf(" %d", n_cur);
33421 printf("\n");
33422 }
33423 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033425
Daniel Veillard42595322004-11-08 10:52:06 +000033426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033427}
33428
33429
33430static int
33431test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033433
33434 int mem_base;
33435 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033436 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033437 int n_str;
33438
33439 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33440 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033441 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033442
William M. Brackf13f77f2004-11-12 16:03:48 +000033443 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033444 desret_int(ret_val);
33445 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033446 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033447 xmlResetLastError();
33448 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033449 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033451 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033452 printf(" %d", n_str);
33453 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033454 }
33455 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033456 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033457
Daniel Veillard42595322004-11-08 10:52:06 +000033458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033459}
33460
33461
33462static int
33463test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033465
33466 int mem_base;
33467 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033468 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033469 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033470 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033471 int n_str2;
33472 int len; /* the max comparison length */
33473 int n_len;
33474
33475 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33476 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33477 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33478 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033479 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33480 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33481 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033482
William M. Brackf13f77f2004-11-12 16:03:48 +000033483 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033484 desret_int(ret_val);
33485 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033486 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33487 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033488 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033489 xmlResetLastError();
33490 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033491 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033493 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033494 printf(" %d", n_str1);
33495 printf(" %d", n_str2);
33496 printf(" %d", n_len);
33497 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033498 }
33499 }
33500 }
33501 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033502 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033503
Daniel Veillard42595322004-11-08 10:52:06 +000033504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033505}
33506
33507
33508static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033509test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033511
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033512 int mem_base;
33513 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033514 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033515 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033516 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033517 int n_str2;
33518 int len; /* the len of @str2 */
33519 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033520
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033521 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33522 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33523 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33524 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033525 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33526 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33527 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033528
William M. Brackf13f77f2004-11-12 16:03:48 +000033529 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033530 desret_xmlChar_ptr(ret_val);
33531 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033532 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33533 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033534 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033535 xmlResetLastError();
33536 if (mem_base != xmlMemBlocks()) {
33537 printf("Leak of %d blocks found in xmlStrncatNew",
33538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033539 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033540 printf(" %d", n_str1);
33541 printf(" %d", n_str2);
33542 printf(" %d", n_len);
33543 printf("\n");
33544 }
33545 }
33546 }
33547 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033548 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033549
Daniel Veillard42595322004-11-08 10:52:06 +000033550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033551}
33552
33553
33554static int
33555test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033557
33558 int mem_base;
33559 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033560 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033561 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033562 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033563 int n_str2;
33564 int len; /* the max comparison length */
33565 int n_len;
33566
33567 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33568 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33569 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33570 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033571 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33572 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33573 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033574
William M. Brackf13f77f2004-11-12 16:03:48 +000033575 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033576 desret_int(ret_val);
33577 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033578 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33579 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033580 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033581 xmlResetLastError();
33582 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033583 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033585 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033586 printf(" %d", n_str1);
33587 printf(" %d", n_str2);
33588 printf(" %d", n_len);
33589 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033590 }
33591 }
33592 }
33593 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033594 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033595
Daniel Veillard42595322004-11-08 10:52:06 +000033596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033597}
33598
33599
33600static int
33601test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033603
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033604 int mem_base;
33605 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033606 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033607 int n_cur;
33608 int len; /* the len of @cur */
33609 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033610
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033611 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33612 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033614 cur = gen_const_xmlChar_ptr(n_cur, 0);
33615 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033616
William M. Brackf13f77f2004-11-12 16:03:48 +000033617 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033618 desret_xmlChar_ptr(ret_val);
33619 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033620 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033621 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033622 xmlResetLastError();
33623 if (mem_base != xmlMemBlocks()) {
33624 printf("Leak of %d blocks found in xmlStrndup",
33625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033626 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033627 printf(" %d", n_cur);
33628 printf(" %d", n_len);
33629 printf("\n");
33630 }
33631 }
33632 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033633 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033634
Daniel Veillard42595322004-11-08 10:52:06 +000033635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033636}
33637
33638
33639static int
33640test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033642
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033643 int mem_base;
33644 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033645 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033646 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033647 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033648 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033649
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033650 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33651 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33652 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033653 str = gen_const_xmlChar_ptr(n_str, 0);
33654 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033655
William M. Brackf13f77f2004-11-12 16:03:48 +000033656 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033657 desret_const_xmlChar_ptr(ret_val);
33658 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033659 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33660 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033661 xmlResetLastError();
33662 if (mem_base != xmlMemBlocks()) {
33663 printf("Leak of %d blocks found in xmlStrstr",
33664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033665 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033666 printf(" %d", n_str);
33667 printf(" %d", n_val);
33668 printf("\n");
33669 }
33670 }
33671 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033673
Daniel Veillard42595322004-11-08 10:52:06 +000033674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033675}
33676
33677
33678static int
33679test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033681
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033682 int mem_base;
33683 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033684 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033685 int n_str;
33686 int start; /* the index of the first char (zero based) */
33687 int n_start;
33688 int len; /* the length of the substring */
33689 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033690
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033691 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33692 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33693 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33694 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033695 str = gen_const_xmlChar_ptr(n_str, 0);
33696 start = gen_int(n_start, 1);
33697 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033698
William M. Brackf13f77f2004-11-12 16:03:48 +000033699 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033700 desret_xmlChar_ptr(ret_val);
33701 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033702 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033703 des_int(n_start, start, 1);
33704 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033705 xmlResetLastError();
33706 if (mem_base != xmlMemBlocks()) {
33707 printf("Leak of %d blocks found in xmlStrsub",
33708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033709 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033710 printf(" %d", n_str);
33711 printf(" %d", n_start);
33712 printf(" %d", n_len);
33713 printf("\n");
33714 }
33715 }
33716 }
33717 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033718 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033719
Daniel Veillard42595322004-11-08 10:52:06 +000033720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033721}
33722
33723
33724static int
33725test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033727
33728 int mem_base;
33729 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033730 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033731 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033732 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033733 int n_utf2;
33734
33735 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33736 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033738 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33739 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033740
William M. Brackf13f77f2004-11-12 16:03:48 +000033741 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033742 desret_int(ret_val);
33743 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033744 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33745 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033746 xmlResetLastError();
33747 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033748 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033750 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033751 printf(" %d", n_utf1);
33752 printf(" %d", n_utf2);
33753 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033754 }
33755 }
33756 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033757 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033758
Daniel Veillard42595322004-11-08 10:52:06 +000033759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033760}
33761
33762
33763static int
33764test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033766
33767 int mem_base;
33768 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033769 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033770 int n_utf;
33771
33772 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033774 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033775
William M. Brackf13f77f2004-11-12 16:03:48 +000033776 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033777 desret_int(ret_val);
33778 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033779 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033780 xmlResetLastError();
33781 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033782 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033784 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033785 printf(" %d", n_utf);
33786 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033787 }
33788 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033789 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033790
Daniel Veillard42595322004-11-08 10:52:06 +000033791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033792}
33793
33794
33795static int
33796test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033798
33799 int mem_base;
33800 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033801 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033802 int n_utf;
33803
33804 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033806 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033807
William M. Brackf13f77f2004-11-12 16:03:48 +000033808 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033809 desret_int(ret_val);
33810 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033811 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033812 xmlResetLastError();
33813 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033814 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033816 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033817 printf(" %d", n_utf);
33818 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033819 }
33820 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033821 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033822
Daniel Veillard42595322004-11-08 10:52:06 +000033823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033824}
33825
33826
33827static int
33828test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033830
33831 int mem_base;
33832 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033833 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033834 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033835 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033836 int n_utfchar;
33837
33838 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33839 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33840 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033841 utf = gen_const_xmlChar_ptr(n_utf, 0);
33842 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033843
William M. Brackf13f77f2004-11-12 16:03:48 +000033844 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033845 desret_int(ret_val);
33846 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033847 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
33848 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033849 xmlResetLastError();
33850 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033851 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033853 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033854 printf(" %d", n_utf);
33855 printf(" %d", n_utfchar);
33856 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033857 }
33858 }
33859 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033860 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033861
Daniel Veillard42595322004-11-08 10:52:06 +000033862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033863}
33864
33865
33866static int
33867test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033869
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033870 int mem_base;
33871 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033872 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033873 int n_utf;
33874 int len; /* the len of @utf (in chars) */
33875 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033876
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033877 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33878 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033880 utf = gen_const_xmlChar_ptr(n_utf, 0);
33881 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033882
William M. Brackf13f77f2004-11-12 16:03:48 +000033883 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033884 desret_xmlChar_ptr(ret_val);
33885 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033886 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033887 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033888 xmlResetLastError();
33889 if (mem_base != xmlMemBlocks()) {
33890 printf("Leak of %d blocks found in xmlUTF8Strndup",
33891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033892 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033893 printf(" %d", n_utf);
33894 printf(" %d", n_len);
33895 printf("\n");
33896 }
33897 }
33898 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033899 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033900
Daniel Veillard42595322004-11-08 10:52:06 +000033901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033902}
33903
33904
33905static int
33906test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033908
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033909 int mem_base;
33910 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033911 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033912 int n_utf;
33913 int pos; /* the position of the desired UTF8 char (in chars) */
33914 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033915
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033916 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33917 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033919 utf = gen_const_xmlChar_ptr(n_utf, 0);
33920 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033921
William M. Brackf13f77f2004-11-12 16:03:48 +000033922 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033923 desret_const_xmlChar_ptr(ret_val);
33924 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033925 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033926 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033927 xmlResetLastError();
33928 if (mem_base != xmlMemBlocks()) {
33929 printf("Leak of %d blocks found in xmlUTF8Strpos",
33930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033931 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033932 printf(" %d", n_utf);
33933 printf(" %d", n_pos);
33934 printf("\n");
33935 }
33936 }
33937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033939
Daniel Veillard42595322004-11-08 10:52:06 +000033940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033941}
33942
33943
33944static int
33945test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033947
33948 int mem_base;
33949 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033950 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033951 int n_utf;
33952 int len; /* the number of characters in the array */
33953 int n_len;
33954
33955 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33956 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033958 utf = gen_const_xmlChar_ptr(n_utf, 0);
33959 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033960
William M. Brackf13f77f2004-11-12 16:03:48 +000033961 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033962 desret_int(ret_val);
33963 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033964 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033965 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033966 xmlResetLastError();
33967 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033968 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033970 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033971 printf(" %d", n_utf);
33972 printf(" %d", n_len);
33973 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033974 }
33975 }
33976 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033978
Daniel Veillard42595322004-11-08 10:52:06 +000033979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033980}
33981
33982
33983static int
33984test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033986
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033987 int mem_base;
33988 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033989 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033990 int n_utf;
33991 int start; /* relative pos of first char */
33992 int n_start;
33993 int len; /* total number to copy */
33994 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033995
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033996 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33997 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33998 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33999 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034000 utf = gen_const_xmlChar_ptr(n_utf, 0);
34001 start = gen_int(n_start, 1);
34002 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034003
William M. Brackf13f77f2004-11-12 16:03:48 +000034004 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034005 desret_xmlChar_ptr(ret_val);
34006 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034007 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034008 des_int(n_start, start, 1);
34009 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034010 xmlResetLastError();
34011 if (mem_base != xmlMemBlocks()) {
34012 printf("Leak of %d blocks found in xmlUTF8Strsub",
34013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034014 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034015 printf(" %d", n_utf);
34016 printf(" %d", n_start);
34017 printf(" %d", n_len);
34018 printf("\n");
34019 }
34020 }
34021 }
34022 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034023 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034024
Daniel Veillard42595322004-11-08 10:52:06 +000034025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034026}
34027
34028static int
34029test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034031
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034032 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034033 test_ret += test_xmlCharStrdup();
34034 test_ret += test_xmlCharStrndup();
34035 test_ret += test_xmlCheckUTF8();
34036 test_ret += test_xmlGetUTF8Char();
34037 test_ret += test_xmlStrEqual();
34038 test_ret += test_xmlStrPrintf();
34039 test_ret += test_xmlStrQEqual();
34040 test_ret += test_xmlStrVPrintf();
34041 test_ret += test_xmlStrcasecmp();
34042 test_ret += test_xmlStrcasestr();
34043 test_ret += test_xmlStrchr();
34044 test_ret += test_xmlStrcmp();
34045 test_ret += test_xmlStrdup();
34046 test_ret += test_xmlStrlen();
34047 test_ret += test_xmlStrncasecmp();
34048 test_ret += test_xmlStrncatNew();
34049 test_ret += test_xmlStrncmp();
34050 test_ret += test_xmlStrndup();
34051 test_ret += test_xmlStrstr();
34052 test_ret += test_xmlStrsub();
34053 test_ret += test_xmlUTF8Charcmp();
34054 test_ret += test_xmlUTF8Size();
34055 test_ret += test_xmlUTF8Strlen();
34056 test_ret += test_xmlUTF8Strloc();
34057 test_ret += test_xmlUTF8Strndup();
34058 test_ret += test_xmlUTF8Strpos();
34059 test_ret += test_xmlUTF8Strsize();
34060 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034061
Daniel Veillard42595322004-11-08 10:52:06 +000034062 if (test_ret != 0)
34063 printf("Module xmlstring: %d errors\n", test_ret);
34064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034065}
34066
34067static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034068test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034069 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034070
William M. Brack21e4ef22005-01-02 09:53:13 +000034071#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034072 int mem_base;
34073 int ret_val;
34074 int code; /* UCS code point */
34075 int n_code;
34076
34077 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34078 mem_base = xmlMemBlocks();
34079 code = gen_int(n_code, 0);
34080
34081 ret_val = xmlUCSIsAegeanNumbers(code);
34082 desret_int(ret_val);
34083 call_tests++;
34084 des_int(n_code, code, 0);
34085 xmlResetLastError();
34086 if (mem_base != xmlMemBlocks()) {
34087 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034089 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034090 printf(" %d", n_code);
34091 printf("\n");
34092 }
34093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034094 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034095#endif
34096
Daniel Veillard42595322004-11-08 10:52:06 +000034097 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034098}
34099
34100
34101static int
34102test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034103 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034104
William M. Brack21e4ef22005-01-02 09:53:13 +000034105#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034106 int mem_base;
34107 int ret_val;
34108 int code; /* UCS code point */
34109 int n_code;
34110
34111 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34112 mem_base = xmlMemBlocks();
34113 code = gen_int(n_code, 0);
34114
34115 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34116 desret_int(ret_val);
34117 call_tests++;
34118 des_int(n_code, code, 0);
34119 xmlResetLastError();
34120 if (mem_base != xmlMemBlocks()) {
34121 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034123 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034124 printf(" %d", n_code);
34125 printf("\n");
34126 }
34127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034128 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034129#endif
34130
Daniel Veillard42595322004-11-08 10:52:06 +000034131 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034132}
34133
34134
34135static int
34136test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034137 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034138
William M. Brack21e4ef22005-01-02 09:53:13 +000034139#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034140 int mem_base;
34141 int ret_val;
34142 int code; /* UCS code point */
34143 int n_code;
34144
34145 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34146 mem_base = xmlMemBlocks();
34147 code = gen_int(n_code, 0);
34148
34149 ret_val = xmlUCSIsArabic(code);
34150 desret_int(ret_val);
34151 call_tests++;
34152 des_int(n_code, code, 0);
34153 xmlResetLastError();
34154 if (mem_base != xmlMemBlocks()) {
34155 printf("Leak of %d blocks found in xmlUCSIsArabic",
34156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034157 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034158 printf(" %d", n_code);
34159 printf("\n");
34160 }
34161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034162 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034163#endif
34164
Daniel Veillard42595322004-11-08 10:52:06 +000034165 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034166}
34167
34168
34169static int
34170test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034171 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034172
William M. Brack21e4ef22005-01-02 09:53:13 +000034173#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034174 int mem_base;
34175 int ret_val;
34176 int code; /* UCS code point */
34177 int n_code;
34178
34179 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34180 mem_base = xmlMemBlocks();
34181 code = gen_int(n_code, 0);
34182
34183 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34184 desret_int(ret_val);
34185 call_tests++;
34186 des_int(n_code, code, 0);
34187 xmlResetLastError();
34188 if (mem_base != xmlMemBlocks()) {
34189 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034191 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034192 printf(" %d", n_code);
34193 printf("\n");
34194 }
34195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034196 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034197#endif
34198
Daniel Veillard42595322004-11-08 10:52:06 +000034199 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034200}
34201
34202
34203static int
34204test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034205 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034206
William M. Brack21e4ef22005-01-02 09:53:13 +000034207#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034208 int mem_base;
34209 int ret_val;
34210 int code; /* UCS code point */
34211 int n_code;
34212
34213 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34214 mem_base = xmlMemBlocks();
34215 code = gen_int(n_code, 0);
34216
34217 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34218 desret_int(ret_val);
34219 call_tests++;
34220 des_int(n_code, code, 0);
34221 xmlResetLastError();
34222 if (mem_base != xmlMemBlocks()) {
34223 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034225 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034226 printf(" %d", n_code);
34227 printf("\n");
34228 }
34229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034230 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034231#endif
34232
Daniel Veillard42595322004-11-08 10:52:06 +000034233 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034234}
34235
34236
34237static int
34238test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034239 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034240
William M. Brack21e4ef22005-01-02 09:53:13 +000034241#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034242 int mem_base;
34243 int ret_val;
34244 int code; /* UCS code point */
34245 int n_code;
34246
34247 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34248 mem_base = xmlMemBlocks();
34249 code = gen_int(n_code, 0);
34250
34251 ret_val = xmlUCSIsArmenian(code);
34252 desret_int(ret_val);
34253 call_tests++;
34254 des_int(n_code, code, 0);
34255 xmlResetLastError();
34256 if (mem_base != xmlMemBlocks()) {
34257 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034259 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034260 printf(" %d", n_code);
34261 printf("\n");
34262 }
34263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034264 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034265#endif
34266
Daniel Veillard42595322004-11-08 10:52:06 +000034267 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034268}
34269
34270
34271static int
34272test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034273 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034274
William M. Brack21e4ef22005-01-02 09:53:13 +000034275#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034276 int mem_base;
34277 int ret_val;
34278 int code; /* UCS code point */
34279 int n_code;
34280
34281 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34282 mem_base = xmlMemBlocks();
34283 code = gen_int(n_code, 0);
34284
34285 ret_val = xmlUCSIsArrows(code);
34286 desret_int(ret_val);
34287 call_tests++;
34288 des_int(n_code, code, 0);
34289 xmlResetLastError();
34290 if (mem_base != xmlMemBlocks()) {
34291 printf("Leak of %d blocks found in xmlUCSIsArrows",
34292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034293 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034294 printf(" %d", n_code);
34295 printf("\n");
34296 }
34297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034298 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034299#endif
34300
Daniel Veillard42595322004-11-08 10:52:06 +000034301 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034302}
34303
34304
34305static int
34306test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034307 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034308
William M. Brack21e4ef22005-01-02 09:53:13 +000034309#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034310 int mem_base;
34311 int ret_val;
34312 int code; /* UCS code point */
34313 int n_code;
34314
34315 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34316 mem_base = xmlMemBlocks();
34317 code = gen_int(n_code, 0);
34318
34319 ret_val = xmlUCSIsBasicLatin(code);
34320 desret_int(ret_val);
34321 call_tests++;
34322 des_int(n_code, code, 0);
34323 xmlResetLastError();
34324 if (mem_base != xmlMemBlocks()) {
34325 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034327 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034328 printf(" %d", n_code);
34329 printf("\n");
34330 }
34331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034332 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034333#endif
34334
Daniel Veillard42595322004-11-08 10:52:06 +000034335 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034336}
34337
34338
34339static int
34340test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034341 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034342
William M. Brack21e4ef22005-01-02 09:53:13 +000034343#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034344 int mem_base;
34345 int ret_val;
34346 int code; /* UCS code point */
34347 int n_code;
34348
34349 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34350 mem_base = xmlMemBlocks();
34351 code = gen_int(n_code, 0);
34352
34353 ret_val = xmlUCSIsBengali(code);
34354 desret_int(ret_val);
34355 call_tests++;
34356 des_int(n_code, code, 0);
34357 xmlResetLastError();
34358 if (mem_base != xmlMemBlocks()) {
34359 printf("Leak of %d blocks found in xmlUCSIsBengali",
34360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034361 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034362 printf(" %d", n_code);
34363 printf("\n");
34364 }
34365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034366 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034367#endif
34368
Daniel Veillard42595322004-11-08 10:52:06 +000034369 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034370}
34371
34372
34373static int
34374test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034375 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034376
William M. Brack21e4ef22005-01-02 09:53:13 +000034377#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034378 int mem_base;
34379 int ret_val;
34380 int code; /* UCS code point */
34381 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034382 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034383 int n_block;
34384
34385 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34386 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34387 mem_base = xmlMemBlocks();
34388 code = gen_int(n_code, 0);
34389 block = gen_const_char_ptr(n_block, 1);
34390
William M. Brackf13f77f2004-11-12 16:03:48 +000034391 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034392 desret_int(ret_val);
34393 call_tests++;
34394 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034395 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034396 xmlResetLastError();
34397 if (mem_base != xmlMemBlocks()) {
34398 printf("Leak of %d blocks found in xmlUCSIsBlock",
34399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034400 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034401 printf(" %d", n_code);
34402 printf(" %d", n_block);
34403 printf("\n");
34404 }
34405 }
34406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034407 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034408#endif
34409
Daniel Veillard42595322004-11-08 10:52:06 +000034410 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034411}
34412
34413
34414static int
34415test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034416 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034417
William M. Brack21e4ef22005-01-02 09:53:13 +000034418#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034419 int mem_base;
34420 int ret_val;
34421 int code; /* UCS code point */
34422 int n_code;
34423
34424 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34425 mem_base = xmlMemBlocks();
34426 code = gen_int(n_code, 0);
34427
34428 ret_val = xmlUCSIsBlockElements(code);
34429 desret_int(ret_val);
34430 call_tests++;
34431 des_int(n_code, code, 0);
34432 xmlResetLastError();
34433 if (mem_base != xmlMemBlocks()) {
34434 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034436 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034437 printf(" %d", n_code);
34438 printf("\n");
34439 }
34440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034441 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034442#endif
34443
Daniel Veillard42595322004-11-08 10:52:06 +000034444 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034445}
34446
34447
34448static int
34449test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034450 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034451
William M. Brack21e4ef22005-01-02 09:53:13 +000034452#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034453 int mem_base;
34454 int ret_val;
34455 int code; /* UCS code point */
34456 int n_code;
34457
34458 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34459 mem_base = xmlMemBlocks();
34460 code = gen_int(n_code, 0);
34461
34462 ret_val = xmlUCSIsBopomofo(code);
34463 desret_int(ret_val);
34464 call_tests++;
34465 des_int(n_code, code, 0);
34466 xmlResetLastError();
34467 if (mem_base != xmlMemBlocks()) {
34468 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034470 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034471 printf(" %d", n_code);
34472 printf("\n");
34473 }
34474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034475 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034476#endif
34477
Daniel Veillard42595322004-11-08 10:52:06 +000034478 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034479}
34480
34481
34482static int
34483test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034484 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034485
William M. Brack21e4ef22005-01-02 09:53:13 +000034486#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034487 int mem_base;
34488 int ret_val;
34489 int code; /* UCS code point */
34490 int n_code;
34491
34492 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34493 mem_base = xmlMemBlocks();
34494 code = gen_int(n_code, 0);
34495
34496 ret_val = xmlUCSIsBopomofoExtended(code);
34497 desret_int(ret_val);
34498 call_tests++;
34499 des_int(n_code, code, 0);
34500 xmlResetLastError();
34501 if (mem_base != xmlMemBlocks()) {
34502 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034504 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034505 printf(" %d", n_code);
34506 printf("\n");
34507 }
34508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034509 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034510#endif
34511
Daniel Veillard42595322004-11-08 10:52:06 +000034512 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034513}
34514
34515
34516static int
34517test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034518 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034519
William M. Brack21e4ef22005-01-02 09:53:13 +000034520#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034521 int mem_base;
34522 int ret_val;
34523 int code; /* UCS code point */
34524 int n_code;
34525
34526 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34527 mem_base = xmlMemBlocks();
34528 code = gen_int(n_code, 0);
34529
34530 ret_val = xmlUCSIsBoxDrawing(code);
34531 desret_int(ret_val);
34532 call_tests++;
34533 des_int(n_code, code, 0);
34534 xmlResetLastError();
34535 if (mem_base != xmlMemBlocks()) {
34536 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034538 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034539 printf(" %d", n_code);
34540 printf("\n");
34541 }
34542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034543 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034544#endif
34545
Daniel Veillard42595322004-11-08 10:52:06 +000034546 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034547}
34548
34549
34550static int
34551test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034552 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034553
William M. Brack21e4ef22005-01-02 09:53:13 +000034554#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034555 int mem_base;
34556 int ret_val;
34557 int code; /* UCS code point */
34558 int n_code;
34559
34560 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34561 mem_base = xmlMemBlocks();
34562 code = gen_int(n_code, 0);
34563
34564 ret_val = xmlUCSIsBraillePatterns(code);
34565 desret_int(ret_val);
34566 call_tests++;
34567 des_int(n_code, code, 0);
34568 xmlResetLastError();
34569 if (mem_base != xmlMemBlocks()) {
34570 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034572 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034573 printf(" %d", n_code);
34574 printf("\n");
34575 }
34576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034577 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034578#endif
34579
Daniel Veillard42595322004-11-08 10:52:06 +000034580 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034581}
34582
34583
34584static int
34585test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034586 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034587
William M. Brack21e4ef22005-01-02 09:53:13 +000034588#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034589 int mem_base;
34590 int ret_val;
34591 int code; /* UCS code point */
34592 int n_code;
34593
34594 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34595 mem_base = xmlMemBlocks();
34596 code = gen_int(n_code, 0);
34597
34598 ret_val = xmlUCSIsBuhid(code);
34599 desret_int(ret_val);
34600 call_tests++;
34601 des_int(n_code, code, 0);
34602 xmlResetLastError();
34603 if (mem_base != xmlMemBlocks()) {
34604 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034606 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034607 printf(" %d", n_code);
34608 printf("\n");
34609 }
34610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034611 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034612#endif
34613
Daniel Veillard42595322004-11-08 10:52:06 +000034614 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034615}
34616
34617
34618static int
34619test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034620 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034621
William M. Brack21e4ef22005-01-02 09:53:13 +000034622#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034623 int mem_base;
34624 int ret_val;
34625 int code; /* UCS code point */
34626 int n_code;
34627
34628 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34629 mem_base = xmlMemBlocks();
34630 code = gen_int(n_code, 0);
34631
34632 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34633 desret_int(ret_val);
34634 call_tests++;
34635 des_int(n_code, code, 0);
34636 xmlResetLastError();
34637 if (mem_base != xmlMemBlocks()) {
34638 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034640 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034641 printf(" %d", n_code);
34642 printf("\n");
34643 }
34644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034645 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034646#endif
34647
Daniel Veillard42595322004-11-08 10:52:06 +000034648 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034649}
34650
34651
34652static int
34653test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034654 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034655
William M. Brack21e4ef22005-01-02 09:53:13 +000034656#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034657 int mem_base;
34658 int ret_val;
34659 int code; /* UCS code point */
34660 int n_code;
34661
34662 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34663 mem_base = xmlMemBlocks();
34664 code = gen_int(n_code, 0);
34665
34666 ret_val = xmlUCSIsCJKCompatibility(code);
34667 desret_int(ret_val);
34668 call_tests++;
34669 des_int(n_code, code, 0);
34670 xmlResetLastError();
34671 if (mem_base != xmlMemBlocks()) {
34672 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034674 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034675 printf(" %d", n_code);
34676 printf("\n");
34677 }
34678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034679 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034680#endif
34681
Daniel Veillard42595322004-11-08 10:52:06 +000034682 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034683}
34684
34685
34686static int
34687test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034688 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034689
William M. Brack21e4ef22005-01-02 09:53:13 +000034690#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034691 int mem_base;
34692 int ret_val;
34693 int code; /* UCS code point */
34694 int n_code;
34695
34696 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34697 mem_base = xmlMemBlocks();
34698 code = gen_int(n_code, 0);
34699
34700 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34701 desret_int(ret_val);
34702 call_tests++;
34703 des_int(n_code, code, 0);
34704 xmlResetLastError();
34705 if (mem_base != xmlMemBlocks()) {
34706 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034708 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034709 printf(" %d", n_code);
34710 printf("\n");
34711 }
34712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034713 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034714#endif
34715
Daniel Veillard42595322004-11-08 10:52:06 +000034716 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034717}
34718
34719
34720static int
34721test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034722 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034723
William M. Brack21e4ef22005-01-02 09:53:13 +000034724#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034725 int mem_base;
34726 int ret_val;
34727 int code; /* UCS code point */
34728 int n_code;
34729
34730 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34731 mem_base = xmlMemBlocks();
34732 code = gen_int(n_code, 0);
34733
34734 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34735 desret_int(ret_val);
34736 call_tests++;
34737 des_int(n_code, code, 0);
34738 xmlResetLastError();
34739 if (mem_base != xmlMemBlocks()) {
34740 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034742 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034743 printf(" %d", n_code);
34744 printf("\n");
34745 }
34746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034747 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034748#endif
34749
Daniel Veillard42595322004-11-08 10:52:06 +000034750 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034751}
34752
34753
34754static int
34755test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034756 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034757
William M. Brack21e4ef22005-01-02 09:53:13 +000034758#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034759 int mem_base;
34760 int ret_val;
34761 int code; /* UCS code point */
34762 int n_code;
34763
34764 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34765 mem_base = xmlMemBlocks();
34766 code = gen_int(n_code, 0);
34767
34768 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34769 desret_int(ret_val);
34770 call_tests++;
34771 des_int(n_code, code, 0);
34772 xmlResetLastError();
34773 if (mem_base != xmlMemBlocks()) {
34774 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034776 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034777 printf(" %d", n_code);
34778 printf("\n");
34779 }
34780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034781 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034782#endif
34783
Daniel Veillard42595322004-11-08 10:52:06 +000034784 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034785}
34786
34787
34788static int
34789test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034790 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034791
William M. Brack21e4ef22005-01-02 09:53:13 +000034792#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034793 int mem_base;
34794 int ret_val;
34795 int code; /* UCS code point */
34796 int n_code;
34797
34798 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34799 mem_base = xmlMemBlocks();
34800 code = gen_int(n_code, 0);
34801
34802 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34803 desret_int(ret_val);
34804 call_tests++;
34805 des_int(n_code, code, 0);
34806 xmlResetLastError();
34807 if (mem_base != xmlMemBlocks()) {
34808 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034810 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034811 printf(" %d", n_code);
34812 printf("\n");
34813 }
34814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034815 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034816#endif
34817
Daniel Veillard42595322004-11-08 10:52:06 +000034818 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034819}
34820
34821
34822static int
34823test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034824 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034825
William M. Brack21e4ef22005-01-02 09:53:13 +000034826#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034827 int mem_base;
34828 int ret_val;
34829 int code; /* UCS code point */
34830 int n_code;
34831
34832 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34833 mem_base = xmlMemBlocks();
34834 code = gen_int(n_code, 0);
34835
34836 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34837 desret_int(ret_val);
34838 call_tests++;
34839 des_int(n_code, code, 0);
34840 xmlResetLastError();
34841 if (mem_base != xmlMemBlocks()) {
34842 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034844 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034845 printf(" %d", n_code);
34846 printf("\n");
34847 }
34848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034849 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034850#endif
34851
Daniel Veillard42595322004-11-08 10:52:06 +000034852 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034853}
34854
34855
34856static int
34857test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034858 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034859
William M. Brack21e4ef22005-01-02 09:53:13 +000034860#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034861 int mem_base;
34862 int ret_val;
34863 int code; /* UCS code point */
34864 int n_code;
34865
34866 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34867 mem_base = xmlMemBlocks();
34868 code = gen_int(n_code, 0);
34869
34870 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34871 desret_int(ret_val);
34872 call_tests++;
34873 des_int(n_code, code, 0);
34874 xmlResetLastError();
34875 if (mem_base != xmlMemBlocks()) {
34876 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034878 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034879 printf(" %d", n_code);
34880 printf("\n");
34881 }
34882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034883 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034884#endif
34885
Daniel Veillard42595322004-11-08 10:52:06 +000034886 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034887}
34888
34889
34890static int
34891test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034892 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034893
William M. Brack21e4ef22005-01-02 09:53:13 +000034894#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034895 int mem_base;
34896 int ret_val;
34897 int code; /* UCS code point */
34898 int n_code;
34899
34900 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34901 mem_base = xmlMemBlocks();
34902 code = gen_int(n_code, 0);
34903
34904 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34905 desret_int(ret_val);
34906 call_tests++;
34907 des_int(n_code, code, 0);
34908 xmlResetLastError();
34909 if (mem_base != xmlMemBlocks()) {
34910 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034912 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034913 printf(" %d", n_code);
34914 printf("\n");
34915 }
34916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034917 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034918#endif
34919
Daniel Veillard42595322004-11-08 10:52:06 +000034920 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034921}
34922
34923
34924static int
34925test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034926 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034927
William M. Brack21e4ef22005-01-02 09:53:13 +000034928#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034929 int mem_base;
34930 int ret_val;
34931 int code; /* UCS code point */
34932 int n_code;
34933
34934 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34935 mem_base = xmlMemBlocks();
34936 code = gen_int(n_code, 0);
34937
34938 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34939 desret_int(ret_val);
34940 call_tests++;
34941 des_int(n_code, code, 0);
34942 xmlResetLastError();
34943 if (mem_base != xmlMemBlocks()) {
34944 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034946 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034947 printf(" %d", n_code);
34948 printf("\n");
34949 }
34950 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034951 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034952#endif
34953
Daniel Veillard42595322004-11-08 10:52:06 +000034954 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034955}
34956
34957
34958static int
34959test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034960 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034961
William M. Brack21e4ef22005-01-02 09:53:13 +000034962#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034963 int mem_base;
34964 int ret_val;
34965 int code; /* UCS code point */
34966 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034967 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034968 int n_cat;
34969
34970 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34971 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34972 mem_base = xmlMemBlocks();
34973 code = gen_int(n_code, 0);
34974 cat = gen_const_char_ptr(n_cat, 1);
34975
William M. Brackf13f77f2004-11-12 16:03:48 +000034976 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034977 desret_int(ret_val);
34978 call_tests++;
34979 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034980 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034981 xmlResetLastError();
34982 if (mem_base != xmlMemBlocks()) {
34983 printf("Leak of %d blocks found in xmlUCSIsCat",
34984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034985 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034986 printf(" %d", n_code);
34987 printf(" %d", n_cat);
34988 printf("\n");
34989 }
34990 }
34991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034992 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034993#endif
34994
Daniel Veillard42595322004-11-08 10:52:06 +000034995 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034996}
34997
34998
34999static int
35000test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035001 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035002
William M. Brack21e4ef22005-01-02 09:53:13 +000035003#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035004 int mem_base;
35005 int ret_val;
35006 int code; /* UCS code point */
35007 int n_code;
35008
35009 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35010 mem_base = xmlMemBlocks();
35011 code = gen_int(n_code, 0);
35012
35013 ret_val = xmlUCSIsCatC(code);
35014 desret_int(ret_val);
35015 call_tests++;
35016 des_int(n_code, code, 0);
35017 xmlResetLastError();
35018 if (mem_base != xmlMemBlocks()) {
35019 printf("Leak of %d blocks found in xmlUCSIsCatC",
35020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035021 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035022 printf(" %d", n_code);
35023 printf("\n");
35024 }
35025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035026 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035027#endif
35028
Daniel Veillard42595322004-11-08 10:52:06 +000035029 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035030}
35031
35032
35033static int
35034test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035035 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035036
William M. Brack21e4ef22005-01-02 09:53:13 +000035037#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035038 int mem_base;
35039 int ret_val;
35040 int code; /* UCS code point */
35041 int n_code;
35042
35043 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35044 mem_base = xmlMemBlocks();
35045 code = gen_int(n_code, 0);
35046
35047 ret_val = xmlUCSIsCatCc(code);
35048 desret_int(ret_val);
35049 call_tests++;
35050 des_int(n_code, code, 0);
35051 xmlResetLastError();
35052 if (mem_base != xmlMemBlocks()) {
35053 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035055 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035056 printf(" %d", n_code);
35057 printf("\n");
35058 }
35059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035060 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035061#endif
35062
Daniel Veillard42595322004-11-08 10:52:06 +000035063 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035064}
35065
35066
35067static int
35068test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035069 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035070
William M. Brack21e4ef22005-01-02 09:53:13 +000035071#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035072 int mem_base;
35073 int ret_val;
35074 int code; /* UCS code point */
35075 int n_code;
35076
35077 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35078 mem_base = xmlMemBlocks();
35079 code = gen_int(n_code, 0);
35080
35081 ret_val = xmlUCSIsCatCf(code);
35082 desret_int(ret_val);
35083 call_tests++;
35084 des_int(n_code, code, 0);
35085 xmlResetLastError();
35086 if (mem_base != xmlMemBlocks()) {
35087 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035089 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035090 printf(" %d", n_code);
35091 printf("\n");
35092 }
35093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035094 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035095#endif
35096
Daniel Veillard42595322004-11-08 10:52:06 +000035097 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035098}
35099
35100
35101static int
35102test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035103 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035104
William M. Brack21e4ef22005-01-02 09:53:13 +000035105#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035106 int mem_base;
35107 int ret_val;
35108 int code; /* UCS code point */
35109 int n_code;
35110
35111 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35112 mem_base = xmlMemBlocks();
35113 code = gen_int(n_code, 0);
35114
35115 ret_val = xmlUCSIsCatCo(code);
35116 desret_int(ret_val);
35117 call_tests++;
35118 des_int(n_code, code, 0);
35119 xmlResetLastError();
35120 if (mem_base != xmlMemBlocks()) {
35121 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035123 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035124 printf(" %d", n_code);
35125 printf("\n");
35126 }
35127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035128 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035129#endif
35130
Daniel Veillard42595322004-11-08 10:52:06 +000035131 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035132}
35133
35134
35135static int
35136test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035137 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035138
William M. Brack21e4ef22005-01-02 09:53:13 +000035139#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035140 int mem_base;
35141 int ret_val;
35142 int code; /* UCS code point */
35143 int n_code;
35144
35145 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35146 mem_base = xmlMemBlocks();
35147 code = gen_int(n_code, 0);
35148
35149 ret_val = xmlUCSIsCatCs(code);
35150 desret_int(ret_val);
35151 call_tests++;
35152 des_int(n_code, code, 0);
35153 xmlResetLastError();
35154 if (mem_base != xmlMemBlocks()) {
35155 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035157 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035158 printf(" %d", n_code);
35159 printf("\n");
35160 }
35161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035162 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035163#endif
35164
Daniel Veillard42595322004-11-08 10:52:06 +000035165 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035166}
35167
35168
35169static int
35170test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035171 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035172
William M. Brack21e4ef22005-01-02 09:53:13 +000035173#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035174 int mem_base;
35175 int ret_val;
35176 int code; /* UCS code point */
35177 int n_code;
35178
35179 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35180 mem_base = xmlMemBlocks();
35181 code = gen_int(n_code, 0);
35182
35183 ret_val = xmlUCSIsCatL(code);
35184 desret_int(ret_val);
35185 call_tests++;
35186 des_int(n_code, code, 0);
35187 xmlResetLastError();
35188 if (mem_base != xmlMemBlocks()) {
35189 printf("Leak of %d blocks found in xmlUCSIsCatL",
35190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035191 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035192 printf(" %d", n_code);
35193 printf("\n");
35194 }
35195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035196 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035197#endif
35198
Daniel Veillard42595322004-11-08 10:52:06 +000035199 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035200}
35201
35202
35203static int
35204test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035205 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035206
William M. Brack21e4ef22005-01-02 09:53:13 +000035207#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035208 int mem_base;
35209 int ret_val;
35210 int code; /* UCS code point */
35211 int n_code;
35212
35213 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35214 mem_base = xmlMemBlocks();
35215 code = gen_int(n_code, 0);
35216
35217 ret_val = xmlUCSIsCatLl(code);
35218 desret_int(ret_val);
35219 call_tests++;
35220 des_int(n_code, code, 0);
35221 xmlResetLastError();
35222 if (mem_base != xmlMemBlocks()) {
35223 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035225 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035226 printf(" %d", n_code);
35227 printf("\n");
35228 }
35229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035230 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035231#endif
35232
Daniel Veillard42595322004-11-08 10:52:06 +000035233 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035234}
35235
35236
35237static int
35238test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035239 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035240
William M. Brack21e4ef22005-01-02 09:53:13 +000035241#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035242 int mem_base;
35243 int ret_val;
35244 int code; /* UCS code point */
35245 int n_code;
35246
35247 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35248 mem_base = xmlMemBlocks();
35249 code = gen_int(n_code, 0);
35250
35251 ret_val = xmlUCSIsCatLm(code);
35252 desret_int(ret_val);
35253 call_tests++;
35254 des_int(n_code, code, 0);
35255 xmlResetLastError();
35256 if (mem_base != xmlMemBlocks()) {
35257 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035259 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035260 printf(" %d", n_code);
35261 printf("\n");
35262 }
35263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035264 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035265#endif
35266
Daniel Veillard42595322004-11-08 10:52:06 +000035267 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035268}
35269
35270
35271static int
35272test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035273 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035274
William M. Brack21e4ef22005-01-02 09:53:13 +000035275#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035276 int mem_base;
35277 int ret_val;
35278 int code; /* UCS code point */
35279 int n_code;
35280
35281 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35282 mem_base = xmlMemBlocks();
35283 code = gen_int(n_code, 0);
35284
35285 ret_val = xmlUCSIsCatLo(code);
35286 desret_int(ret_val);
35287 call_tests++;
35288 des_int(n_code, code, 0);
35289 xmlResetLastError();
35290 if (mem_base != xmlMemBlocks()) {
35291 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035293 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035294 printf(" %d", n_code);
35295 printf("\n");
35296 }
35297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035298 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035299#endif
35300
Daniel Veillard42595322004-11-08 10:52:06 +000035301 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035302}
35303
35304
35305static int
35306test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035307 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035308
William M. Brack21e4ef22005-01-02 09:53:13 +000035309#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035310 int mem_base;
35311 int ret_val;
35312 int code; /* UCS code point */
35313 int n_code;
35314
35315 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35316 mem_base = xmlMemBlocks();
35317 code = gen_int(n_code, 0);
35318
35319 ret_val = xmlUCSIsCatLt(code);
35320 desret_int(ret_val);
35321 call_tests++;
35322 des_int(n_code, code, 0);
35323 xmlResetLastError();
35324 if (mem_base != xmlMemBlocks()) {
35325 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035327 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035328 printf(" %d", n_code);
35329 printf("\n");
35330 }
35331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035332 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035333#endif
35334
Daniel Veillard42595322004-11-08 10:52:06 +000035335 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035336}
35337
35338
35339static int
35340test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035341 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035342
William M. Brack21e4ef22005-01-02 09:53:13 +000035343#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035344 int mem_base;
35345 int ret_val;
35346 int code; /* UCS code point */
35347 int n_code;
35348
35349 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35350 mem_base = xmlMemBlocks();
35351 code = gen_int(n_code, 0);
35352
35353 ret_val = xmlUCSIsCatLu(code);
35354 desret_int(ret_val);
35355 call_tests++;
35356 des_int(n_code, code, 0);
35357 xmlResetLastError();
35358 if (mem_base != xmlMemBlocks()) {
35359 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035361 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035362 printf(" %d", n_code);
35363 printf("\n");
35364 }
35365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035366 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035367#endif
35368
Daniel Veillard42595322004-11-08 10:52:06 +000035369 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035370}
35371
35372
35373static int
35374test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035375 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035376
William M. Brack21e4ef22005-01-02 09:53:13 +000035377#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035378 int mem_base;
35379 int ret_val;
35380 int code; /* UCS code point */
35381 int n_code;
35382
35383 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35384 mem_base = xmlMemBlocks();
35385 code = gen_int(n_code, 0);
35386
35387 ret_val = xmlUCSIsCatM(code);
35388 desret_int(ret_val);
35389 call_tests++;
35390 des_int(n_code, code, 0);
35391 xmlResetLastError();
35392 if (mem_base != xmlMemBlocks()) {
35393 printf("Leak of %d blocks found in xmlUCSIsCatM",
35394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035395 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035396 printf(" %d", n_code);
35397 printf("\n");
35398 }
35399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035400 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035401#endif
35402
Daniel Veillard42595322004-11-08 10:52:06 +000035403 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035404}
35405
35406
35407static int
35408test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035409 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035410
William M. Brack21e4ef22005-01-02 09:53:13 +000035411#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035412 int mem_base;
35413 int ret_val;
35414 int code; /* UCS code point */
35415 int n_code;
35416
35417 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35418 mem_base = xmlMemBlocks();
35419 code = gen_int(n_code, 0);
35420
35421 ret_val = xmlUCSIsCatMc(code);
35422 desret_int(ret_val);
35423 call_tests++;
35424 des_int(n_code, code, 0);
35425 xmlResetLastError();
35426 if (mem_base != xmlMemBlocks()) {
35427 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035429 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035430 printf(" %d", n_code);
35431 printf("\n");
35432 }
35433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035434 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035435#endif
35436
Daniel Veillard42595322004-11-08 10:52:06 +000035437 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035438}
35439
35440
35441static int
35442test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035443 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035444
William M. Brack21e4ef22005-01-02 09:53:13 +000035445#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035446 int mem_base;
35447 int ret_val;
35448 int code; /* UCS code point */
35449 int n_code;
35450
35451 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35452 mem_base = xmlMemBlocks();
35453 code = gen_int(n_code, 0);
35454
35455 ret_val = xmlUCSIsCatMe(code);
35456 desret_int(ret_val);
35457 call_tests++;
35458 des_int(n_code, code, 0);
35459 xmlResetLastError();
35460 if (mem_base != xmlMemBlocks()) {
35461 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035463 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035464 printf(" %d", n_code);
35465 printf("\n");
35466 }
35467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035468 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035469#endif
35470
Daniel Veillard42595322004-11-08 10:52:06 +000035471 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035472}
35473
35474
35475static int
35476test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035477 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035478
William M. Brack21e4ef22005-01-02 09:53:13 +000035479#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035480 int mem_base;
35481 int ret_val;
35482 int code; /* UCS code point */
35483 int n_code;
35484
35485 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35486 mem_base = xmlMemBlocks();
35487 code = gen_int(n_code, 0);
35488
35489 ret_val = xmlUCSIsCatMn(code);
35490 desret_int(ret_val);
35491 call_tests++;
35492 des_int(n_code, code, 0);
35493 xmlResetLastError();
35494 if (mem_base != xmlMemBlocks()) {
35495 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035497 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035498 printf(" %d", n_code);
35499 printf("\n");
35500 }
35501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035502 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035503#endif
35504
Daniel Veillard42595322004-11-08 10:52:06 +000035505 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035506}
35507
35508
35509static int
35510test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035511 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035512
William M. Brack21e4ef22005-01-02 09:53:13 +000035513#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035514 int mem_base;
35515 int ret_val;
35516 int code; /* UCS code point */
35517 int n_code;
35518
35519 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35520 mem_base = xmlMemBlocks();
35521 code = gen_int(n_code, 0);
35522
35523 ret_val = xmlUCSIsCatN(code);
35524 desret_int(ret_val);
35525 call_tests++;
35526 des_int(n_code, code, 0);
35527 xmlResetLastError();
35528 if (mem_base != xmlMemBlocks()) {
35529 printf("Leak of %d blocks found in xmlUCSIsCatN",
35530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035531 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035532 printf(" %d", n_code);
35533 printf("\n");
35534 }
35535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035536 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035537#endif
35538
Daniel Veillard42595322004-11-08 10:52:06 +000035539 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035540}
35541
35542
35543static int
35544test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035545 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035546
William M. Brack21e4ef22005-01-02 09:53:13 +000035547#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035548 int mem_base;
35549 int ret_val;
35550 int code; /* UCS code point */
35551 int n_code;
35552
35553 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35554 mem_base = xmlMemBlocks();
35555 code = gen_int(n_code, 0);
35556
35557 ret_val = xmlUCSIsCatNd(code);
35558 desret_int(ret_val);
35559 call_tests++;
35560 des_int(n_code, code, 0);
35561 xmlResetLastError();
35562 if (mem_base != xmlMemBlocks()) {
35563 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035565 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035566 printf(" %d", n_code);
35567 printf("\n");
35568 }
35569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035570 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035571#endif
35572
Daniel Veillard42595322004-11-08 10:52:06 +000035573 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035574}
35575
35576
35577static int
35578test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035579 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035580
William M. Brack21e4ef22005-01-02 09:53:13 +000035581#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035582 int mem_base;
35583 int ret_val;
35584 int code; /* UCS code point */
35585 int n_code;
35586
35587 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35588 mem_base = xmlMemBlocks();
35589 code = gen_int(n_code, 0);
35590
35591 ret_val = xmlUCSIsCatNl(code);
35592 desret_int(ret_val);
35593 call_tests++;
35594 des_int(n_code, code, 0);
35595 xmlResetLastError();
35596 if (mem_base != xmlMemBlocks()) {
35597 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035599 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035600 printf(" %d", n_code);
35601 printf("\n");
35602 }
35603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035604 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035605#endif
35606
Daniel Veillard42595322004-11-08 10:52:06 +000035607 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035608}
35609
35610
35611static int
35612test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035613 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035614
William M. Brack21e4ef22005-01-02 09:53:13 +000035615#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035616 int mem_base;
35617 int ret_val;
35618 int code; /* UCS code point */
35619 int n_code;
35620
35621 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35622 mem_base = xmlMemBlocks();
35623 code = gen_int(n_code, 0);
35624
35625 ret_val = xmlUCSIsCatNo(code);
35626 desret_int(ret_val);
35627 call_tests++;
35628 des_int(n_code, code, 0);
35629 xmlResetLastError();
35630 if (mem_base != xmlMemBlocks()) {
35631 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035633 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035634 printf(" %d", n_code);
35635 printf("\n");
35636 }
35637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035638 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035639#endif
35640
Daniel Veillard42595322004-11-08 10:52:06 +000035641 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035642}
35643
35644
35645static int
35646test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035647 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035648
William M. Brack21e4ef22005-01-02 09:53:13 +000035649#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035650 int mem_base;
35651 int ret_val;
35652 int code; /* UCS code point */
35653 int n_code;
35654
35655 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35656 mem_base = xmlMemBlocks();
35657 code = gen_int(n_code, 0);
35658
35659 ret_val = xmlUCSIsCatP(code);
35660 desret_int(ret_val);
35661 call_tests++;
35662 des_int(n_code, code, 0);
35663 xmlResetLastError();
35664 if (mem_base != xmlMemBlocks()) {
35665 printf("Leak of %d blocks found in xmlUCSIsCatP",
35666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035667 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035668 printf(" %d", n_code);
35669 printf("\n");
35670 }
35671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035672 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035673#endif
35674
Daniel Veillard42595322004-11-08 10:52:06 +000035675 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035676}
35677
35678
35679static int
35680test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035681 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035682
William M. Brack21e4ef22005-01-02 09:53:13 +000035683#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035684 int mem_base;
35685 int ret_val;
35686 int code; /* UCS code point */
35687 int n_code;
35688
35689 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35690 mem_base = xmlMemBlocks();
35691 code = gen_int(n_code, 0);
35692
35693 ret_val = xmlUCSIsCatPc(code);
35694 desret_int(ret_val);
35695 call_tests++;
35696 des_int(n_code, code, 0);
35697 xmlResetLastError();
35698 if (mem_base != xmlMemBlocks()) {
35699 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035701 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035702 printf(" %d", n_code);
35703 printf("\n");
35704 }
35705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035706 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035707#endif
35708
Daniel Veillard42595322004-11-08 10:52:06 +000035709 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035710}
35711
35712
35713static int
35714test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035715 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035716
William M. Brack21e4ef22005-01-02 09:53:13 +000035717#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035718 int mem_base;
35719 int ret_val;
35720 int code; /* UCS code point */
35721 int n_code;
35722
35723 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35724 mem_base = xmlMemBlocks();
35725 code = gen_int(n_code, 0);
35726
35727 ret_val = xmlUCSIsCatPd(code);
35728 desret_int(ret_val);
35729 call_tests++;
35730 des_int(n_code, code, 0);
35731 xmlResetLastError();
35732 if (mem_base != xmlMemBlocks()) {
35733 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035735 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035736 printf(" %d", n_code);
35737 printf("\n");
35738 }
35739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035740 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035741#endif
35742
Daniel Veillard42595322004-11-08 10:52:06 +000035743 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035744}
35745
35746
35747static int
35748test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035749 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035750
William M. Brack21e4ef22005-01-02 09:53:13 +000035751#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035752 int mem_base;
35753 int ret_val;
35754 int code; /* UCS code point */
35755 int n_code;
35756
35757 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35758 mem_base = xmlMemBlocks();
35759 code = gen_int(n_code, 0);
35760
35761 ret_val = xmlUCSIsCatPe(code);
35762 desret_int(ret_val);
35763 call_tests++;
35764 des_int(n_code, code, 0);
35765 xmlResetLastError();
35766 if (mem_base != xmlMemBlocks()) {
35767 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035769 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035770 printf(" %d", n_code);
35771 printf("\n");
35772 }
35773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035774 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035775#endif
35776
Daniel Veillard42595322004-11-08 10:52:06 +000035777 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035778}
35779
35780
35781static int
35782test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035783 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035784
William M. Brack21e4ef22005-01-02 09:53:13 +000035785#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035786 int mem_base;
35787 int ret_val;
35788 int code; /* UCS code point */
35789 int n_code;
35790
35791 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35792 mem_base = xmlMemBlocks();
35793 code = gen_int(n_code, 0);
35794
35795 ret_val = xmlUCSIsCatPf(code);
35796 desret_int(ret_val);
35797 call_tests++;
35798 des_int(n_code, code, 0);
35799 xmlResetLastError();
35800 if (mem_base != xmlMemBlocks()) {
35801 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035803 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035804 printf(" %d", n_code);
35805 printf("\n");
35806 }
35807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035808 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035809#endif
35810
Daniel Veillard42595322004-11-08 10:52:06 +000035811 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035812}
35813
35814
35815static int
35816test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035817 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035818
William M. Brack21e4ef22005-01-02 09:53:13 +000035819#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035820 int mem_base;
35821 int ret_val;
35822 int code; /* UCS code point */
35823 int n_code;
35824
35825 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35826 mem_base = xmlMemBlocks();
35827 code = gen_int(n_code, 0);
35828
35829 ret_val = xmlUCSIsCatPi(code);
35830 desret_int(ret_val);
35831 call_tests++;
35832 des_int(n_code, code, 0);
35833 xmlResetLastError();
35834 if (mem_base != xmlMemBlocks()) {
35835 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035837 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035838 printf(" %d", n_code);
35839 printf("\n");
35840 }
35841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035842 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035843#endif
35844
Daniel Veillard42595322004-11-08 10:52:06 +000035845 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035846}
35847
35848
35849static int
35850test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035851 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035852
William M. Brack21e4ef22005-01-02 09:53:13 +000035853#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035854 int mem_base;
35855 int ret_val;
35856 int code; /* UCS code point */
35857 int n_code;
35858
35859 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35860 mem_base = xmlMemBlocks();
35861 code = gen_int(n_code, 0);
35862
35863 ret_val = xmlUCSIsCatPo(code);
35864 desret_int(ret_val);
35865 call_tests++;
35866 des_int(n_code, code, 0);
35867 xmlResetLastError();
35868 if (mem_base != xmlMemBlocks()) {
35869 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035871 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035872 printf(" %d", n_code);
35873 printf("\n");
35874 }
35875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035876 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035877#endif
35878
Daniel Veillard42595322004-11-08 10:52:06 +000035879 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035880}
35881
35882
35883static int
35884test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035885 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035886
William M. Brack21e4ef22005-01-02 09:53:13 +000035887#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035888 int mem_base;
35889 int ret_val;
35890 int code; /* UCS code point */
35891 int n_code;
35892
35893 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35894 mem_base = xmlMemBlocks();
35895 code = gen_int(n_code, 0);
35896
35897 ret_val = xmlUCSIsCatPs(code);
35898 desret_int(ret_val);
35899 call_tests++;
35900 des_int(n_code, code, 0);
35901 xmlResetLastError();
35902 if (mem_base != xmlMemBlocks()) {
35903 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035905 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035906 printf(" %d", n_code);
35907 printf("\n");
35908 }
35909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035910 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035911#endif
35912
Daniel Veillard42595322004-11-08 10:52:06 +000035913 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035914}
35915
35916
35917static int
35918test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035919 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035920
William M. Brack21e4ef22005-01-02 09:53:13 +000035921#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035922 int mem_base;
35923 int ret_val;
35924 int code; /* UCS code point */
35925 int n_code;
35926
35927 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35928 mem_base = xmlMemBlocks();
35929 code = gen_int(n_code, 0);
35930
35931 ret_val = xmlUCSIsCatS(code);
35932 desret_int(ret_val);
35933 call_tests++;
35934 des_int(n_code, code, 0);
35935 xmlResetLastError();
35936 if (mem_base != xmlMemBlocks()) {
35937 printf("Leak of %d blocks found in xmlUCSIsCatS",
35938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035939 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035940 printf(" %d", n_code);
35941 printf("\n");
35942 }
35943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035944 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035945#endif
35946
Daniel Veillard42595322004-11-08 10:52:06 +000035947 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035948}
35949
35950
35951static int
35952test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035953 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035954
William M. Brack21e4ef22005-01-02 09:53:13 +000035955#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035956 int mem_base;
35957 int ret_val;
35958 int code; /* UCS code point */
35959 int n_code;
35960
35961 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35962 mem_base = xmlMemBlocks();
35963 code = gen_int(n_code, 0);
35964
35965 ret_val = xmlUCSIsCatSc(code);
35966 desret_int(ret_val);
35967 call_tests++;
35968 des_int(n_code, code, 0);
35969 xmlResetLastError();
35970 if (mem_base != xmlMemBlocks()) {
35971 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035973 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035974 printf(" %d", n_code);
35975 printf("\n");
35976 }
35977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035978 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035979#endif
35980
Daniel Veillard42595322004-11-08 10:52:06 +000035981 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035982}
35983
35984
35985static int
35986test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035987 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035988
William M. Brack21e4ef22005-01-02 09:53:13 +000035989#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035990 int mem_base;
35991 int ret_val;
35992 int code; /* UCS code point */
35993 int n_code;
35994
35995 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35996 mem_base = xmlMemBlocks();
35997 code = gen_int(n_code, 0);
35998
35999 ret_val = xmlUCSIsCatSk(code);
36000 desret_int(ret_val);
36001 call_tests++;
36002 des_int(n_code, code, 0);
36003 xmlResetLastError();
36004 if (mem_base != xmlMemBlocks()) {
36005 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036007 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036008 printf(" %d", n_code);
36009 printf("\n");
36010 }
36011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036012 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036013#endif
36014
Daniel Veillard42595322004-11-08 10:52:06 +000036015 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036016}
36017
36018
36019static int
36020test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036021 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036022
William M. Brack21e4ef22005-01-02 09:53:13 +000036023#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036024 int mem_base;
36025 int ret_val;
36026 int code; /* UCS code point */
36027 int n_code;
36028
36029 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36030 mem_base = xmlMemBlocks();
36031 code = gen_int(n_code, 0);
36032
36033 ret_val = xmlUCSIsCatSm(code);
36034 desret_int(ret_val);
36035 call_tests++;
36036 des_int(n_code, code, 0);
36037 xmlResetLastError();
36038 if (mem_base != xmlMemBlocks()) {
36039 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036041 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036042 printf(" %d", n_code);
36043 printf("\n");
36044 }
36045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036046 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036047#endif
36048
Daniel Veillard42595322004-11-08 10:52:06 +000036049 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036050}
36051
36052
36053static int
36054test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036055 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036056
William M. Brack21e4ef22005-01-02 09:53:13 +000036057#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036058 int mem_base;
36059 int ret_val;
36060 int code; /* UCS code point */
36061 int n_code;
36062
36063 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36064 mem_base = xmlMemBlocks();
36065 code = gen_int(n_code, 0);
36066
36067 ret_val = xmlUCSIsCatSo(code);
36068 desret_int(ret_val);
36069 call_tests++;
36070 des_int(n_code, code, 0);
36071 xmlResetLastError();
36072 if (mem_base != xmlMemBlocks()) {
36073 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036075 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036076 printf(" %d", n_code);
36077 printf("\n");
36078 }
36079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036080 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036081#endif
36082
Daniel Veillard42595322004-11-08 10:52:06 +000036083 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036084}
36085
36086
36087static int
36088test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036089 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036090
William M. Brack21e4ef22005-01-02 09:53:13 +000036091#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036092 int mem_base;
36093 int ret_val;
36094 int code; /* UCS code point */
36095 int n_code;
36096
36097 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36098 mem_base = xmlMemBlocks();
36099 code = gen_int(n_code, 0);
36100
36101 ret_val = xmlUCSIsCatZ(code);
36102 desret_int(ret_val);
36103 call_tests++;
36104 des_int(n_code, code, 0);
36105 xmlResetLastError();
36106 if (mem_base != xmlMemBlocks()) {
36107 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036109 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036110 printf(" %d", n_code);
36111 printf("\n");
36112 }
36113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036114 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036115#endif
36116
Daniel Veillard42595322004-11-08 10:52:06 +000036117 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036118}
36119
36120
36121static int
36122test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036123 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036124
William M. Brack21e4ef22005-01-02 09:53:13 +000036125#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036126 int mem_base;
36127 int ret_val;
36128 int code; /* UCS code point */
36129 int n_code;
36130
36131 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36132 mem_base = xmlMemBlocks();
36133 code = gen_int(n_code, 0);
36134
36135 ret_val = xmlUCSIsCatZl(code);
36136 desret_int(ret_val);
36137 call_tests++;
36138 des_int(n_code, code, 0);
36139 xmlResetLastError();
36140 if (mem_base != xmlMemBlocks()) {
36141 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036143 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036144 printf(" %d", n_code);
36145 printf("\n");
36146 }
36147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036148 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036149#endif
36150
Daniel Veillard42595322004-11-08 10:52:06 +000036151 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036152}
36153
36154
36155static int
36156test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036157 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036158
William M. Brack21e4ef22005-01-02 09:53:13 +000036159#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036160 int mem_base;
36161 int ret_val;
36162 int code; /* UCS code point */
36163 int n_code;
36164
36165 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36166 mem_base = xmlMemBlocks();
36167 code = gen_int(n_code, 0);
36168
36169 ret_val = xmlUCSIsCatZp(code);
36170 desret_int(ret_val);
36171 call_tests++;
36172 des_int(n_code, code, 0);
36173 xmlResetLastError();
36174 if (mem_base != xmlMemBlocks()) {
36175 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036177 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036178 printf(" %d", n_code);
36179 printf("\n");
36180 }
36181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036182 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036183#endif
36184
Daniel Veillard42595322004-11-08 10:52:06 +000036185 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036186}
36187
36188
36189static int
36190test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036191 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036192
William M. Brack21e4ef22005-01-02 09:53:13 +000036193#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036194 int mem_base;
36195 int ret_val;
36196 int code; /* UCS code point */
36197 int n_code;
36198
36199 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36200 mem_base = xmlMemBlocks();
36201 code = gen_int(n_code, 0);
36202
36203 ret_val = xmlUCSIsCatZs(code);
36204 desret_int(ret_val);
36205 call_tests++;
36206 des_int(n_code, code, 0);
36207 xmlResetLastError();
36208 if (mem_base != xmlMemBlocks()) {
36209 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036211 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036212 printf(" %d", n_code);
36213 printf("\n");
36214 }
36215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036216 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036217#endif
36218
Daniel Veillard42595322004-11-08 10:52:06 +000036219 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036220}
36221
36222
36223static int
36224test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036225 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036226
William M. Brack21e4ef22005-01-02 09:53:13 +000036227#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036228 int mem_base;
36229 int ret_val;
36230 int code; /* UCS code point */
36231 int n_code;
36232
36233 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36234 mem_base = xmlMemBlocks();
36235 code = gen_int(n_code, 0);
36236
36237 ret_val = xmlUCSIsCherokee(code);
36238 desret_int(ret_val);
36239 call_tests++;
36240 des_int(n_code, code, 0);
36241 xmlResetLastError();
36242 if (mem_base != xmlMemBlocks()) {
36243 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036245 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036246 printf(" %d", n_code);
36247 printf("\n");
36248 }
36249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036250 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036251#endif
36252
Daniel Veillard42595322004-11-08 10:52:06 +000036253 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036254}
36255
36256
36257static int
36258test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036259 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036260
William M. Brack21e4ef22005-01-02 09:53:13 +000036261#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036262 int mem_base;
36263 int ret_val;
36264 int code; /* UCS code point */
36265 int n_code;
36266
36267 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36268 mem_base = xmlMemBlocks();
36269 code = gen_int(n_code, 0);
36270
36271 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36272 desret_int(ret_val);
36273 call_tests++;
36274 des_int(n_code, code, 0);
36275 xmlResetLastError();
36276 if (mem_base != xmlMemBlocks()) {
36277 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036279 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036280 printf(" %d", n_code);
36281 printf("\n");
36282 }
36283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036284 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036285#endif
36286
Daniel Veillard42595322004-11-08 10:52:06 +000036287 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036288}
36289
36290
36291static int
36292test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036293 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036294
William M. Brack21e4ef22005-01-02 09:53:13 +000036295#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036296 int mem_base;
36297 int ret_val;
36298 int code; /* UCS code point */
36299 int n_code;
36300
36301 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36302 mem_base = xmlMemBlocks();
36303 code = gen_int(n_code, 0);
36304
36305 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36306 desret_int(ret_val);
36307 call_tests++;
36308 des_int(n_code, code, 0);
36309 xmlResetLastError();
36310 if (mem_base != xmlMemBlocks()) {
36311 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036313 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036314 printf(" %d", n_code);
36315 printf("\n");
36316 }
36317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036318 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036319#endif
36320
Daniel Veillard42595322004-11-08 10:52:06 +000036321 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036322}
36323
36324
36325static int
36326test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036327 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036328
William M. Brack21e4ef22005-01-02 09:53:13 +000036329#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036330 int mem_base;
36331 int ret_val;
36332 int code; /* UCS code point */
36333 int n_code;
36334
36335 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36336 mem_base = xmlMemBlocks();
36337 code = gen_int(n_code, 0);
36338
36339 ret_val = xmlUCSIsCombiningHalfMarks(code);
36340 desret_int(ret_val);
36341 call_tests++;
36342 des_int(n_code, code, 0);
36343 xmlResetLastError();
36344 if (mem_base != xmlMemBlocks()) {
36345 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036347 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036348 printf(" %d", n_code);
36349 printf("\n");
36350 }
36351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036352 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036353#endif
36354
Daniel Veillard42595322004-11-08 10:52:06 +000036355 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036356}
36357
36358
36359static int
36360test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036361 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036362
William M. Brack21e4ef22005-01-02 09:53:13 +000036363#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036364 int mem_base;
36365 int ret_val;
36366 int code; /* UCS code point */
36367 int n_code;
36368
36369 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36370 mem_base = xmlMemBlocks();
36371 code = gen_int(n_code, 0);
36372
36373 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36374 desret_int(ret_val);
36375 call_tests++;
36376 des_int(n_code, code, 0);
36377 xmlResetLastError();
36378 if (mem_base != xmlMemBlocks()) {
36379 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036381 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036382 printf(" %d", n_code);
36383 printf("\n");
36384 }
36385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036386 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036387#endif
36388
Daniel Veillard42595322004-11-08 10:52:06 +000036389 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036390}
36391
36392
36393static int
36394test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036395 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036396
William M. Brack21e4ef22005-01-02 09:53:13 +000036397#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036398 int mem_base;
36399 int ret_val;
36400 int code; /* UCS code point */
36401 int n_code;
36402
36403 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36404 mem_base = xmlMemBlocks();
36405 code = gen_int(n_code, 0);
36406
36407 ret_val = xmlUCSIsControlPictures(code);
36408 desret_int(ret_val);
36409 call_tests++;
36410 des_int(n_code, code, 0);
36411 xmlResetLastError();
36412 if (mem_base != xmlMemBlocks()) {
36413 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036415 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036416 printf(" %d", n_code);
36417 printf("\n");
36418 }
36419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036420 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036421#endif
36422
Daniel Veillard42595322004-11-08 10:52:06 +000036423 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036424}
36425
36426
36427static int
36428test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036429 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036430
William M. Brack21e4ef22005-01-02 09:53:13 +000036431#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036432 int mem_base;
36433 int ret_val;
36434 int code; /* UCS code point */
36435 int n_code;
36436
36437 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36438 mem_base = xmlMemBlocks();
36439 code = gen_int(n_code, 0);
36440
36441 ret_val = xmlUCSIsCurrencySymbols(code);
36442 desret_int(ret_val);
36443 call_tests++;
36444 des_int(n_code, code, 0);
36445 xmlResetLastError();
36446 if (mem_base != xmlMemBlocks()) {
36447 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036449 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036450 printf(" %d", n_code);
36451 printf("\n");
36452 }
36453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036454 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036455#endif
36456
Daniel Veillard42595322004-11-08 10:52:06 +000036457 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036458}
36459
36460
36461static int
36462test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036463 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036464
William M. Brack21e4ef22005-01-02 09:53:13 +000036465#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036466 int mem_base;
36467 int ret_val;
36468 int code; /* UCS code point */
36469 int n_code;
36470
36471 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36472 mem_base = xmlMemBlocks();
36473 code = gen_int(n_code, 0);
36474
36475 ret_val = xmlUCSIsCypriotSyllabary(code);
36476 desret_int(ret_val);
36477 call_tests++;
36478 des_int(n_code, code, 0);
36479 xmlResetLastError();
36480 if (mem_base != xmlMemBlocks()) {
36481 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036483 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036484 printf(" %d", n_code);
36485 printf("\n");
36486 }
36487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036488 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036489#endif
36490
Daniel Veillard42595322004-11-08 10:52:06 +000036491 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036492}
36493
36494
36495static int
36496test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036497 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036498
William M. Brack21e4ef22005-01-02 09:53:13 +000036499#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036500 int mem_base;
36501 int ret_val;
36502 int code; /* UCS code point */
36503 int n_code;
36504
36505 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36506 mem_base = xmlMemBlocks();
36507 code = gen_int(n_code, 0);
36508
36509 ret_val = xmlUCSIsCyrillic(code);
36510 desret_int(ret_val);
36511 call_tests++;
36512 des_int(n_code, code, 0);
36513 xmlResetLastError();
36514 if (mem_base != xmlMemBlocks()) {
36515 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036517 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036518 printf(" %d", n_code);
36519 printf("\n");
36520 }
36521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036522 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036523#endif
36524
Daniel Veillard42595322004-11-08 10:52:06 +000036525 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036526}
36527
36528
36529static int
36530test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036531 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036532
William M. Brack21e4ef22005-01-02 09:53:13 +000036533#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036534 int mem_base;
36535 int ret_val;
36536 int code; /* UCS code point */
36537 int n_code;
36538
36539 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36540 mem_base = xmlMemBlocks();
36541 code = gen_int(n_code, 0);
36542
36543 ret_val = xmlUCSIsCyrillicSupplement(code);
36544 desret_int(ret_val);
36545 call_tests++;
36546 des_int(n_code, code, 0);
36547 xmlResetLastError();
36548 if (mem_base != xmlMemBlocks()) {
36549 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036551 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036552 printf(" %d", n_code);
36553 printf("\n");
36554 }
36555 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036556 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036557#endif
36558
Daniel Veillard42595322004-11-08 10:52:06 +000036559 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036560}
36561
36562
36563static int
36564test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036565 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036566
William M. Brack21e4ef22005-01-02 09:53:13 +000036567#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036568 int mem_base;
36569 int ret_val;
36570 int code; /* UCS code point */
36571 int n_code;
36572
36573 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36574 mem_base = xmlMemBlocks();
36575 code = gen_int(n_code, 0);
36576
36577 ret_val = xmlUCSIsDeseret(code);
36578 desret_int(ret_val);
36579 call_tests++;
36580 des_int(n_code, code, 0);
36581 xmlResetLastError();
36582 if (mem_base != xmlMemBlocks()) {
36583 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036585 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036586 printf(" %d", n_code);
36587 printf("\n");
36588 }
36589 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036590 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036591#endif
36592
Daniel Veillard42595322004-11-08 10:52:06 +000036593 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036594}
36595
36596
36597static int
36598test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036599 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036600
William M. Brack21e4ef22005-01-02 09:53:13 +000036601#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036602 int mem_base;
36603 int ret_val;
36604 int code; /* UCS code point */
36605 int n_code;
36606
36607 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36608 mem_base = xmlMemBlocks();
36609 code = gen_int(n_code, 0);
36610
36611 ret_val = xmlUCSIsDevanagari(code);
36612 desret_int(ret_val);
36613 call_tests++;
36614 des_int(n_code, code, 0);
36615 xmlResetLastError();
36616 if (mem_base != xmlMemBlocks()) {
36617 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036619 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036620 printf(" %d", n_code);
36621 printf("\n");
36622 }
36623 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036624 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036625#endif
36626
Daniel Veillard42595322004-11-08 10:52:06 +000036627 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036628}
36629
36630
36631static int
36632test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036633 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036634
William M. Brack21e4ef22005-01-02 09:53:13 +000036635#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036636 int mem_base;
36637 int ret_val;
36638 int code; /* UCS code point */
36639 int n_code;
36640
36641 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36642 mem_base = xmlMemBlocks();
36643 code = gen_int(n_code, 0);
36644
36645 ret_val = xmlUCSIsDingbats(code);
36646 desret_int(ret_val);
36647 call_tests++;
36648 des_int(n_code, code, 0);
36649 xmlResetLastError();
36650 if (mem_base != xmlMemBlocks()) {
36651 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036653 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036654 printf(" %d", n_code);
36655 printf("\n");
36656 }
36657 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036658 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036659#endif
36660
Daniel Veillard42595322004-11-08 10:52:06 +000036661 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036662}
36663
36664
36665static int
36666test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036667 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036668
William M. Brack21e4ef22005-01-02 09:53:13 +000036669#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036670 int mem_base;
36671 int ret_val;
36672 int code; /* UCS code point */
36673 int n_code;
36674
36675 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36676 mem_base = xmlMemBlocks();
36677 code = gen_int(n_code, 0);
36678
36679 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36680 desret_int(ret_val);
36681 call_tests++;
36682 des_int(n_code, code, 0);
36683 xmlResetLastError();
36684 if (mem_base != xmlMemBlocks()) {
36685 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036687 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036688 printf(" %d", n_code);
36689 printf("\n");
36690 }
36691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036692 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036693#endif
36694
Daniel Veillard42595322004-11-08 10:52:06 +000036695 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036696}
36697
36698
36699static int
36700test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036701 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036702
William M. Brack21e4ef22005-01-02 09:53:13 +000036703#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036704 int mem_base;
36705 int ret_val;
36706 int code; /* UCS code point */
36707 int n_code;
36708
36709 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36710 mem_base = xmlMemBlocks();
36711 code = gen_int(n_code, 0);
36712
36713 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36714 desret_int(ret_val);
36715 call_tests++;
36716 des_int(n_code, code, 0);
36717 xmlResetLastError();
36718 if (mem_base != xmlMemBlocks()) {
36719 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036721 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036722 printf(" %d", n_code);
36723 printf("\n");
36724 }
36725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036726 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036727#endif
36728
Daniel Veillard42595322004-11-08 10:52:06 +000036729 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036730}
36731
36732
36733static int
36734test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036735 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036736
William M. Brack21e4ef22005-01-02 09:53:13 +000036737#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036738 int mem_base;
36739 int ret_val;
36740 int code; /* UCS code point */
36741 int n_code;
36742
36743 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36744 mem_base = xmlMemBlocks();
36745 code = gen_int(n_code, 0);
36746
36747 ret_val = xmlUCSIsEthiopic(code);
36748 desret_int(ret_val);
36749 call_tests++;
36750 des_int(n_code, code, 0);
36751 xmlResetLastError();
36752 if (mem_base != xmlMemBlocks()) {
36753 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036755 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036756 printf(" %d", n_code);
36757 printf("\n");
36758 }
36759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036760 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036761#endif
36762
Daniel Veillard42595322004-11-08 10:52:06 +000036763 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036764}
36765
36766
36767static int
36768test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036769 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036770
William M. Brack21e4ef22005-01-02 09:53:13 +000036771#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036772 int mem_base;
36773 int ret_val;
36774 int code; /* UCS code point */
36775 int n_code;
36776
36777 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36778 mem_base = xmlMemBlocks();
36779 code = gen_int(n_code, 0);
36780
36781 ret_val = xmlUCSIsGeneralPunctuation(code);
36782 desret_int(ret_val);
36783 call_tests++;
36784 des_int(n_code, code, 0);
36785 xmlResetLastError();
36786 if (mem_base != xmlMemBlocks()) {
36787 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036789 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036790 printf(" %d", n_code);
36791 printf("\n");
36792 }
36793 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036794 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036795#endif
36796
Daniel Veillard42595322004-11-08 10:52:06 +000036797 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036798}
36799
36800
36801static int
36802test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036803 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036804
William M. Brack21e4ef22005-01-02 09:53:13 +000036805#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036806 int mem_base;
36807 int ret_val;
36808 int code; /* UCS code point */
36809 int n_code;
36810
36811 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36812 mem_base = xmlMemBlocks();
36813 code = gen_int(n_code, 0);
36814
36815 ret_val = xmlUCSIsGeometricShapes(code);
36816 desret_int(ret_val);
36817 call_tests++;
36818 des_int(n_code, code, 0);
36819 xmlResetLastError();
36820 if (mem_base != xmlMemBlocks()) {
36821 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036823 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036824 printf(" %d", n_code);
36825 printf("\n");
36826 }
36827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036828 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036829#endif
36830
Daniel Veillard42595322004-11-08 10:52:06 +000036831 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036832}
36833
36834
36835static int
36836test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036837 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036838
William M. Brack21e4ef22005-01-02 09:53:13 +000036839#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036840 int mem_base;
36841 int ret_val;
36842 int code; /* UCS code point */
36843 int n_code;
36844
36845 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36846 mem_base = xmlMemBlocks();
36847 code = gen_int(n_code, 0);
36848
36849 ret_val = xmlUCSIsGeorgian(code);
36850 desret_int(ret_val);
36851 call_tests++;
36852 des_int(n_code, code, 0);
36853 xmlResetLastError();
36854 if (mem_base != xmlMemBlocks()) {
36855 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036857 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036858 printf(" %d", n_code);
36859 printf("\n");
36860 }
36861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036862 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036863#endif
36864
Daniel Veillard42595322004-11-08 10:52:06 +000036865 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036866}
36867
36868
36869static int
36870test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036871 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036872
William M. Brack21e4ef22005-01-02 09:53:13 +000036873#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036874 int mem_base;
36875 int ret_val;
36876 int code; /* UCS code point */
36877 int n_code;
36878
36879 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36880 mem_base = xmlMemBlocks();
36881 code = gen_int(n_code, 0);
36882
36883 ret_val = xmlUCSIsGothic(code);
36884 desret_int(ret_val);
36885 call_tests++;
36886 des_int(n_code, code, 0);
36887 xmlResetLastError();
36888 if (mem_base != xmlMemBlocks()) {
36889 printf("Leak of %d blocks found in xmlUCSIsGothic",
36890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036891 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036892 printf(" %d", n_code);
36893 printf("\n");
36894 }
36895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036896 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036897#endif
36898
Daniel Veillard42595322004-11-08 10:52:06 +000036899 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036900}
36901
36902
36903static int
36904test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036905 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036906
William M. Brack21e4ef22005-01-02 09:53:13 +000036907#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036908 int mem_base;
36909 int ret_val;
36910 int code; /* UCS code point */
36911 int n_code;
36912
36913 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36914 mem_base = xmlMemBlocks();
36915 code = gen_int(n_code, 0);
36916
36917 ret_val = xmlUCSIsGreek(code);
36918 desret_int(ret_val);
36919 call_tests++;
36920 des_int(n_code, code, 0);
36921 xmlResetLastError();
36922 if (mem_base != xmlMemBlocks()) {
36923 printf("Leak of %d blocks found in xmlUCSIsGreek",
36924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036925 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036926 printf(" %d", n_code);
36927 printf("\n");
36928 }
36929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036930 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036931#endif
36932
Daniel Veillard42595322004-11-08 10:52:06 +000036933 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036934}
36935
36936
36937static int
36938test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036939 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036940
William M. Brack21e4ef22005-01-02 09:53:13 +000036941#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036942 int mem_base;
36943 int ret_val;
36944 int code; /* UCS code point */
36945 int n_code;
36946
36947 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36948 mem_base = xmlMemBlocks();
36949 code = gen_int(n_code, 0);
36950
36951 ret_val = xmlUCSIsGreekExtended(code);
36952 desret_int(ret_val);
36953 call_tests++;
36954 des_int(n_code, code, 0);
36955 xmlResetLastError();
36956 if (mem_base != xmlMemBlocks()) {
36957 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036959 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036960 printf(" %d", n_code);
36961 printf("\n");
36962 }
36963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036964 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036965#endif
36966
Daniel Veillard42595322004-11-08 10:52:06 +000036967 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036968}
36969
36970
36971static int
36972test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036973 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036974
William M. Brack21e4ef22005-01-02 09:53:13 +000036975#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036976 int mem_base;
36977 int ret_val;
36978 int code; /* UCS code point */
36979 int n_code;
36980
36981 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36982 mem_base = xmlMemBlocks();
36983 code = gen_int(n_code, 0);
36984
36985 ret_val = xmlUCSIsGreekandCoptic(code);
36986 desret_int(ret_val);
36987 call_tests++;
36988 des_int(n_code, code, 0);
36989 xmlResetLastError();
36990 if (mem_base != xmlMemBlocks()) {
36991 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036993 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036994 printf(" %d", n_code);
36995 printf("\n");
36996 }
36997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036998 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036999#endif
37000
Daniel Veillard42595322004-11-08 10:52:06 +000037001 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037002}
37003
37004
37005static int
37006test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037007 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037008
William M. Brack21e4ef22005-01-02 09:53:13 +000037009#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037010 int mem_base;
37011 int ret_val;
37012 int code; /* UCS code point */
37013 int n_code;
37014
37015 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37016 mem_base = xmlMemBlocks();
37017 code = gen_int(n_code, 0);
37018
37019 ret_val = xmlUCSIsGujarati(code);
37020 desret_int(ret_val);
37021 call_tests++;
37022 des_int(n_code, code, 0);
37023 xmlResetLastError();
37024 if (mem_base != xmlMemBlocks()) {
37025 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037027 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037028 printf(" %d", n_code);
37029 printf("\n");
37030 }
37031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037032 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037033#endif
37034
Daniel Veillard42595322004-11-08 10:52:06 +000037035 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037036}
37037
37038
37039static int
37040test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037041 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037042
William M. Brack21e4ef22005-01-02 09:53:13 +000037043#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037044 int mem_base;
37045 int ret_val;
37046 int code; /* UCS code point */
37047 int n_code;
37048
37049 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37050 mem_base = xmlMemBlocks();
37051 code = gen_int(n_code, 0);
37052
37053 ret_val = xmlUCSIsGurmukhi(code);
37054 desret_int(ret_val);
37055 call_tests++;
37056 des_int(n_code, code, 0);
37057 xmlResetLastError();
37058 if (mem_base != xmlMemBlocks()) {
37059 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037061 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037062 printf(" %d", n_code);
37063 printf("\n");
37064 }
37065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037066 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037067#endif
37068
Daniel Veillard42595322004-11-08 10:52:06 +000037069 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037070}
37071
37072
37073static int
37074test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037075 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037076
William M. Brack21e4ef22005-01-02 09:53:13 +000037077#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037078 int mem_base;
37079 int ret_val;
37080 int code; /* UCS code point */
37081 int n_code;
37082
37083 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37084 mem_base = xmlMemBlocks();
37085 code = gen_int(n_code, 0);
37086
37087 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37088 desret_int(ret_val);
37089 call_tests++;
37090 des_int(n_code, code, 0);
37091 xmlResetLastError();
37092 if (mem_base != xmlMemBlocks()) {
37093 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037095 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037096 printf(" %d", n_code);
37097 printf("\n");
37098 }
37099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037100 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037101#endif
37102
Daniel Veillard42595322004-11-08 10:52:06 +000037103 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037104}
37105
37106
37107static int
37108test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037109 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037110
William M. Brack21e4ef22005-01-02 09:53:13 +000037111#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037112 int mem_base;
37113 int ret_val;
37114 int code; /* UCS code point */
37115 int n_code;
37116
37117 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37118 mem_base = xmlMemBlocks();
37119 code = gen_int(n_code, 0);
37120
37121 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37122 desret_int(ret_val);
37123 call_tests++;
37124 des_int(n_code, code, 0);
37125 xmlResetLastError();
37126 if (mem_base != xmlMemBlocks()) {
37127 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037129 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037130 printf(" %d", n_code);
37131 printf("\n");
37132 }
37133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037134 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037135#endif
37136
Daniel Veillard42595322004-11-08 10:52:06 +000037137 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037138}
37139
37140
37141static int
37142test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037143 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037144
William M. Brack21e4ef22005-01-02 09:53:13 +000037145#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037146 int mem_base;
37147 int ret_val;
37148 int code; /* UCS code point */
37149 int n_code;
37150
37151 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37152 mem_base = xmlMemBlocks();
37153 code = gen_int(n_code, 0);
37154
37155 ret_val = xmlUCSIsHangulJamo(code);
37156 desret_int(ret_val);
37157 call_tests++;
37158 des_int(n_code, code, 0);
37159 xmlResetLastError();
37160 if (mem_base != xmlMemBlocks()) {
37161 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037163 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037164 printf(" %d", n_code);
37165 printf("\n");
37166 }
37167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037168 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037169#endif
37170
Daniel Veillard42595322004-11-08 10:52:06 +000037171 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037172}
37173
37174
37175static int
37176test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037177 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037178
William M. Brack21e4ef22005-01-02 09:53:13 +000037179#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037180 int mem_base;
37181 int ret_val;
37182 int code; /* UCS code point */
37183 int n_code;
37184
37185 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37186 mem_base = xmlMemBlocks();
37187 code = gen_int(n_code, 0);
37188
37189 ret_val = xmlUCSIsHangulSyllables(code);
37190 desret_int(ret_val);
37191 call_tests++;
37192 des_int(n_code, code, 0);
37193 xmlResetLastError();
37194 if (mem_base != xmlMemBlocks()) {
37195 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037197 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037198 printf(" %d", n_code);
37199 printf("\n");
37200 }
37201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037202 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037203#endif
37204
Daniel Veillard42595322004-11-08 10:52:06 +000037205 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037206}
37207
37208
37209static int
37210test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037211 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037212
William M. Brack21e4ef22005-01-02 09:53:13 +000037213#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037214 int mem_base;
37215 int ret_val;
37216 int code; /* UCS code point */
37217 int n_code;
37218
37219 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37220 mem_base = xmlMemBlocks();
37221 code = gen_int(n_code, 0);
37222
37223 ret_val = xmlUCSIsHanunoo(code);
37224 desret_int(ret_val);
37225 call_tests++;
37226 des_int(n_code, code, 0);
37227 xmlResetLastError();
37228 if (mem_base != xmlMemBlocks()) {
37229 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037231 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037232 printf(" %d", n_code);
37233 printf("\n");
37234 }
37235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037236 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037237#endif
37238
Daniel Veillard42595322004-11-08 10:52:06 +000037239 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037240}
37241
37242
37243static int
37244test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037245 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037246
William M. Brack21e4ef22005-01-02 09:53:13 +000037247#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037248 int mem_base;
37249 int ret_val;
37250 int code; /* UCS code point */
37251 int n_code;
37252
37253 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37254 mem_base = xmlMemBlocks();
37255 code = gen_int(n_code, 0);
37256
37257 ret_val = xmlUCSIsHebrew(code);
37258 desret_int(ret_val);
37259 call_tests++;
37260 des_int(n_code, code, 0);
37261 xmlResetLastError();
37262 if (mem_base != xmlMemBlocks()) {
37263 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037265 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037266 printf(" %d", n_code);
37267 printf("\n");
37268 }
37269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037270 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037271#endif
37272
Daniel Veillard42595322004-11-08 10:52:06 +000037273 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037274}
37275
37276
37277static int
37278test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037279 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037280
William M. Brack21e4ef22005-01-02 09:53:13 +000037281#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037282 int mem_base;
37283 int ret_val;
37284 int code; /* UCS code point */
37285 int n_code;
37286
37287 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37288 mem_base = xmlMemBlocks();
37289 code = gen_int(n_code, 0);
37290
37291 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37292 desret_int(ret_val);
37293 call_tests++;
37294 des_int(n_code, code, 0);
37295 xmlResetLastError();
37296 if (mem_base != xmlMemBlocks()) {
37297 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037299 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037300 printf(" %d", n_code);
37301 printf("\n");
37302 }
37303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037304 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037305#endif
37306
Daniel Veillard42595322004-11-08 10:52:06 +000037307 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037308}
37309
37310
37311static int
37312test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037313 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037314
William M. Brack21e4ef22005-01-02 09:53:13 +000037315#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037316 int mem_base;
37317 int ret_val;
37318 int code; /* UCS code point */
37319 int n_code;
37320
37321 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37322 mem_base = xmlMemBlocks();
37323 code = gen_int(n_code, 0);
37324
37325 ret_val = xmlUCSIsHighSurrogates(code);
37326 desret_int(ret_val);
37327 call_tests++;
37328 des_int(n_code, code, 0);
37329 xmlResetLastError();
37330 if (mem_base != xmlMemBlocks()) {
37331 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037333 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037334 printf(" %d", n_code);
37335 printf("\n");
37336 }
37337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037338 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037339#endif
37340
Daniel Veillard42595322004-11-08 10:52:06 +000037341 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037342}
37343
37344
37345static int
37346test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037347 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037348
William M. Brack21e4ef22005-01-02 09:53:13 +000037349#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037350 int mem_base;
37351 int ret_val;
37352 int code; /* UCS code point */
37353 int n_code;
37354
37355 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37356 mem_base = xmlMemBlocks();
37357 code = gen_int(n_code, 0);
37358
37359 ret_val = xmlUCSIsHiragana(code);
37360 desret_int(ret_val);
37361 call_tests++;
37362 des_int(n_code, code, 0);
37363 xmlResetLastError();
37364 if (mem_base != xmlMemBlocks()) {
37365 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037367 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037368 printf(" %d", n_code);
37369 printf("\n");
37370 }
37371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037372 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037373#endif
37374
Daniel Veillard42595322004-11-08 10:52:06 +000037375 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037376}
37377
37378
37379static int
37380test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037381 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037382
William M. Brack21e4ef22005-01-02 09:53:13 +000037383#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037384 int mem_base;
37385 int ret_val;
37386 int code; /* UCS code point */
37387 int n_code;
37388
37389 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37390 mem_base = xmlMemBlocks();
37391 code = gen_int(n_code, 0);
37392
37393 ret_val = xmlUCSIsIPAExtensions(code);
37394 desret_int(ret_val);
37395 call_tests++;
37396 des_int(n_code, code, 0);
37397 xmlResetLastError();
37398 if (mem_base != xmlMemBlocks()) {
37399 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037401 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037402 printf(" %d", n_code);
37403 printf("\n");
37404 }
37405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037406 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037407#endif
37408
Daniel Veillard42595322004-11-08 10:52:06 +000037409 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037410}
37411
37412
37413static int
37414test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037415 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037416
William M. Brack21e4ef22005-01-02 09:53:13 +000037417#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037418 int mem_base;
37419 int ret_val;
37420 int code; /* UCS code point */
37421 int n_code;
37422
37423 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37424 mem_base = xmlMemBlocks();
37425 code = gen_int(n_code, 0);
37426
37427 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37428 desret_int(ret_val);
37429 call_tests++;
37430 des_int(n_code, code, 0);
37431 xmlResetLastError();
37432 if (mem_base != xmlMemBlocks()) {
37433 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037435 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037436 printf(" %d", n_code);
37437 printf("\n");
37438 }
37439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037440 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037441#endif
37442
Daniel Veillard42595322004-11-08 10:52:06 +000037443 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037444}
37445
37446
37447static int
37448test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037449 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037450
William M. Brack21e4ef22005-01-02 09:53:13 +000037451#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037452 int mem_base;
37453 int ret_val;
37454 int code; /* UCS code point */
37455 int n_code;
37456
37457 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37458 mem_base = xmlMemBlocks();
37459 code = gen_int(n_code, 0);
37460
37461 ret_val = xmlUCSIsKanbun(code);
37462 desret_int(ret_val);
37463 call_tests++;
37464 des_int(n_code, code, 0);
37465 xmlResetLastError();
37466 if (mem_base != xmlMemBlocks()) {
37467 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037469 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037470 printf(" %d", n_code);
37471 printf("\n");
37472 }
37473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037474 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037475#endif
37476
Daniel Veillard42595322004-11-08 10:52:06 +000037477 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037478}
37479
37480
37481static int
37482test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037483 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037484
William M. Brack21e4ef22005-01-02 09:53:13 +000037485#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037486 int mem_base;
37487 int ret_val;
37488 int code; /* UCS code point */
37489 int n_code;
37490
37491 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37492 mem_base = xmlMemBlocks();
37493 code = gen_int(n_code, 0);
37494
37495 ret_val = xmlUCSIsKangxiRadicals(code);
37496 desret_int(ret_val);
37497 call_tests++;
37498 des_int(n_code, code, 0);
37499 xmlResetLastError();
37500 if (mem_base != xmlMemBlocks()) {
37501 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037503 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037504 printf(" %d", n_code);
37505 printf("\n");
37506 }
37507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037508 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037509#endif
37510
Daniel Veillard42595322004-11-08 10:52:06 +000037511 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037512}
37513
37514
37515static int
37516test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037517 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037518
William M. Brack21e4ef22005-01-02 09:53:13 +000037519#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037520 int mem_base;
37521 int ret_val;
37522 int code; /* UCS code point */
37523 int n_code;
37524
37525 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37526 mem_base = xmlMemBlocks();
37527 code = gen_int(n_code, 0);
37528
37529 ret_val = xmlUCSIsKannada(code);
37530 desret_int(ret_val);
37531 call_tests++;
37532 des_int(n_code, code, 0);
37533 xmlResetLastError();
37534 if (mem_base != xmlMemBlocks()) {
37535 printf("Leak of %d blocks found in xmlUCSIsKannada",
37536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037537 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037538 printf(" %d", n_code);
37539 printf("\n");
37540 }
37541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037542 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037543#endif
37544
Daniel Veillard42595322004-11-08 10:52:06 +000037545 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037546}
37547
37548
37549static int
37550test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037551 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037552
William M. Brack21e4ef22005-01-02 09:53:13 +000037553#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037554 int mem_base;
37555 int ret_val;
37556 int code; /* UCS code point */
37557 int n_code;
37558
37559 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37560 mem_base = xmlMemBlocks();
37561 code = gen_int(n_code, 0);
37562
37563 ret_val = xmlUCSIsKatakana(code);
37564 desret_int(ret_val);
37565 call_tests++;
37566 des_int(n_code, code, 0);
37567 xmlResetLastError();
37568 if (mem_base != xmlMemBlocks()) {
37569 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037571 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037572 printf(" %d", n_code);
37573 printf("\n");
37574 }
37575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037576 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037577#endif
37578
Daniel Veillard42595322004-11-08 10:52:06 +000037579 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037580}
37581
37582
37583static int
37584test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037585 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037586
William M. Brack21e4ef22005-01-02 09:53:13 +000037587#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037588 int mem_base;
37589 int ret_val;
37590 int code; /* UCS code point */
37591 int n_code;
37592
37593 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37594 mem_base = xmlMemBlocks();
37595 code = gen_int(n_code, 0);
37596
37597 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37598 desret_int(ret_val);
37599 call_tests++;
37600 des_int(n_code, code, 0);
37601 xmlResetLastError();
37602 if (mem_base != xmlMemBlocks()) {
37603 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037605 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037606 printf(" %d", n_code);
37607 printf("\n");
37608 }
37609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037610 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037611#endif
37612
Daniel Veillard42595322004-11-08 10:52:06 +000037613 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037614}
37615
37616
37617static int
37618test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037619 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037620
William M. Brack21e4ef22005-01-02 09:53:13 +000037621#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037622 int mem_base;
37623 int ret_val;
37624 int code; /* UCS code point */
37625 int n_code;
37626
37627 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37628 mem_base = xmlMemBlocks();
37629 code = gen_int(n_code, 0);
37630
37631 ret_val = xmlUCSIsKhmer(code);
37632 desret_int(ret_val);
37633 call_tests++;
37634 des_int(n_code, code, 0);
37635 xmlResetLastError();
37636 if (mem_base != xmlMemBlocks()) {
37637 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037639 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037640 printf(" %d", n_code);
37641 printf("\n");
37642 }
37643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037644 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037645#endif
37646
Daniel Veillard42595322004-11-08 10:52:06 +000037647 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037648}
37649
37650
37651static int
37652test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037653 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037654
William M. Brack21e4ef22005-01-02 09:53:13 +000037655#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037656 int mem_base;
37657 int ret_val;
37658 int code; /* UCS code point */
37659 int n_code;
37660
37661 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37662 mem_base = xmlMemBlocks();
37663 code = gen_int(n_code, 0);
37664
37665 ret_val = xmlUCSIsKhmerSymbols(code);
37666 desret_int(ret_val);
37667 call_tests++;
37668 des_int(n_code, code, 0);
37669 xmlResetLastError();
37670 if (mem_base != xmlMemBlocks()) {
37671 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037673 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037674 printf(" %d", n_code);
37675 printf("\n");
37676 }
37677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037678 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037679#endif
37680
Daniel Veillard42595322004-11-08 10:52:06 +000037681 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037682}
37683
37684
37685static int
37686test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037687 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037688
William M. Brack21e4ef22005-01-02 09:53:13 +000037689#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037690 int mem_base;
37691 int ret_val;
37692 int code; /* UCS code point */
37693 int n_code;
37694
37695 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37696 mem_base = xmlMemBlocks();
37697 code = gen_int(n_code, 0);
37698
37699 ret_val = xmlUCSIsLao(code);
37700 desret_int(ret_val);
37701 call_tests++;
37702 des_int(n_code, code, 0);
37703 xmlResetLastError();
37704 if (mem_base != xmlMemBlocks()) {
37705 printf("Leak of %d blocks found in xmlUCSIsLao",
37706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037707 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037708 printf(" %d", n_code);
37709 printf("\n");
37710 }
37711 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037712 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037713#endif
37714
Daniel Veillard42595322004-11-08 10:52:06 +000037715 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037716}
37717
37718
37719static int
37720test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037721 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037722
William M. Brack21e4ef22005-01-02 09:53:13 +000037723#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037724 int mem_base;
37725 int ret_val;
37726 int code; /* UCS code point */
37727 int n_code;
37728
37729 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37730 mem_base = xmlMemBlocks();
37731 code = gen_int(n_code, 0);
37732
37733 ret_val = xmlUCSIsLatin1Supplement(code);
37734 desret_int(ret_val);
37735 call_tests++;
37736 des_int(n_code, code, 0);
37737 xmlResetLastError();
37738 if (mem_base != xmlMemBlocks()) {
37739 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037741 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037742 printf(" %d", n_code);
37743 printf("\n");
37744 }
37745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037746 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037747#endif
37748
Daniel Veillard42595322004-11-08 10:52:06 +000037749 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037750}
37751
37752
37753static int
37754test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037755 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037756
William M. Brack21e4ef22005-01-02 09:53:13 +000037757#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037758 int mem_base;
37759 int ret_val;
37760 int code; /* UCS code point */
37761 int n_code;
37762
37763 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37764 mem_base = xmlMemBlocks();
37765 code = gen_int(n_code, 0);
37766
37767 ret_val = xmlUCSIsLatinExtendedA(code);
37768 desret_int(ret_val);
37769 call_tests++;
37770 des_int(n_code, code, 0);
37771 xmlResetLastError();
37772 if (mem_base != xmlMemBlocks()) {
37773 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037775 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037776 printf(" %d", n_code);
37777 printf("\n");
37778 }
37779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037780 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037781#endif
37782
Daniel Veillard42595322004-11-08 10:52:06 +000037783 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037784}
37785
37786
37787static int
37788test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037789 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037790
William M. Brack21e4ef22005-01-02 09:53:13 +000037791#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037792 int mem_base;
37793 int ret_val;
37794 int code; /* UCS code point */
37795 int n_code;
37796
37797 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37798 mem_base = xmlMemBlocks();
37799 code = gen_int(n_code, 0);
37800
37801 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37802 desret_int(ret_val);
37803 call_tests++;
37804 des_int(n_code, code, 0);
37805 xmlResetLastError();
37806 if (mem_base != xmlMemBlocks()) {
37807 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037809 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037810 printf(" %d", n_code);
37811 printf("\n");
37812 }
37813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037814 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037815#endif
37816
Daniel Veillard42595322004-11-08 10:52:06 +000037817 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037818}
37819
37820
37821static int
37822test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037823 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037824
William M. Brack21e4ef22005-01-02 09:53:13 +000037825#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037826 int mem_base;
37827 int ret_val;
37828 int code; /* UCS code point */
37829 int n_code;
37830
37831 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37832 mem_base = xmlMemBlocks();
37833 code = gen_int(n_code, 0);
37834
37835 ret_val = xmlUCSIsLatinExtendedB(code);
37836 desret_int(ret_val);
37837 call_tests++;
37838 des_int(n_code, code, 0);
37839 xmlResetLastError();
37840 if (mem_base != xmlMemBlocks()) {
37841 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037843 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037844 printf(" %d", n_code);
37845 printf("\n");
37846 }
37847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037848 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037849#endif
37850
Daniel Veillard42595322004-11-08 10:52:06 +000037851 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037852}
37853
37854
37855static int
37856test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037857 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037858
William M. Brack21e4ef22005-01-02 09:53:13 +000037859#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037860 int mem_base;
37861 int ret_val;
37862 int code; /* UCS code point */
37863 int n_code;
37864
37865 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37866 mem_base = xmlMemBlocks();
37867 code = gen_int(n_code, 0);
37868
37869 ret_val = xmlUCSIsLetterlikeSymbols(code);
37870 desret_int(ret_val);
37871 call_tests++;
37872 des_int(n_code, code, 0);
37873 xmlResetLastError();
37874 if (mem_base != xmlMemBlocks()) {
37875 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037877 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037878 printf(" %d", n_code);
37879 printf("\n");
37880 }
37881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037882 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037883#endif
37884
Daniel Veillard42595322004-11-08 10:52:06 +000037885 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037886}
37887
37888
37889static int
37890test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037891 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037892
William M. Brack21e4ef22005-01-02 09:53:13 +000037893#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037894 int mem_base;
37895 int ret_val;
37896 int code; /* UCS code point */
37897 int n_code;
37898
37899 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37900 mem_base = xmlMemBlocks();
37901 code = gen_int(n_code, 0);
37902
37903 ret_val = xmlUCSIsLimbu(code);
37904 desret_int(ret_val);
37905 call_tests++;
37906 des_int(n_code, code, 0);
37907 xmlResetLastError();
37908 if (mem_base != xmlMemBlocks()) {
37909 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037911 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037912 printf(" %d", n_code);
37913 printf("\n");
37914 }
37915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037916 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037917#endif
37918
Daniel Veillard42595322004-11-08 10:52:06 +000037919 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037920}
37921
37922
37923static int
37924test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037925 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037926
William M. Brack21e4ef22005-01-02 09:53:13 +000037927#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037928 int mem_base;
37929 int ret_val;
37930 int code; /* UCS code point */
37931 int n_code;
37932
37933 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37934 mem_base = xmlMemBlocks();
37935 code = gen_int(n_code, 0);
37936
37937 ret_val = xmlUCSIsLinearBIdeograms(code);
37938 desret_int(ret_val);
37939 call_tests++;
37940 des_int(n_code, code, 0);
37941 xmlResetLastError();
37942 if (mem_base != xmlMemBlocks()) {
37943 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037945 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037946 printf(" %d", n_code);
37947 printf("\n");
37948 }
37949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037950 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037951#endif
37952
Daniel Veillard42595322004-11-08 10:52:06 +000037953 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037954}
37955
37956
37957static int
37958test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037959 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037960
William M. Brack21e4ef22005-01-02 09:53:13 +000037961#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037962 int mem_base;
37963 int ret_val;
37964 int code; /* UCS code point */
37965 int n_code;
37966
37967 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37968 mem_base = xmlMemBlocks();
37969 code = gen_int(n_code, 0);
37970
37971 ret_val = xmlUCSIsLinearBSyllabary(code);
37972 desret_int(ret_val);
37973 call_tests++;
37974 des_int(n_code, code, 0);
37975 xmlResetLastError();
37976 if (mem_base != xmlMemBlocks()) {
37977 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037979 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037980 printf(" %d", n_code);
37981 printf("\n");
37982 }
37983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037984 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037985#endif
37986
Daniel Veillard42595322004-11-08 10:52:06 +000037987 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037988}
37989
37990
37991static int
37992test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037993 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037994
William M. Brack21e4ef22005-01-02 09:53:13 +000037995#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037996 int mem_base;
37997 int ret_val;
37998 int code; /* UCS code point */
37999 int n_code;
38000
38001 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38002 mem_base = xmlMemBlocks();
38003 code = gen_int(n_code, 0);
38004
38005 ret_val = xmlUCSIsLowSurrogates(code);
38006 desret_int(ret_val);
38007 call_tests++;
38008 des_int(n_code, code, 0);
38009 xmlResetLastError();
38010 if (mem_base != xmlMemBlocks()) {
38011 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038013 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038014 printf(" %d", n_code);
38015 printf("\n");
38016 }
38017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038018 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038019#endif
38020
Daniel Veillard42595322004-11-08 10:52:06 +000038021 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038022}
38023
38024
38025static int
38026test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038027 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038028
William M. Brack21e4ef22005-01-02 09:53:13 +000038029#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038030 int mem_base;
38031 int ret_val;
38032 int code; /* UCS code point */
38033 int n_code;
38034
38035 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38036 mem_base = xmlMemBlocks();
38037 code = gen_int(n_code, 0);
38038
38039 ret_val = xmlUCSIsMalayalam(code);
38040 desret_int(ret_val);
38041 call_tests++;
38042 des_int(n_code, code, 0);
38043 xmlResetLastError();
38044 if (mem_base != xmlMemBlocks()) {
38045 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038047 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038048 printf(" %d", n_code);
38049 printf("\n");
38050 }
38051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038052 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038053#endif
38054
Daniel Veillard42595322004-11-08 10:52:06 +000038055 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038056}
38057
38058
38059static int
38060test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038061 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038062
William M. Brack21e4ef22005-01-02 09:53:13 +000038063#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038064 int mem_base;
38065 int ret_val;
38066 int code; /* UCS code point */
38067 int n_code;
38068
38069 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38070 mem_base = xmlMemBlocks();
38071 code = gen_int(n_code, 0);
38072
38073 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38074 desret_int(ret_val);
38075 call_tests++;
38076 des_int(n_code, code, 0);
38077 xmlResetLastError();
38078 if (mem_base != xmlMemBlocks()) {
38079 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038081 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038082 printf(" %d", n_code);
38083 printf("\n");
38084 }
38085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038086 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038087#endif
38088
Daniel Veillard42595322004-11-08 10:52:06 +000038089 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038090}
38091
38092
38093static int
38094test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038095 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038096
William M. Brack21e4ef22005-01-02 09:53:13 +000038097#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038098 int mem_base;
38099 int ret_val;
38100 int code; /* UCS code point */
38101 int n_code;
38102
38103 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38104 mem_base = xmlMemBlocks();
38105 code = gen_int(n_code, 0);
38106
38107 ret_val = xmlUCSIsMathematicalOperators(code);
38108 desret_int(ret_val);
38109 call_tests++;
38110 des_int(n_code, code, 0);
38111 xmlResetLastError();
38112 if (mem_base != xmlMemBlocks()) {
38113 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038115 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038116 printf(" %d", n_code);
38117 printf("\n");
38118 }
38119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038120 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038121#endif
38122
Daniel Veillard42595322004-11-08 10:52:06 +000038123 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038124}
38125
38126
38127static int
38128test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038129 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038130
William M. Brack21e4ef22005-01-02 09:53:13 +000038131#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038132 int mem_base;
38133 int ret_val;
38134 int code; /* UCS code point */
38135 int n_code;
38136
38137 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38138 mem_base = xmlMemBlocks();
38139 code = gen_int(n_code, 0);
38140
38141 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38142 desret_int(ret_val);
38143 call_tests++;
38144 des_int(n_code, code, 0);
38145 xmlResetLastError();
38146 if (mem_base != xmlMemBlocks()) {
38147 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038149 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038150 printf(" %d", n_code);
38151 printf("\n");
38152 }
38153 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038154 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038155#endif
38156
Daniel Veillard42595322004-11-08 10:52:06 +000038157 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038158}
38159
38160
38161static int
38162test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038163 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038164
William M. Brack21e4ef22005-01-02 09:53:13 +000038165#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038166 int mem_base;
38167 int ret_val;
38168 int code; /* UCS code point */
38169 int n_code;
38170
38171 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38172 mem_base = xmlMemBlocks();
38173 code = gen_int(n_code, 0);
38174
38175 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38176 desret_int(ret_val);
38177 call_tests++;
38178 des_int(n_code, code, 0);
38179 xmlResetLastError();
38180 if (mem_base != xmlMemBlocks()) {
38181 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038183 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038184 printf(" %d", n_code);
38185 printf("\n");
38186 }
38187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038188 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038189#endif
38190
Daniel Veillard42595322004-11-08 10:52:06 +000038191 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038192}
38193
38194
38195static int
38196test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038197 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038198
William M. Brack21e4ef22005-01-02 09:53:13 +000038199#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038200 int mem_base;
38201 int ret_val;
38202 int code; /* UCS code point */
38203 int n_code;
38204
38205 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38206 mem_base = xmlMemBlocks();
38207 code = gen_int(n_code, 0);
38208
38209 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38210 desret_int(ret_val);
38211 call_tests++;
38212 des_int(n_code, code, 0);
38213 xmlResetLastError();
38214 if (mem_base != xmlMemBlocks()) {
38215 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038217 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038218 printf(" %d", n_code);
38219 printf("\n");
38220 }
38221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038222 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038223#endif
38224
Daniel Veillard42595322004-11-08 10:52:06 +000038225 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038226}
38227
38228
38229static int
38230test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038231 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038232
William M. Brack21e4ef22005-01-02 09:53:13 +000038233#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038234 int mem_base;
38235 int ret_val;
38236 int code; /* UCS code point */
38237 int n_code;
38238
38239 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38240 mem_base = xmlMemBlocks();
38241 code = gen_int(n_code, 0);
38242
38243 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38244 desret_int(ret_val);
38245 call_tests++;
38246 des_int(n_code, code, 0);
38247 xmlResetLastError();
38248 if (mem_base != xmlMemBlocks()) {
38249 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038251 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038252 printf(" %d", n_code);
38253 printf("\n");
38254 }
38255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038256 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038257#endif
38258
Daniel Veillard42595322004-11-08 10:52:06 +000038259 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038260}
38261
38262
38263static int
38264test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038265 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038266
William M. Brack21e4ef22005-01-02 09:53:13 +000038267#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038268 int mem_base;
38269 int ret_val;
38270 int code; /* UCS code point */
38271 int n_code;
38272
38273 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38274 mem_base = xmlMemBlocks();
38275 code = gen_int(n_code, 0);
38276
38277 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38278 desret_int(ret_val);
38279 call_tests++;
38280 des_int(n_code, code, 0);
38281 xmlResetLastError();
38282 if (mem_base != xmlMemBlocks()) {
38283 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038285 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038286 printf(" %d", n_code);
38287 printf("\n");
38288 }
38289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038290 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038291#endif
38292
Daniel Veillard42595322004-11-08 10:52:06 +000038293 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038294}
38295
38296
38297static int
38298test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038299 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038300
William M. Brack21e4ef22005-01-02 09:53:13 +000038301#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038302 int mem_base;
38303 int ret_val;
38304 int code; /* UCS code point */
38305 int n_code;
38306
38307 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38308 mem_base = xmlMemBlocks();
38309 code = gen_int(n_code, 0);
38310
38311 ret_val = xmlUCSIsMongolian(code);
38312 desret_int(ret_val);
38313 call_tests++;
38314 des_int(n_code, code, 0);
38315 xmlResetLastError();
38316 if (mem_base != xmlMemBlocks()) {
38317 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038319 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038320 printf(" %d", n_code);
38321 printf("\n");
38322 }
38323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038324 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038325#endif
38326
Daniel Veillard42595322004-11-08 10:52:06 +000038327 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038328}
38329
38330
38331static int
38332test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038333 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038334
William M. Brack21e4ef22005-01-02 09:53:13 +000038335#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038336 int mem_base;
38337 int ret_val;
38338 int code; /* UCS code point */
38339 int n_code;
38340
38341 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38342 mem_base = xmlMemBlocks();
38343 code = gen_int(n_code, 0);
38344
38345 ret_val = xmlUCSIsMusicalSymbols(code);
38346 desret_int(ret_val);
38347 call_tests++;
38348 des_int(n_code, code, 0);
38349 xmlResetLastError();
38350 if (mem_base != xmlMemBlocks()) {
38351 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038353 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038354 printf(" %d", n_code);
38355 printf("\n");
38356 }
38357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038358 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038359#endif
38360
Daniel Veillard42595322004-11-08 10:52:06 +000038361 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038362}
38363
38364
38365static int
38366test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038367 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038368
William M. Brack21e4ef22005-01-02 09:53:13 +000038369#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038370 int mem_base;
38371 int ret_val;
38372 int code; /* UCS code point */
38373 int n_code;
38374
38375 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38376 mem_base = xmlMemBlocks();
38377 code = gen_int(n_code, 0);
38378
38379 ret_val = xmlUCSIsMyanmar(code);
38380 desret_int(ret_val);
38381 call_tests++;
38382 des_int(n_code, code, 0);
38383 xmlResetLastError();
38384 if (mem_base != xmlMemBlocks()) {
38385 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038387 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038388 printf(" %d", n_code);
38389 printf("\n");
38390 }
38391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038392 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038393#endif
38394
Daniel Veillard42595322004-11-08 10:52:06 +000038395 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038396}
38397
38398
38399static int
38400test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038401 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038402
William M. Brack21e4ef22005-01-02 09:53:13 +000038403#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038404 int mem_base;
38405 int ret_val;
38406 int code; /* UCS code point */
38407 int n_code;
38408
38409 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38410 mem_base = xmlMemBlocks();
38411 code = gen_int(n_code, 0);
38412
38413 ret_val = xmlUCSIsNumberForms(code);
38414 desret_int(ret_val);
38415 call_tests++;
38416 des_int(n_code, code, 0);
38417 xmlResetLastError();
38418 if (mem_base != xmlMemBlocks()) {
38419 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038421 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038422 printf(" %d", n_code);
38423 printf("\n");
38424 }
38425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038426 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038427#endif
38428
Daniel Veillard42595322004-11-08 10:52:06 +000038429 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038430}
38431
38432
38433static int
38434test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038435 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038436
William M. Brack21e4ef22005-01-02 09:53:13 +000038437#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038438 int mem_base;
38439 int ret_val;
38440 int code; /* UCS code point */
38441 int n_code;
38442
38443 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38444 mem_base = xmlMemBlocks();
38445 code = gen_int(n_code, 0);
38446
38447 ret_val = xmlUCSIsOgham(code);
38448 desret_int(ret_val);
38449 call_tests++;
38450 des_int(n_code, code, 0);
38451 xmlResetLastError();
38452 if (mem_base != xmlMemBlocks()) {
38453 printf("Leak of %d blocks found in xmlUCSIsOgham",
38454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038455 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038456 printf(" %d", n_code);
38457 printf("\n");
38458 }
38459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038460 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038461#endif
38462
Daniel Veillard42595322004-11-08 10:52:06 +000038463 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038464}
38465
38466
38467static int
38468test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038469 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038470
William M. Brack21e4ef22005-01-02 09:53:13 +000038471#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038472 int mem_base;
38473 int ret_val;
38474 int code; /* UCS code point */
38475 int n_code;
38476
38477 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38478 mem_base = xmlMemBlocks();
38479 code = gen_int(n_code, 0);
38480
38481 ret_val = xmlUCSIsOldItalic(code);
38482 desret_int(ret_val);
38483 call_tests++;
38484 des_int(n_code, code, 0);
38485 xmlResetLastError();
38486 if (mem_base != xmlMemBlocks()) {
38487 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038489 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038490 printf(" %d", n_code);
38491 printf("\n");
38492 }
38493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038494 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038495#endif
38496
Daniel Veillard42595322004-11-08 10:52:06 +000038497 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038498}
38499
38500
38501static int
38502test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038503 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038504
William M. Brack21e4ef22005-01-02 09:53:13 +000038505#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038506 int mem_base;
38507 int ret_val;
38508 int code; /* UCS code point */
38509 int n_code;
38510
38511 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38512 mem_base = xmlMemBlocks();
38513 code = gen_int(n_code, 0);
38514
38515 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38516 desret_int(ret_val);
38517 call_tests++;
38518 des_int(n_code, code, 0);
38519 xmlResetLastError();
38520 if (mem_base != xmlMemBlocks()) {
38521 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038523 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038524 printf(" %d", n_code);
38525 printf("\n");
38526 }
38527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038528 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038529#endif
38530
Daniel Veillard42595322004-11-08 10:52:06 +000038531 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038532}
38533
38534
38535static int
38536test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038537 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038538
William M. Brack21e4ef22005-01-02 09:53:13 +000038539#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038540 int mem_base;
38541 int ret_val;
38542 int code; /* UCS code point */
38543 int n_code;
38544
38545 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38546 mem_base = xmlMemBlocks();
38547 code = gen_int(n_code, 0);
38548
38549 ret_val = xmlUCSIsOriya(code);
38550 desret_int(ret_val);
38551 call_tests++;
38552 des_int(n_code, code, 0);
38553 xmlResetLastError();
38554 if (mem_base != xmlMemBlocks()) {
38555 printf("Leak of %d blocks found in xmlUCSIsOriya",
38556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038557 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038558 printf(" %d", n_code);
38559 printf("\n");
38560 }
38561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038562 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038563#endif
38564
Daniel Veillard42595322004-11-08 10:52:06 +000038565 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038566}
38567
38568
38569static int
38570test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038571 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038572
William M. Brack21e4ef22005-01-02 09:53:13 +000038573#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038574 int mem_base;
38575 int ret_val;
38576 int code; /* UCS code point */
38577 int n_code;
38578
38579 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38580 mem_base = xmlMemBlocks();
38581 code = gen_int(n_code, 0);
38582
38583 ret_val = xmlUCSIsOsmanya(code);
38584 desret_int(ret_val);
38585 call_tests++;
38586 des_int(n_code, code, 0);
38587 xmlResetLastError();
38588 if (mem_base != xmlMemBlocks()) {
38589 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038591 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038592 printf(" %d", n_code);
38593 printf("\n");
38594 }
38595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038596 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038597#endif
38598
Daniel Veillard42595322004-11-08 10:52:06 +000038599 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038600}
38601
38602
38603static int
38604test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038605 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038606
William M. Brack21e4ef22005-01-02 09:53:13 +000038607#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038608 int mem_base;
38609 int ret_val;
38610 int code; /* UCS code point */
38611 int n_code;
38612
38613 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38614 mem_base = xmlMemBlocks();
38615 code = gen_int(n_code, 0);
38616
38617 ret_val = xmlUCSIsPhoneticExtensions(code);
38618 desret_int(ret_val);
38619 call_tests++;
38620 des_int(n_code, code, 0);
38621 xmlResetLastError();
38622 if (mem_base != xmlMemBlocks()) {
38623 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038625 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038626 printf(" %d", n_code);
38627 printf("\n");
38628 }
38629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038630 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038631#endif
38632
Daniel Veillard42595322004-11-08 10:52:06 +000038633 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038634}
38635
38636
38637static int
38638test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038639 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038640
William M. Brack21e4ef22005-01-02 09:53:13 +000038641#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038642 int mem_base;
38643 int ret_val;
38644 int code; /* UCS code point */
38645 int n_code;
38646
38647 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38648 mem_base = xmlMemBlocks();
38649 code = gen_int(n_code, 0);
38650
38651 ret_val = xmlUCSIsPrivateUse(code);
38652 desret_int(ret_val);
38653 call_tests++;
38654 des_int(n_code, code, 0);
38655 xmlResetLastError();
38656 if (mem_base != xmlMemBlocks()) {
38657 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038659 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038660 printf(" %d", n_code);
38661 printf("\n");
38662 }
38663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038664 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038665#endif
38666
Daniel Veillard42595322004-11-08 10:52:06 +000038667 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038668}
38669
38670
38671static int
38672test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038673 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038674
William M. Brack21e4ef22005-01-02 09:53:13 +000038675#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038676 int mem_base;
38677 int ret_val;
38678 int code; /* UCS code point */
38679 int n_code;
38680
38681 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38682 mem_base = xmlMemBlocks();
38683 code = gen_int(n_code, 0);
38684
38685 ret_val = xmlUCSIsPrivateUseArea(code);
38686 desret_int(ret_val);
38687 call_tests++;
38688 des_int(n_code, code, 0);
38689 xmlResetLastError();
38690 if (mem_base != xmlMemBlocks()) {
38691 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038693 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038694 printf(" %d", n_code);
38695 printf("\n");
38696 }
38697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038698 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038699#endif
38700
Daniel Veillard42595322004-11-08 10:52:06 +000038701 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038702}
38703
38704
38705static int
38706test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038707 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038708
William M. Brack21e4ef22005-01-02 09:53:13 +000038709#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038710 int mem_base;
38711 int ret_val;
38712 int code; /* UCS code point */
38713 int n_code;
38714
38715 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38716 mem_base = xmlMemBlocks();
38717 code = gen_int(n_code, 0);
38718
38719 ret_val = xmlUCSIsRunic(code);
38720 desret_int(ret_val);
38721 call_tests++;
38722 des_int(n_code, code, 0);
38723 xmlResetLastError();
38724 if (mem_base != xmlMemBlocks()) {
38725 printf("Leak of %d blocks found in xmlUCSIsRunic",
38726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038727 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038728 printf(" %d", n_code);
38729 printf("\n");
38730 }
38731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038732 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038733#endif
38734
Daniel Veillard42595322004-11-08 10:52:06 +000038735 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038736}
38737
38738
38739static int
38740test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038741 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038742
William M. Brack21e4ef22005-01-02 09:53:13 +000038743#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038744 int mem_base;
38745 int ret_val;
38746 int code; /* UCS code point */
38747 int n_code;
38748
38749 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38750 mem_base = xmlMemBlocks();
38751 code = gen_int(n_code, 0);
38752
38753 ret_val = xmlUCSIsShavian(code);
38754 desret_int(ret_val);
38755 call_tests++;
38756 des_int(n_code, code, 0);
38757 xmlResetLastError();
38758 if (mem_base != xmlMemBlocks()) {
38759 printf("Leak of %d blocks found in xmlUCSIsShavian",
38760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038761 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038762 printf(" %d", n_code);
38763 printf("\n");
38764 }
38765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038766 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038767#endif
38768
Daniel Veillard42595322004-11-08 10:52:06 +000038769 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038770}
38771
38772
38773static int
38774test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038775 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038776
William M. Brack21e4ef22005-01-02 09:53:13 +000038777#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038778 int mem_base;
38779 int ret_val;
38780 int code; /* UCS code point */
38781 int n_code;
38782
38783 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38784 mem_base = xmlMemBlocks();
38785 code = gen_int(n_code, 0);
38786
38787 ret_val = xmlUCSIsSinhala(code);
38788 desret_int(ret_val);
38789 call_tests++;
38790 des_int(n_code, code, 0);
38791 xmlResetLastError();
38792 if (mem_base != xmlMemBlocks()) {
38793 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038795 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038796 printf(" %d", n_code);
38797 printf("\n");
38798 }
38799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038800 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038801#endif
38802
Daniel Veillard42595322004-11-08 10:52:06 +000038803 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038804}
38805
38806
38807static int
38808test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038809 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038810
William M. Brack21e4ef22005-01-02 09:53:13 +000038811#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038812 int mem_base;
38813 int ret_val;
38814 int code; /* UCS code point */
38815 int n_code;
38816
38817 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38818 mem_base = xmlMemBlocks();
38819 code = gen_int(n_code, 0);
38820
38821 ret_val = xmlUCSIsSmallFormVariants(code);
38822 desret_int(ret_val);
38823 call_tests++;
38824 des_int(n_code, code, 0);
38825 xmlResetLastError();
38826 if (mem_base != xmlMemBlocks()) {
38827 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038829 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038830 printf(" %d", n_code);
38831 printf("\n");
38832 }
38833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038834 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038835#endif
38836
Daniel Veillard42595322004-11-08 10:52:06 +000038837 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038838}
38839
38840
38841static int
38842test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038843 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038844
William M. Brack21e4ef22005-01-02 09:53:13 +000038845#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038846 int mem_base;
38847 int ret_val;
38848 int code; /* UCS code point */
38849 int n_code;
38850
38851 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38852 mem_base = xmlMemBlocks();
38853 code = gen_int(n_code, 0);
38854
38855 ret_val = xmlUCSIsSpacingModifierLetters(code);
38856 desret_int(ret_val);
38857 call_tests++;
38858 des_int(n_code, code, 0);
38859 xmlResetLastError();
38860 if (mem_base != xmlMemBlocks()) {
38861 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038863 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038864 printf(" %d", n_code);
38865 printf("\n");
38866 }
38867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038868 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038869#endif
38870
Daniel Veillard42595322004-11-08 10:52:06 +000038871 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038872}
38873
38874
38875static int
38876test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038877 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038878
William M. Brack21e4ef22005-01-02 09:53:13 +000038879#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038880 int mem_base;
38881 int ret_val;
38882 int code; /* UCS code point */
38883 int n_code;
38884
38885 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38886 mem_base = xmlMemBlocks();
38887 code = gen_int(n_code, 0);
38888
38889 ret_val = xmlUCSIsSpecials(code);
38890 desret_int(ret_val);
38891 call_tests++;
38892 des_int(n_code, code, 0);
38893 xmlResetLastError();
38894 if (mem_base != xmlMemBlocks()) {
38895 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038897 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038898 printf(" %d", n_code);
38899 printf("\n");
38900 }
38901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038902 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038903#endif
38904
Daniel Veillard42595322004-11-08 10:52:06 +000038905 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038906}
38907
38908
38909static int
38910test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038911 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038912
William M. Brack21e4ef22005-01-02 09:53:13 +000038913#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038914 int mem_base;
38915 int ret_val;
38916 int code; /* UCS code point */
38917 int n_code;
38918
38919 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38920 mem_base = xmlMemBlocks();
38921 code = gen_int(n_code, 0);
38922
38923 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38924 desret_int(ret_val);
38925 call_tests++;
38926 des_int(n_code, code, 0);
38927 xmlResetLastError();
38928 if (mem_base != xmlMemBlocks()) {
38929 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038931 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038932 printf(" %d", n_code);
38933 printf("\n");
38934 }
38935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038936 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038937#endif
38938
Daniel Veillard42595322004-11-08 10:52:06 +000038939 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038940}
38941
38942
38943static int
38944test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038945 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038946
William M. Brack21e4ef22005-01-02 09:53:13 +000038947#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038948 int mem_base;
38949 int ret_val;
38950 int code; /* UCS code point */
38951 int n_code;
38952
38953 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38954 mem_base = xmlMemBlocks();
38955 code = gen_int(n_code, 0);
38956
38957 ret_val = xmlUCSIsSupplementalArrowsA(code);
38958 desret_int(ret_val);
38959 call_tests++;
38960 des_int(n_code, code, 0);
38961 xmlResetLastError();
38962 if (mem_base != xmlMemBlocks()) {
38963 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038965 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038966 printf(" %d", n_code);
38967 printf("\n");
38968 }
38969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038970 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038971#endif
38972
Daniel Veillard42595322004-11-08 10:52:06 +000038973 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038974}
38975
38976
38977static int
38978test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038979 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038980
William M. Brack21e4ef22005-01-02 09:53:13 +000038981#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038982 int mem_base;
38983 int ret_val;
38984 int code; /* UCS code point */
38985 int n_code;
38986
38987 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38988 mem_base = xmlMemBlocks();
38989 code = gen_int(n_code, 0);
38990
38991 ret_val = xmlUCSIsSupplementalArrowsB(code);
38992 desret_int(ret_val);
38993 call_tests++;
38994 des_int(n_code, code, 0);
38995 xmlResetLastError();
38996 if (mem_base != xmlMemBlocks()) {
38997 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038999 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039000 printf(" %d", n_code);
39001 printf("\n");
39002 }
39003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039004 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039005#endif
39006
Daniel Veillard42595322004-11-08 10:52:06 +000039007 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039008}
39009
39010
39011static int
39012test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039013 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039014
William M. Brack21e4ef22005-01-02 09:53:13 +000039015#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039016 int mem_base;
39017 int ret_val;
39018 int code; /* UCS code point */
39019 int n_code;
39020
39021 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39022 mem_base = xmlMemBlocks();
39023 code = gen_int(n_code, 0);
39024
39025 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39026 desret_int(ret_val);
39027 call_tests++;
39028 des_int(n_code, code, 0);
39029 xmlResetLastError();
39030 if (mem_base != xmlMemBlocks()) {
39031 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039033 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039034 printf(" %d", n_code);
39035 printf("\n");
39036 }
39037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039038 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039039#endif
39040
Daniel Veillard42595322004-11-08 10:52:06 +000039041 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039042}
39043
39044
39045static int
39046test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039047 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039048
William M. Brack21e4ef22005-01-02 09:53:13 +000039049#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039050 int mem_base;
39051 int ret_val;
39052 int code; /* UCS code point */
39053 int n_code;
39054
39055 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39056 mem_base = xmlMemBlocks();
39057 code = gen_int(n_code, 0);
39058
39059 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39060 desret_int(ret_val);
39061 call_tests++;
39062 des_int(n_code, code, 0);
39063 xmlResetLastError();
39064 if (mem_base != xmlMemBlocks()) {
39065 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039067 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039068 printf(" %d", n_code);
39069 printf("\n");
39070 }
39071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039072 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039073#endif
39074
Daniel Veillard42595322004-11-08 10:52:06 +000039075 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039076}
39077
39078
39079static int
39080test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039081 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039082
William M. Brack21e4ef22005-01-02 09:53:13 +000039083#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039084 int mem_base;
39085 int ret_val;
39086 int code; /* UCS code point */
39087 int n_code;
39088
39089 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39090 mem_base = xmlMemBlocks();
39091 code = gen_int(n_code, 0);
39092
39093 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39094 desret_int(ret_val);
39095 call_tests++;
39096 des_int(n_code, code, 0);
39097 xmlResetLastError();
39098 if (mem_base != xmlMemBlocks()) {
39099 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039101 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039102 printf(" %d", n_code);
39103 printf("\n");
39104 }
39105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039106 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039107#endif
39108
Daniel Veillard42595322004-11-08 10:52:06 +000039109 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039110}
39111
39112
39113static int
39114test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039115 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039116
William M. Brack21e4ef22005-01-02 09:53:13 +000039117#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039118 int mem_base;
39119 int ret_val;
39120 int code; /* UCS code point */
39121 int n_code;
39122
39123 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39124 mem_base = xmlMemBlocks();
39125 code = gen_int(n_code, 0);
39126
39127 ret_val = xmlUCSIsSyriac(code);
39128 desret_int(ret_val);
39129 call_tests++;
39130 des_int(n_code, code, 0);
39131 xmlResetLastError();
39132 if (mem_base != xmlMemBlocks()) {
39133 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039135 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039136 printf(" %d", n_code);
39137 printf("\n");
39138 }
39139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039140 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039141#endif
39142
Daniel Veillard42595322004-11-08 10:52:06 +000039143 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039144}
39145
39146
39147static int
39148test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039149 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039150
William M. Brack21e4ef22005-01-02 09:53:13 +000039151#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039152 int mem_base;
39153 int ret_val;
39154 int code; /* UCS code point */
39155 int n_code;
39156
39157 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39158 mem_base = xmlMemBlocks();
39159 code = gen_int(n_code, 0);
39160
39161 ret_val = xmlUCSIsTagalog(code);
39162 desret_int(ret_val);
39163 call_tests++;
39164 des_int(n_code, code, 0);
39165 xmlResetLastError();
39166 if (mem_base != xmlMemBlocks()) {
39167 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039169 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039170 printf(" %d", n_code);
39171 printf("\n");
39172 }
39173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039174 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039175#endif
39176
Daniel Veillard42595322004-11-08 10:52:06 +000039177 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039178}
39179
39180
39181static int
39182test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039183 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039184
William M. Brack21e4ef22005-01-02 09:53:13 +000039185#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039186 int mem_base;
39187 int ret_val;
39188 int code; /* UCS code point */
39189 int n_code;
39190
39191 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39192 mem_base = xmlMemBlocks();
39193 code = gen_int(n_code, 0);
39194
39195 ret_val = xmlUCSIsTagbanwa(code);
39196 desret_int(ret_val);
39197 call_tests++;
39198 des_int(n_code, code, 0);
39199 xmlResetLastError();
39200 if (mem_base != xmlMemBlocks()) {
39201 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039203 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039204 printf(" %d", n_code);
39205 printf("\n");
39206 }
39207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039208 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039209#endif
39210
Daniel Veillard42595322004-11-08 10:52:06 +000039211 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039212}
39213
39214
39215static int
39216test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039217 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039218
William M. Brack21e4ef22005-01-02 09:53:13 +000039219#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039220 int mem_base;
39221 int ret_val;
39222 int code; /* UCS code point */
39223 int n_code;
39224
39225 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39226 mem_base = xmlMemBlocks();
39227 code = gen_int(n_code, 0);
39228
39229 ret_val = xmlUCSIsTags(code);
39230 desret_int(ret_val);
39231 call_tests++;
39232 des_int(n_code, code, 0);
39233 xmlResetLastError();
39234 if (mem_base != xmlMemBlocks()) {
39235 printf("Leak of %d blocks found in xmlUCSIsTags",
39236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039237 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039238 printf(" %d", n_code);
39239 printf("\n");
39240 }
39241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039242 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039243#endif
39244
Daniel Veillard42595322004-11-08 10:52:06 +000039245 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039246}
39247
39248
39249static int
39250test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039251 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039252
William M. Brack21e4ef22005-01-02 09:53:13 +000039253#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039254 int mem_base;
39255 int ret_val;
39256 int code; /* UCS code point */
39257 int n_code;
39258
39259 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39260 mem_base = xmlMemBlocks();
39261 code = gen_int(n_code, 0);
39262
39263 ret_val = xmlUCSIsTaiLe(code);
39264 desret_int(ret_val);
39265 call_tests++;
39266 des_int(n_code, code, 0);
39267 xmlResetLastError();
39268 if (mem_base != xmlMemBlocks()) {
39269 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039271 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039272 printf(" %d", n_code);
39273 printf("\n");
39274 }
39275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039276 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039277#endif
39278
Daniel Veillard42595322004-11-08 10:52:06 +000039279 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039280}
39281
39282
39283static int
39284test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039285 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039286
William M. Brack21e4ef22005-01-02 09:53:13 +000039287#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039288 int mem_base;
39289 int ret_val;
39290 int code; /* UCS code point */
39291 int n_code;
39292
39293 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39294 mem_base = xmlMemBlocks();
39295 code = gen_int(n_code, 0);
39296
39297 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39298 desret_int(ret_val);
39299 call_tests++;
39300 des_int(n_code, code, 0);
39301 xmlResetLastError();
39302 if (mem_base != xmlMemBlocks()) {
39303 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039305 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039306 printf(" %d", n_code);
39307 printf("\n");
39308 }
39309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039310 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039311#endif
39312
Daniel Veillard42595322004-11-08 10:52:06 +000039313 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039314}
39315
39316
39317static int
39318test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039319 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039320
William M. Brack21e4ef22005-01-02 09:53:13 +000039321#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039322 int mem_base;
39323 int ret_val;
39324 int code; /* UCS code point */
39325 int n_code;
39326
39327 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39328 mem_base = xmlMemBlocks();
39329 code = gen_int(n_code, 0);
39330
39331 ret_val = xmlUCSIsTamil(code);
39332 desret_int(ret_val);
39333 call_tests++;
39334 des_int(n_code, code, 0);
39335 xmlResetLastError();
39336 if (mem_base != xmlMemBlocks()) {
39337 printf("Leak of %d blocks found in xmlUCSIsTamil",
39338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039339 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039340 printf(" %d", n_code);
39341 printf("\n");
39342 }
39343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039344 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039345#endif
39346
Daniel Veillard42595322004-11-08 10:52:06 +000039347 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039348}
39349
39350
39351static int
39352test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039353 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039354
William M. Brack21e4ef22005-01-02 09:53:13 +000039355#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039356 int mem_base;
39357 int ret_val;
39358 int code; /* UCS code point */
39359 int n_code;
39360
39361 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39362 mem_base = xmlMemBlocks();
39363 code = gen_int(n_code, 0);
39364
39365 ret_val = xmlUCSIsTelugu(code);
39366 desret_int(ret_val);
39367 call_tests++;
39368 des_int(n_code, code, 0);
39369 xmlResetLastError();
39370 if (mem_base != xmlMemBlocks()) {
39371 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039373 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039374 printf(" %d", n_code);
39375 printf("\n");
39376 }
39377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039378 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039379#endif
39380
Daniel Veillard42595322004-11-08 10:52:06 +000039381 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039382}
39383
39384
39385static int
39386test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039387 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039388
William M. Brack21e4ef22005-01-02 09:53:13 +000039389#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039390 int mem_base;
39391 int ret_val;
39392 int code; /* UCS code point */
39393 int n_code;
39394
39395 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39396 mem_base = xmlMemBlocks();
39397 code = gen_int(n_code, 0);
39398
39399 ret_val = xmlUCSIsThaana(code);
39400 desret_int(ret_val);
39401 call_tests++;
39402 des_int(n_code, code, 0);
39403 xmlResetLastError();
39404 if (mem_base != xmlMemBlocks()) {
39405 printf("Leak of %d blocks found in xmlUCSIsThaana",
39406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039407 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039408 printf(" %d", n_code);
39409 printf("\n");
39410 }
39411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039412 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039413#endif
39414
Daniel Veillard42595322004-11-08 10:52:06 +000039415 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039416}
39417
39418
39419static int
39420test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039421 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039422
William M. Brack21e4ef22005-01-02 09:53:13 +000039423#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039424 int mem_base;
39425 int ret_val;
39426 int code; /* UCS code point */
39427 int n_code;
39428
39429 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39430 mem_base = xmlMemBlocks();
39431 code = gen_int(n_code, 0);
39432
39433 ret_val = xmlUCSIsThai(code);
39434 desret_int(ret_val);
39435 call_tests++;
39436 des_int(n_code, code, 0);
39437 xmlResetLastError();
39438 if (mem_base != xmlMemBlocks()) {
39439 printf("Leak of %d blocks found in xmlUCSIsThai",
39440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039441 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039442 printf(" %d", n_code);
39443 printf("\n");
39444 }
39445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039446 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039447#endif
39448
Daniel Veillard42595322004-11-08 10:52:06 +000039449 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039450}
39451
39452
39453static int
39454test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039455 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039456
William M. Brack21e4ef22005-01-02 09:53:13 +000039457#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039458 int mem_base;
39459 int ret_val;
39460 int code; /* UCS code point */
39461 int n_code;
39462
39463 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39464 mem_base = xmlMemBlocks();
39465 code = gen_int(n_code, 0);
39466
39467 ret_val = xmlUCSIsTibetan(code);
39468 desret_int(ret_val);
39469 call_tests++;
39470 des_int(n_code, code, 0);
39471 xmlResetLastError();
39472 if (mem_base != xmlMemBlocks()) {
39473 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039475 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039476 printf(" %d", n_code);
39477 printf("\n");
39478 }
39479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039480 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039481#endif
39482
Daniel Veillard42595322004-11-08 10:52:06 +000039483 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039484}
39485
39486
39487static int
39488test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039489 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039490
William M. Brack21e4ef22005-01-02 09:53:13 +000039491#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039492 int mem_base;
39493 int ret_val;
39494 int code; /* UCS code point */
39495 int n_code;
39496
39497 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39498 mem_base = xmlMemBlocks();
39499 code = gen_int(n_code, 0);
39500
39501 ret_val = xmlUCSIsUgaritic(code);
39502 desret_int(ret_val);
39503 call_tests++;
39504 des_int(n_code, code, 0);
39505 xmlResetLastError();
39506 if (mem_base != xmlMemBlocks()) {
39507 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039509 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039510 printf(" %d", n_code);
39511 printf("\n");
39512 }
39513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039514 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039515#endif
39516
Daniel Veillard42595322004-11-08 10:52:06 +000039517 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039518}
39519
39520
39521static int
39522test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039523 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039524
William M. Brack21e4ef22005-01-02 09:53:13 +000039525#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039526 int mem_base;
39527 int ret_val;
39528 int code; /* UCS code point */
39529 int n_code;
39530
39531 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39532 mem_base = xmlMemBlocks();
39533 code = gen_int(n_code, 0);
39534
39535 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39536 desret_int(ret_val);
39537 call_tests++;
39538 des_int(n_code, code, 0);
39539 xmlResetLastError();
39540 if (mem_base != xmlMemBlocks()) {
39541 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039543 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039544 printf(" %d", n_code);
39545 printf("\n");
39546 }
39547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039548 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039549#endif
39550
Daniel Veillard42595322004-11-08 10:52:06 +000039551 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039552}
39553
39554
39555static int
39556test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039557 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039558
William M. Brack21e4ef22005-01-02 09:53:13 +000039559#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039560 int mem_base;
39561 int ret_val;
39562 int code; /* UCS code point */
39563 int n_code;
39564
39565 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39566 mem_base = xmlMemBlocks();
39567 code = gen_int(n_code, 0);
39568
39569 ret_val = xmlUCSIsVariationSelectors(code);
39570 desret_int(ret_val);
39571 call_tests++;
39572 des_int(n_code, code, 0);
39573 xmlResetLastError();
39574 if (mem_base != xmlMemBlocks()) {
39575 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039577 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039578 printf(" %d", n_code);
39579 printf("\n");
39580 }
39581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039582 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039583#endif
39584
Daniel Veillard42595322004-11-08 10:52:06 +000039585 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039586}
39587
39588
39589static int
39590test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039591 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039592
William M. Brack21e4ef22005-01-02 09:53:13 +000039593#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039594 int mem_base;
39595 int ret_val;
39596 int code; /* UCS code point */
39597 int n_code;
39598
39599 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39600 mem_base = xmlMemBlocks();
39601 code = gen_int(n_code, 0);
39602
39603 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39604 desret_int(ret_val);
39605 call_tests++;
39606 des_int(n_code, code, 0);
39607 xmlResetLastError();
39608 if (mem_base != xmlMemBlocks()) {
39609 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039611 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039612 printf(" %d", n_code);
39613 printf("\n");
39614 }
39615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039616 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039617#endif
39618
Daniel Veillard42595322004-11-08 10:52:06 +000039619 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039620}
39621
39622
39623static int
39624test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039625 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039626
William M. Brack21e4ef22005-01-02 09:53:13 +000039627#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039628 int mem_base;
39629 int ret_val;
39630 int code; /* UCS code point */
39631 int n_code;
39632
39633 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39634 mem_base = xmlMemBlocks();
39635 code = gen_int(n_code, 0);
39636
39637 ret_val = xmlUCSIsYiRadicals(code);
39638 desret_int(ret_val);
39639 call_tests++;
39640 des_int(n_code, code, 0);
39641 xmlResetLastError();
39642 if (mem_base != xmlMemBlocks()) {
39643 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039645 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039646 printf(" %d", n_code);
39647 printf("\n");
39648 }
39649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039650 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039651#endif
39652
Daniel Veillard42595322004-11-08 10:52:06 +000039653 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039654}
39655
39656
39657static int
39658test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039659 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039660
William M. Brack21e4ef22005-01-02 09:53:13 +000039661#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039662 int mem_base;
39663 int ret_val;
39664 int code; /* UCS code point */
39665 int n_code;
39666
39667 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39668 mem_base = xmlMemBlocks();
39669 code = gen_int(n_code, 0);
39670
39671 ret_val = xmlUCSIsYiSyllables(code);
39672 desret_int(ret_val);
39673 call_tests++;
39674 des_int(n_code, code, 0);
39675 xmlResetLastError();
39676 if (mem_base != xmlMemBlocks()) {
39677 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039679 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039680 printf(" %d", n_code);
39681 printf("\n");
39682 }
39683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039684 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039685#endif
39686
Daniel Veillard42595322004-11-08 10:52:06 +000039687 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039688}
39689
39690
39691static int
39692test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039693 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039694
William M. Brack21e4ef22005-01-02 09:53:13 +000039695#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039696 int mem_base;
39697 int ret_val;
39698 int code; /* UCS code point */
39699 int n_code;
39700
39701 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39702 mem_base = xmlMemBlocks();
39703 code = gen_int(n_code, 0);
39704
39705 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39706 desret_int(ret_val);
39707 call_tests++;
39708 des_int(n_code, code, 0);
39709 xmlResetLastError();
39710 if (mem_base != xmlMemBlocks()) {
39711 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039713 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039714 printf(" %d", n_code);
39715 printf("\n");
39716 }
39717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039718 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039719#endif
39720
Daniel Veillard42595322004-11-08 10:52:06 +000039721 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039722}
39723
39724static int
39725test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039726 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039727
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039728 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039729 test_ret += test_xmlUCSIsAegeanNumbers();
39730 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39731 test_ret += test_xmlUCSIsArabic();
39732 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39733 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39734 test_ret += test_xmlUCSIsArmenian();
39735 test_ret += test_xmlUCSIsArrows();
39736 test_ret += test_xmlUCSIsBasicLatin();
39737 test_ret += test_xmlUCSIsBengali();
39738 test_ret += test_xmlUCSIsBlock();
39739 test_ret += test_xmlUCSIsBlockElements();
39740 test_ret += test_xmlUCSIsBopomofo();
39741 test_ret += test_xmlUCSIsBopomofoExtended();
39742 test_ret += test_xmlUCSIsBoxDrawing();
39743 test_ret += test_xmlUCSIsBraillePatterns();
39744 test_ret += test_xmlUCSIsBuhid();
39745 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39746 test_ret += test_xmlUCSIsCJKCompatibility();
39747 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39748 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39749 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39750 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39751 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39752 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39753 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39754 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39755 test_ret += test_xmlUCSIsCat();
39756 test_ret += test_xmlUCSIsCatC();
39757 test_ret += test_xmlUCSIsCatCc();
39758 test_ret += test_xmlUCSIsCatCf();
39759 test_ret += test_xmlUCSIsCatCo();
39760 test_ret += test_xmlUCSIsCatCs();
39761 test_ret += test_xmlUCSIsCatL();
39762 test_ret += test_xmlUCSIsCatLl();
39763 test_ret += test_xmlUCSIsCatLm();
39764 test_ret += test_xmlUCSIsCatLo();
39765 test_ret += test_xmlUCSIsCatLt();
39766 test_ret += test_xmlUCSIsCatLu();
39767 test_ret += test_xmlUCSIsCatM();
39768 test_ret += test_xmlUCSIsCatMc();
39769 test_ret += test_xmlUCSIsCatMe();
39770 test_ret += test_xmlUCSIsCatMn();
39771 test_ret += test_xmlUCSIsCatN();
39772 test_ret += test_xmlUCSIsCatNd();
39773 test_ret += test_xmlUCSIsCatNl();
39774 test_ret += test_xmlUCSIsCatNo();
39775 test_ret += test_xmlUCSIsCatP();
39776 test_ret += test_xmlUCSIsCatPc();
39777 test_ret += test_xmlUCSIsCatPd();
39778 test_ret += test_xmlUCSIsCatPe();
39779 test_ret += test_xmlUCSIsCatPf();
39780 test_ret += test_xmlUCSIsCatPi();
39781 test_ret += test_xmlUCSIsCatPo();
39782 test_ret += test_xmlUCSIsCatPs();
39783 test_ret += test_xmlUCSIsCatS();
39784 test_ret += test_xmlUCSIsCatSc();
39785 test_ret += test_xmlUCSIsCatSk();
39786 test_ret += test_xmlUCSIsCatSm();
39787 test_ret += test_xmlUCSIsCatSo();
39788 test_ret += test_xmlUCSIsCatZ();
39789 test_ret += test_xmlUCSIsCatZl();
39790 test_ret += test_xmlUCSIsCatZp();
39791 test_ret += test_xmlUCSIsCatZs();
39792 test_ret += test_xmlUCSIsCherokee();
39793 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39794 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39795 test_ret += test_xmlUCSIsCombiningHalfMarks();
39796 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39797 test_ret += test_xmlUCSIsControlPictures();
39798 test_ret += test_xmlUCSIsCurrencySymbols();
39799 test_ret += test_xmlUCSIsCypriotSyllabary();
39800 test_ret += test_xmlUCSIsCyrillic();
39801 test_ret += test_xmlUCSIsCyrillicSupplement();
39802 test_ret += test_xmlUCSIsDeseret();
39803 test_ret += test_xmlUCSIsDevanagari();
39804 test_ret += test_xmlUCSIsDingbats();
39805 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39806 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39807 test_ret += test_xmlUCSIsEthiopic();
39808 test_ret += test_xmlUCSIsGeneralPunctuation();
39809 test_ret += test_xmlUCSIsGeometricShapes();
39810 test_ret += test_xmlUCSIsGeorgian();
39811 test_ret += test_xmlUCSIsGothic();
39812 test_ret += test_xmlUCSIsGreek();
39813 test_ret += test_xmlUCSIsGreekExtended();
39814 test_ret += test_xmlUCSIsGreekandCoptic();
39815 test_ret += test_xmlUCSIsGujarati();
39816 test_ret += test_xmlUCSIsGurmukhi();
39817 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39818 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39819 test_ret += test_xmlUCSIsHangulJamo();
39820 test_ret += test_xmlUCSIsHangulSyllables();
39821 test_ret += test_xmlUCSIsHanunoo();
39822 test_ret += test_xmlUCSIsHebrew();
39823 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39824 test_ret += test_xmlUCSIsHighSurrogates();
39825 test_ret += test_xmlUCSIsHiragana();
39826 test_ret += test_xmlUCSIsIPAExtensions();
39827 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39828 test_ret += test_xmlUCSIsKanbun();
39829 test_ret += test_xmlUCSIsKangxiRadicals();
39830 test_ret += test_xmlUCSIsKannada();
39831 test_ret += test_xmlUCSIsKatakana();
39832 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39833 test_ret += test_xmlUCSIsKhmer();
39834 test_ret += test_xmlUCSIsKhmerSymbols();
39835 test_ret += test_xmlUCSIsLao();
39836 test_ret += test_xmlUCSIsLatin1Supplement();
39837 test_ret += test_xmlUCSIsLatinExtendedA();
39838 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39839 test_ret += test_xmlUCSIsLatinExtendedB();
39840 test_ret += test_xmlUCSIsLetterlikeSymbols();
39841 test_ret += test_xmlUCSIsLimbu();
39842 test_ret += test_xmlUCSIsLinearBIdeograms();
39843 test_ret += test_xmlUCSIsLinearBSyllabary();
39844 test_ret += test_xmlUCSIsLowSurrogates();
39845 test_ret += test_xmlUCSIsMalayalam();
39846 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39847 test_ret += test_xmlUCSIsMathematicalOperators();
39848 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39849 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39850 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39851 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39852 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39853 test_ret += test_xmlUCSIsMongolian();
39854 test_ret += test_xmlUCSIsMusicalSymbols();
39855 test_ret += test_xmlUCSIsMyanmar();
39856 test_ret += test_xmlUCSIsNumberForms();
39857 test_ret += test_xmlUCSIsOgham();
39858 test_ret += test_xmlUCSIsOldItalic();
39859 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39860 test_ret += test_xmlUCSIsOriya();
39861 test_ret += test_xmlUCSIsOsmanya();
39862 test_ret += test_xmlUCSIsPhoneticExtensions();
39863 test_ret += test_xmlUCSIsPrivateUse();
39864 test_ret += test_xmlUCSIsPrivateUseArea();
39865 test_ret += test_xmlUCSIsRunic();
39866 test_ret += test_xmlUCSIsShavian();
39867 test_ret += test_xmlUCSIsSinhala();
39868 test_ret += test_xmlUCSIsSmallFormVariants();
39869 test_ret += test_xmlUCSIsSpacingModifierLetters();
39870 test_ret += test_xmlUCSIsSpecials();
39871 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39872 test_ret += test_xmlUCSIsSupplementalArrowsA();
39873 test_ret += test_xmlUCSIsSupplementalArrowsB();
39874 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39875 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39876 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39877 test_ret += test_xmlUCSIsSyriac();
39878 test_ret += test_xmlUCSIsTagalog();
39879 test_ret += test_xmlUCSIsTagbanwa();
39880 test_ret += test_xmlUCSIsTags();
39881 test_ret += test_xmlUCSIsTaiLe();
39882 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39883 test_ret += test_xmlUCSIsTamil();
39884 test_ret += test_xmlUCSIsTelugu();
39885 test_ret += test_xmlUCSIsThaana();
39886 test_ret += test_xmlUCSIsThai();
39887 test_ret += test_xmlUCSIsTibetan();
39888 test_ret += test_xmlUCSIsUgaritic();
39889 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39890 test_ret += test_xmlUCSIsVariationSelectors();
39891 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39892 test_ret += test_xmlUCSIsYiRadicals();
39893 test_ret += test_xmlUCSIsYiSyllables();
39894 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039895
Daniel Veillard42595322004-11-08 10:52:06 +000039896 if (test_ret != 0)
39897 printf("Module xmlunicode: %d errors\n", test_ret);
39898 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039899}
39900
39901static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039902test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039904
William M. Brack21e4ef22005-01-02 09:53:13 +000039905#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039906 int mem_base;
39907 xmlTextWriterPtr ret_val;
39908 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39909 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039910
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039911 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39912 mem_base = xmlMemBlocks();
39913 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039914
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039915 ret_val = xmlNewTextWriter(out);
39916 if (ret_val != NULL) out = NULL;
39917 desret_xmlTextWriterPtr(ret_val);
39918 call_tests++;
39919 des_xmlOutputBufferPtr(n_out, out, 0);
39920 xmlResetLastError();
39921 if (mem_base != xmlMemBlocks()) {
39922 printf("Leak of %d blocks found in xmlNewTextWriter",
39923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039924 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039925 printf(" %d", n_out);
39926 printf("\n");
39927 }
39928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039929 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039930#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039931
Daniel Veillard42595322004-11-08 10:52:06 +000039932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039933}
39934
39935
39936static int
39937test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039939
William M. Brack21e4ef22005-01-02 09:53:13 +000039940#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039941 int mem_base;
39942 xmlTextWriterPtr ret_val;
39943 const char * uri; /* the URI of the resource for the output */
39944 int n_uri;
39945 int compression; /* compress the output? */
39946 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039947
Daniel Veillard42595322004-11-08 10:52:06 +000039948 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039949 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39950 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039951 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039952 compression = gen_int(n_compression, 1);
39953
39954 ret_val = xmlNewTextWriterFilename(uri, compression);
39955 desret_xmlTextWriterPtr(ret_val);
39956 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039957 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039958 des_int(n_compression, compression, 1);
39959 xmlResetLastError();
39960 if (mem_base != xmlMemBlocks()) {
39961 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039963 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039964 printf(" %d", n_uri);
39965 printf(" %d", n_compression);
39966 printf("\n");
39967 }
39968 }
39969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039970 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039971#endif
39972
Daniel Veillard42595322004-11-08 10:52:06 +000039973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039974}
39975
39976
39977static int
39978test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039980
William M. Brack21e4ef22005-01-02 09:53:13 +000039981#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039982 int mem_base;
39983 xmlTextWriterPtr ret_val;
39984 xmlBufferPtr buf; /* xmlBufferPtr */
39985 int n_buf;
39986 int compression; /* compress the output? */
39987 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039988
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039989 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39990 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39991 mem_base = xmlMemBlocks();
39992 buf = gen_xmlBufferPtr(n_buf, 0);
39993 compression = gen_int(n_compression, 1);
39994
39995 ret_val = xmlNewTextWriterMemory(buf, compression);
39996 desret_xmlTextWriterPtr(ret_val);
39997 call_tests++;
39998 des_xmlBufferPtr(n_buf, buf, 0);
39999 des_int(n_compression, compression, 1);
40000 xmlResetLastError();
40001 if (mem_base != xmlMemBlocks()) {
40002 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040004 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040005 printf(" %d", n_buf);
40006 printf(" %d", n_compression);
40007 printf("\n");
40008 }
40009 }
40010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040011 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040012#endif
40013
Daniel Veillard42595322004-11-08 10:52:06 +000040014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040015}
40016
40017
40018static int
40019test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040021
William M. Brack21e4ef22005-01-02 09:53:13 +000040022#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040023 int mem_base;
40024 xmlTextWriterPtr ret_val;
40025 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40026 int n_ctxt;
40027 int compression; /* compress the output? */
40028 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040029
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040030 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40031 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40032 mem_base = xmlMemBlocks();
40033 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40034 compression = gen_int(n_compression, 1);
40035
40036 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040037 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040038 desret_xmlTextWriterPtr(ret_val);
40039 call_tests++;
40040 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40041 des_int(n_compression, compression, 1);
40042 xmlResetLastError();
40043 if (mem_base != xmlMemBlocks()) {
40044 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040046 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040047 printf(" %d", n_ctxt);
40048 printf(" %d", n_compression);
40049 printf("\n");
40050 }
40051 }
40052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040053 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040054#endif
40055
Daniel Veillard42595322004-11-08 10:52:06 +000040056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040057}
40058
40059
40060static int
40061test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040063
William M. Brack21e4ef22005-01-02 09:53:13 +000040064#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040065 int mem_base;
40066 xmlTextWriterPtr ret_val;
40067 xmlDocPtr doc; /* xmlDocPtr */
40068 int n_doc;
40069 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40070 int n_node;
40071 int compression; /* compress the output? */
40072 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040073
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040074 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40075 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40076 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40077 mem_base = xmlMemBlocks();
40078 doc = gen_xmlDocPtr(n_doc, 0);
40079 node = gen_xmlNodePtr(n_node, 1);
40080 compression = gen_int(n_compression, 2);
40081
40082 ret_val = xmlNewTextWriterTree(doc, node, compression);
40083 desret_xmlTextWriterPtr(ret_val);
40084 call_tests++;
40085 des_xmlDocPtr(n_doc, doc, 0);
40086 des_xmlNodePtr(n_node, node, 1);
40087 des_int(n_compression, compression, 2);
40088 xmlResetLastError();
40089 if (mem_base != xmlMemBlocks()) {
40090 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040092 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040093 printf(" %d", n_doc);
40094 printf(" %d", n_node);
40095 printf(" %d", n_compression);
40096 printf("\n");
40097 }
40098 }
40099 }
40100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040101 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040102#endif
40103
Daniel Veillard42595322004-11-08 10:52:06 +000040104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040105}
40106
40107
40108static int
40109test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040111
William M. Brack21e4ef22005-01-02 09:53:13 +000040112#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040113 int mem_base;
40114 int ret_val;
40115 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40116 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040117
Daniel Veillarde43cc572004-11-03 11:50:29 +000040118 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40119 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040120 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040121
40122 ret_val = xmlTextWriterEndAttribute(writer);
40123 desret_int(ret_val);
40124 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040125 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040126 xmlResetLastError();
40127 if (mem_base != xmlMemBlocks()) {
40128 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040130 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040131 printf(" %d", n_writer);
40132 printf("\n");
40133 }
40134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040135 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040136#endif
40137
Daniel Veillard42595322004-11-08 10:52:06 +000040138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040139}
40140
40141
40142static int
40143test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040145
William M. Brack21e4ef22005-01-02 09:53:13 +000040146#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040147 int mem_base;
40148 int ret_val;
40149 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40150 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040151
Daniel Veillarde43cc572004-11-03 11:50:29 +000040152 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040154 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040155
40156 ret_val = xmlTextWriterEndCDATA(writer);
40157 desret_int(ret_val);
40158 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040159 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040160 xmlResetLastError();
40161 if (mem_base != xmlMemBlocks()) {
40162 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040164 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040165 printf(" %d", n_writer);
40166 printf("\n");
40167 }
40168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040169 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040170#endif
40171
Daniel Veillard42595322004-11-08 10:52:06 +000040172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040173}
40174
40175
40176static int
40177test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040179
William M. Brack21e4ef22005-01-02 09:53:13 +000040180#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040181 int mem_base;
40182 int ret_val;
40183 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40184 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040185
Daniel Veillarde43cc572004-11-03 11:50:29 +000040186 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040188 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040189
40190 ret_val = xmlTextWriterEndComment(writer);
40191 desret_int(ret_val);
40192 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040193 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040194 xmlResetLastError();
40195 if (mem_base != xmlMemBlocks()) {
40196 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040198 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040199 printf(" %d", n_writer);
40200 printf("\n");
40201 }
40202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040203 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040204#endif
40205
Daniel Veillard42595322004-11-08 10:52:06 +000040206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040207}
40208
40209
40210static int
40211test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040213
William M. Brack21e4ef22005-01-02 09:53:13 +000040214#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040215 int mem_base;
40216 int ret_val;
40217 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40218 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040219
Daniel Veillarde43cc572004-11-03 11:50:29 +000040220 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040222 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040223
40224 ret_val = xmlTextWriterEndDTD(writer);
40225 desret_int(ret_val);
40226 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040227 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040228 xmlResetLastError();
40229 if (mem_base != xmlMemBlocks()) {
40230 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040232 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040233 printf(" %d", n_writer);
40234 printf("\n");
40235 }
40236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040237 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040238#endif
40239
Daniel Veillard42595322004-11-08 10:52:06 +000040240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040241}
40242
40243
40244static int
40245test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040247
William M. Brack21e4ef22005-01-02 09:53:13 +000040248#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040249 int mem_base;
40250 int ret_val;
40251 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40252 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040253
Daniel Veillarde43cc572004-11-03 11:50:29 +000040254 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40255 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040256 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040257
40258 ret_val = xmlTextWriterEndDTDAttlist(writer);
40259 desret_int(ret_val);
40260 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040261 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040262 xmlResetLastError();
40263 if (mem_base != xmlMemBlocks()) {
40264 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040266 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040267 printf(" %d", n_writer);
40268 printf("\n");
40269 }
40270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040271 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040272#endif
40273
Daniel Veillard42595322004-11-08 10:52:06 +000040274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040275}
40276
40277
40278static int
40279test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040281
William M. Brack21e4ef22005-01-02 09:53:13 +000040282#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040283 int mem_base;
40284 int ret_val;
40285 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40286 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040287
Daniel Veillarde43cc572004-11-03 11:50:29 +000040288 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40289 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040290 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040291
40292 ret_val = xmlTextWriterEndDTDElement(writer);
40293 desret_int(ret_val);
40294 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040295 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040296 xmlResetLastError();
40297 if (mem_base != xmlMemBlocks()) {
40298 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040300 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040301 printf(" %d", n_writer);
40302 printf("\n");
40303 }
40304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040305 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040306#endif
40307
Daniel Veillard42595322004-11-08 10:52:06 +000040308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040309}
40310
40311
40312static int
40313test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040315
William M. Brack21e4ef22005-01-02 09:53:13 +000040316#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040317 int mem_base;
40318 int ret_val;
40319 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40320 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040321
Daniel Veillarde43cc572004-11-03 11:50:29 +000040322 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040324 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040325
40326 ret_val = xmlTextWriterEndDTDEntity(writer);
40327 desret_int(ret_val);
40328 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040329 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040330 xmlResetLastError();
40331 if (mem_base != xmlMemBlocks()) {
40332 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040334 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040335 printf(" %d", n_writer);
40336 printf("\n");
40337 }
40338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040339 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040340#endif
40341
Daniel Veillard42595322004-11-08 10:52:06 +000040342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040343}
40344
40345
40346static int
40347test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040349
William M. Brack21e4ef22005-01-02 09:53:13 +000040350#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040351 int mem_base;
40352 int ret_val;
40353 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40354 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040355
Daniel Veillarde43cc572004-11-03 11:50:29 +000040356 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40357 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040358 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040359
40360 ret_val = xmlTextWriterEndDocument(writer);
40361 desret_int(ret_val);
40362 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040363 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040364 xmlResetLastError();
40365 if (mem_base != xmlMemBlocks()) {
40366 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040368 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040369 printf(" %d", n_writer);
40370 printf("\n");
40371 }
40372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040373 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040374#endif
40375
Daniel Veillard42595322004-11-08 10:52:06 +000040376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040377}
40378
40379
40380static int
40381test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040383
William M. Brack21e4ef22005-01-02 09:53:13 +000040384#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040385 int mem_base;
40386 int ret_val;
40387 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40388 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040389
Daniel Veillarde43cc572004-11-03 11:50:29 +000040390 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40391 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040392 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040393
40394 ret_val = xmlTextWriterEndElement(writer);
40395 desret_int(ret_val);
40396 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040397 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040398 xmlResetLastError();
40399 if (mem_base != xmlMemBlocks()) {
40400 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040402 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040403 printf(" %d", n_writer);
40404 printf("\n");
40405 }
40406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040407 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040408#endif
40409
Daniel Veillard42595322004-11-08 10:52:06 +000040410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040411}
40412
40413
40414static int
40415test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040417
William M. Brack21e4ef22005-01-02 09:53:13 +000040418#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040419 int mem_base;
40420 int ret_val;
40421 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40422 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040423
Daniel Veillarde43cc572004-11-03 11:50:29 +000040424 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040426 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040427
40428 ret_val = xmlTextWriterEndPI(writer);
40429 desret_int(ret_val);
40430 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040431 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040432 xmlResetLastError();
40433 if (mem_base != xmlMemBlocks()) {
40434 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040436 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040437 printf(" %d", n_writer);
40438 printf("\n");
40439 }
40440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040441 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040442#endif
40443
Daniel Veillard42595322004-11-08 10:52:06 +000040444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040445}
40446
40447
40448static int
40449test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040451
William M. Brack21e4ef22005-01-02 09:53:13 +000040452#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040453 int mem_base;
40454 int ret_val;
40455 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40456 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040457
Daniel Veillarde43cc572004-11-03 11:50:29 +000040458 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40459 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040460 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040461
40462 ret_val = xmlTextWriterFlush(writer);
40463 desret_int(ret_val);
40464 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040465 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040466 xmlResetLastError();
40467 if (mem_base != xmlMemBlocks()) {
40468 printf("Leak of %d blocks found in xmlTextWriterFlush",
40469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040470 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040471 printf(" %d", n_writer);
40472 printf("\n");
40473 }
40474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040475 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040476#endif
40477
Daniel Veillard42595322004-11-08 10:52:06 +000040478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040479}
40480
40481
40482static int
40483test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040485
William M. Brack21e4ef22005-01-02 09:53:13 +000040486#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040487 int mem_base;
40488 int ret_val;
40489 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40490 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040491
Daniel Veillarde43cc572004-11-03 11:50:29 +000040492 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40493 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040494 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040495
40496 ret_val = xmlTextWriterFullEndElement(writer);
40497 desret_int(ret_val);
40498 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040499 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040500 xmlResetLastError();
40501 if (mem_base != xmlMemBlocks()) {
40502 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040504 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040505 printf(" %d", n_writer);
40506 printf("\n");
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_xmlTextWriterSetIndent(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;
40525 int indent; /* do indentation? */
40526 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040527
Daniel Veillarde43cc572004-11-03 11:50:29 +000040528 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40529 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40530 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040531 writer = gen_xmlTextWriterPtr(n_writer, 0);
40532 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040533
40534 ret_val = xmlTextWriterSetIndent(writer, indent);
40535 desret_int(ret_val);
40536 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040537 des_xmlTextWriterPtr(n_writer, writer, 0);
40538 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040539 xmlResetLastError();
40540 if (mem_base != xmlMemBlocks()) {
40541 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040543 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040544 printf(" %d", n_writer);
40545 printf(" %d", n_indent);
40546 printf("\n");
40547 }
40548 }
40549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040550 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040551#endif
40552
Daniel Veillard42595322004-11-08 10:52:06 +000040553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040554}
40555
40556
40557static int
40558test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040560
William M. Brack21e4ef22005-01-02 09:53:13 +000040561#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040562 int mem_base;
40563 int ret_val;
40564 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40565 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040566 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040567 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040568
Daniel Veillarde43cc572004-11-03 11:50:29 +000040569 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40570 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40571 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040572 writer = gen_xmlTextWriterPtr(n_writer, 0);
40573 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040574
William M. Brackf13f77f2004-11-12 16:03:48 +000040575 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040576 desret_int(ret_val);
40577 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040578 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040579 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040580 xmlResetLastError();
40581 if (mem_base != xmlMemBlocks()) {
40582 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040584 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040585 printf(" %d", n_writer);
40586 printf(" %d", n_str);
40587 printf("\n");
40588 }
40589 }
40590 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040591 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040592#endif
40593
Daniel Veillard42595322004-11-08 10:52:06 +000040594 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040595}
40596
40597
40598static int
40599test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040600 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040601
William M. Brack21e4ef22005-01-02 09:53:13 +000040602#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040603 int mem_base;
40604 int ret_val;
40605 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40606 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040607 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040608 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040609
Daniel Veillarde43cc572004-11-03 11:50:29 +000040610 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40611 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40612 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040613 writer = gen_xmlTextWriterPtr(n_writer, 0);
40614 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040615
William M. Brackf13f77f2004-11-12 16:03:48 +000040616 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040617 desret_int(ret_val);
40618 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040619 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040620 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040621 xmlResetLastError();
40622 if (mem_base != xmlMemBlocks()) {
40623 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040625 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040626 printf(" %d", n_writer);
40627 printf(" %d", n_name);
40628 printf("\n");
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_xmlTextWriterStartAttributeNS(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 * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040649 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040650 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040651 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040652 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040653 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040654
Daniel Veillarde43cc572004-11-03 11:50:29 +000040655 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40656 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40657 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40658 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40659 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040660 writer = gen_xmlTextWriterPtr(n_writer, 0);
40661 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40662 name = gen_const_xmlChar_ptr(n_name, 2);
40663 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040664
William M. Brackf13f77f2004-11-12 16:03:48 +000040665 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040666 desret_int(ret_val);
40667 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040668 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040669 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40670 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40671 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040672 xmlResetLastError();
40673 if (mem_base != xmlMemBlocks()) {
40674 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040676 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040677 printf(" %d", n_writer);
40678 printf(" %d", n_prefix);
40679 printf(" %d", n_name);
40680 printf(" %d", n_namespaceURI);
40681 printf("\n");
40682 }
40683 }
40684 }
40685 }
40686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040687 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040688#endif
40689
Daniel Veillard42595322004-11-08 10:52:06 +000040690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040691}
40692
40693
40694static int
40695test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040697
William M. Brack21e4ef22005-01-02 09:53:13 +000040698#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040699 int mem_base;
40700 int ret_val;
40701 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40702 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040703
Daniel Veillarde43cc572004-11-03 11:50:29 +000040704 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040706 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040707
40708 ret_val = xmlTextWriterStartCDATA(writer);
40709 desret_int(ret_val);
40710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040711 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040712 xmlResetLastError();
40713 if (mem_base != xmlMemBlocks()) {
40714 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040716 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040717 printf(" %d", n_writer);
40718 printf("\n");
40719 }
40720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040721 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040722#endif
40723
Daniel Veillard42595322004-11-08 10:52:06 +000040724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040725}
40726
40727
40728static int
40729test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040731
William M. Brack21e4ef22005-01-02 09:53:13 +000040732#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040733 int mem_base;
40734 int ret_val;
40735 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40736 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040737
Daniel Veillarde43cc572004-11-03 11:50:29 +000040738 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40739 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040740 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040741
40742 ret_val = xmlTextWriterStartComment(writer);
40743 desret_int(ret_val);
40744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040745 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040746 xmlResetLastError();
40747 if (mem_base != xmlMemBlocks()) {
40748 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040750 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040751 printf(" %d", n_writer);
40752 printf("\n");
40753 }
40754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040755 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040756#endif
40757
Daniel Veillard42595322004-11-08 10:52:06 +000040758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040759}
40760
40761
40762static int
40763test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040765
William M. Brack21e4ef22005-01-02 09:53:13 +000040766#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040767 int mem_base;
40768 int ret_val;
40769 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40770 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040771 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040772 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040773 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040774 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040775 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040776 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040777
Daniel Veillarde43cc572004-11-03 11:50:29 +000040778 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40779 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40780 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40781 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040783 writer = gen_xmlTextWriterPtr(n_writer, 0);
40784 name = gen_const_xmlChar_ptr(n_name, 1);
40785 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40786 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040787
William M. Brackf13f77f2004-11-12 16:03:48 +000040788 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040789 desret_int(ret_val);
40790 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040791 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040792 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40793 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
40794 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040795 xmlResetLastError();
40796 if (mem_base != xmlMemBlocks()) {
40797 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040799 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040800 printf(" %d", n_writer);
40801 printf(" %d", n_name);
40802 printf(" %d", n_pubid);
40803 printf(" %d", n_sysid);
40804 printf("\n");
40805 }
40806 }
40807 }
40808 }
40809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040810 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040811#endif
40812
Daniel Veillard42595322004-11-08 10:52:06 +000040813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040814}
40815
40816
40817static int
40818test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040820
William M. Brack21e4ef22005-01-02 09:53:13 +000040821#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040822 int mem_base;
40823 int ret_val;
40824 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40825 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040826 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040827 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040828
Daniel Veillarde43cc572004-11-03 11:50:29 +000040829 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40830 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40831 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040832 writer = gen_xmlTextWriterPtr(n_writer, 0);
40833 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040834
William M. Brackf13f77f2004-11-12 16:03:48 +000040835 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040836 desret_int(ret_val);
40837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040838 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040839 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040840 xmlResetLastError();
40841 if (mem_base != xmlMemBlocks()) {
40842 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040844 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040845 printf(" %d", n_writer);
40846 printf(" %d", n_name);
40847 printf("\n");
40848 }
40849 }
40850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040851 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040852#endif
40853
Daniel Veillard42595322004-11-08 10:52:06 +000040854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040855}
40856
40857
40858static int
40859test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040861
William M. Brack21e4ef22005-01-02 09:53:13 +000040862#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040863 int mem_base;
40864 int ret_val;
40865 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40866 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040867 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040868 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040869
Daniel Veillarde43cc572004-11-03 11:50:29 +000040870 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40871 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040873 writer = gen_xmlTextWriterPtr(n_writer, 0);
40874 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040875
William M. Brackf13f77f2004-11-12 16:03:48 +000040876 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877 desret_int(ret_val);
40878 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040879 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040880 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040881 xmlResetLastError();
40882 if (mem_base != xmlMemBlocks()) {
40883 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040885 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040886 printf(" %d", n_writer);
40887 printf(" %d", n_name);
40888 printf("\n");
40889 }
40890 }
40891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040892 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040893#endif
40894
Daniel Veillard42595322004-11-08 10:52:06 +000040895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040896}
40897
40898
40899static int
40900test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040902
William M. Brack21e4ef22005-01-02 09:53:13 +000040903#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040904 int mem_base;
40905 int ret_val;
40906 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40907 int n_writer;
40908 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40909 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040910 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040911 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040912
Daniel Veillarde43cc572004-11-03 11:50:29 +000040913 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40914 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40915 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040917 writer = gen_xmlTextWriterPtr(n_writer, 0);
40918 pe = gen_int(n_pe, 1);
40919 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040920
William M. Brackf13f77f2004-11-12 16:03:48 +000040921 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040922 desret_int(ret_val);
40923 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040924 des_xmlTextWriterPtr(n_writer, writer, 0);
40925 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000040926 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040927 xmlResetLastError();
40928 if (mem_base != xmlMemBlocks()) {
40929 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040931 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040932 printf(" %d", n_writer);
40933 printf(" %d", n_pe);
40934 printf(" %d", n_name);
40935 printf("\n");
40936 }
40937 }
40938 }
40939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040940 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040941#endif
40942
Daniel Veillard42595322004-11-08 10:52:06 +000040943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040944}
40945
40946
40947static int
40948test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040950
William M. Brack21e4ef22005-01-02 09:53:13 +000040951#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040952 int mem_base;
40953 int ret_val;
40954 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40955 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040956 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040957 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040958 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040959 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040960 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040961 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040962
Daniel Veillarde43cc572004-11-03 11:50:29 +000040963 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40964 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40965 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40966 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040968 writer = gen_xmlTextWriterPtr(n_writer, 0);
40969 version = gen_const_char_ptr(n_version, 1);
40970 encoding = gen_const_char_ptr(n_encoding, 2);
40971 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040972
William M. Brackf13f77f2004-11-12 16:03:48 +000040973 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040974 desret_int(ret_val);
40975 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040976 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040977 des_const_char_ptr(n_version, (const char *)version, 1);
40978 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
40979 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040980 xmlResetLastError();
40981 if (mem_base != xmlMemBlocks()) {
40982 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040984 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040985 printf(" %d", n_writer);
40986 printf(" %d", n_version);
40987 printf(" %d", n_encoding);
40988 printf(" %d", n_standalone);
40989 printf("\n");
40990 }
40991 }
40992 }
40993 }
40994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040995 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040996#endif
40997
Daniel Veillard42595322004-11-08 10:52:06 +000040998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040999}
41000
41001
41002static int
41003test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041005
William M. Brack21e4ef22005-01-02 09:53:13 +000041006#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041007 int mem_base;
41008 int ret_val;
41009 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41010 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041011 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041012 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041013
Daniel Veillarde43cc572004-11-03 11:50:29 +000041014 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41015 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041017 writer = gen_xmlTextWriterPtr(n_writer, 0);
41018 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041019
William M. Brackf13f77f2004-11-12 16:03:48 +000041020 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041021 desret_int(ret_val);
41022 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041023 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041024 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041025 xmlResetLastError();
41026 if (mem_base != xmlMemBlocks()) {
41027 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041029 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041030 printf(" %d", n_writer);
41031 printf(" %d", n_name);
41032 printf("\n");
41033 }
41034 }
41035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041036 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041037#endif
41038
Daniel Veillard42595322004-11-08 10:52:06 +000041039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041040}
41041
41042
41043static int
41044test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041046
William M. Brack21e4ef22005-01-02 09:53:13 +000041047#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041048 int mem_base;
41049 int ret_val;
41050 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41051 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041052 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041053 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041054 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041055 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041056 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041057 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041058
Daniel Veillarde43cc572004-11-03 11:50:29 +000041059 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41060 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41061 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41062 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41063 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041064 writer = gen_xmlTextWriterPtr(n_writer, 0);
41065 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41066 name = gen_const_xmlChar_ptr(n_name, 2);
41067 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041068
William M. Brackf13f77f2004-11-12 16:03:48 +000041069 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041070 desret_int(ret_val);
41071 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041072 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041073 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41074 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41075 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041076 xmlResetLastError();
41077 if (mem_base != xmlMemBlocks()) {
41078 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041080 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041081 printf(" %d", n_writer);
41082 printf(" %d", n_prefix);
41083 printf(" %d", n_name);
41084 printf(" %d", n_namespaceURI);
41085 printf("\n");
41086 }
41087 }
41088 }
41089 }
41090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041091 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041092#endif
41093
Daniel Veillard42595322004-11-08 10:52:06 +000041094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041095}
41096
41097
41098static int
41099test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041101
William M. Brack21e4ef22005-01-02 09:53:13 +000041102#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041103 int mem_base;
41104 int ret_val;
41105 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41106 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041107 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041108 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041109
Daniel Veillarde43cc572004-11-03 11:50:29 +000041110 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41111 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041113 writer = gen_xmlTextWriterPtr(n_writer, 0);
41114 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041115
William M. Brackf13f77f2004-11-12 16:03:48 +000041116 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041117 desret_int(ret_val);
41118 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041119 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041120 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041121 xmlResetLastError();
41122 if (mem_base != xmlMemBlocks()) {
41123 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041125 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041126 printf(" %d", n_writer);
41127 printf(" %d", n_target);
41128 printf("\n");
41129 }
41130 }
41131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041132 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041133#endif
41134
Daniel Veillard42595322004-11-08 10:52:06 +000041135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041136}
41137
41138
41139static int
41140test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041142
William M. Brack21e4ef22005-01-02 09:53:13 +000041143#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041144 int mem_base;
41145 int ret_val;
41146 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41147 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041148 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041149 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041150 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041151 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041152
Daniel Veillarde43cc572004-11-03 11:50:29 +000041153 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41154 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41155 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41156 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041157 writer = gen_xmlTextWriterPtr(n_writer, 0);
41158 name = gen_const_xmlChar_ptr(n_name, 1);
41159 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041160
William M. Brackf13f77f2004-11-12 16:03:48 +000041161 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041162 desret_int(ret_val);
41163 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041164 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041165 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41166 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041167 xmlResetLastError();
41168 if (mem_base != xmlMemBlocks()) {
41169 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041171 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041172 printf(" %d", n_writer);
41173 printf(" %d", n_name);
41174 printf(" %d", n_content);
41175 printf("\n");
41176 }
41177 }
41178 }
41179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041180 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041181#endif
41182
Daniel Veillard42595322004-11-08 10:52:06 +000041183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041184}
41185
41186
41187static int
41188test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041190
William M. Brack21e4ef22005-01-02 09:53:13 +000041191#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041192 int mem_base;
41193 int ret_val;
41194 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41195 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041196 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041197 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041198 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041199 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041200 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041201 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041202 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041203 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041204
Daniel Veillarde43cc572004-11-03 11:50:29 +000041205 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41206 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41207 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41208 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41209 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41210 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041211 writer = gen_xmlTextWriterPtr(n_writer, 0);
41212 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41213 name = gen_const_xmlChar_ptr(n_name, 2);
41214 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41215 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041216
William M. Brackf13f77f2004-11-12 16:03:48 +000041217 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041218 desret_int(ret_val);
41219 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041220 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041221 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41222 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41223 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41224 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041225 xmlResetLastError();
41226 if (mem_base != xmlMemBlocks()) {
41227 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041229 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041230 printf(" %d", n_writer);
41231 printf(" %d", n_prefix);
41232 printf(" %d", n_name);
41233 printf(" %d", n_namespaceURI);
41234 printf(" %d", n_content);
41235 printf("\n");
41236 }
41237 }
41238 }
41239 }
41240 }
41241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041242 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041243#endif
41244
Daniel Veillard42595322004-11-08 10:52:06 +000041245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041246}
41247
41248
41249static int
41250test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041252
William M. Brack21e4ef22005-01-02 09:53:13 +000041253#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041254 int mem_base;
41255 int ret_val;
41256 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41257 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041258 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041259 int n_data;
41260 int start; /* the position within the data of the first byte to encode */
41261 int n_start;
41262 int len; /* the number of bytes to encode */
41263 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041264
Daniel Veillarde43cc572004-11-03 11:50:29 +000041265 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41266 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41267 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41268 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41269 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041270 writer = gen_xmlTextWriterPtr(n_writer, 0);
41271 data = gen_const_char_ptr(n_data, 1);
41272 start = gen_int(n_start, 2);
41273 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041274
William M. Brackf13f77f2004-11-12 16:03:48 +000041275 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041276 desret_int(ret_val);
41277 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041278 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041279 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041280 des_int(n_start, start, 2);
41281 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041282 xmlResetLastError();
41283 if (mem_base != xmlMemBlocks()) {
41284 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041286 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041287 printf(" %d", n_writer);
41288 printf(" %d", n_data);
41289 printf(" %d", n_start);
41290 printf(" %d", n_len);
41291 printf("\n");
41292 }
41293 }
41294 }
41295 }
41296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041297 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041298#endif
41299
Daniel Veillard42595322004-11-08 10:52:06 +000041300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041301}
41302
41303
41304static int
41305test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041307
William M. Brack21e4ef22005-01-02 09:53:13 +000041308#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041309 int mem_base;
41310 int ret_val;
41311 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41312 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041313 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041314 int n_data;
41315 int start; /* the position within the data of the first byte to encode */
41316 int n_start;
41317 int len; /* the number of bytes to encode */
41318 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041319
Daniel Veillarde43cc572004-11-03 11:50:29 +000041320 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41321 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41322 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41323 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041325 writer = gen_xmlTextWriterPtr(n_writer, 0);
41326 data = gen_const_char_ptr(n_data, 1);
41327 start = gen_int(n_start, 2);
41328 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041329
William M. Brackf13f77f2004-11-12 16:03:48 +000041330 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041331 desret_int(ret_val);
41332 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041333 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041334 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041335 des_int(n_start, start, 2);
41336 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041337 xmlResetLastError();
41338 if (mem_base != xmlMemBlocks()) {
41339 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041341 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041342 printf(" %d", n_writer);
41343 printf(" %d", n_data);
41344 printf(" %d", n_start);
41345 printf(" %d", n_len);
41346 printf("\n");
41347 }
41348 }
41349 }
41350 }
41351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041352 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041353#endif
41354
Daniel Veillard42595322004-11-08 10:52:06 +000041355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041356}
41357
41358
41359static int
41360test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041362
William M. Brack21e4ef22005-01-02 09:53:13 +000041363#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041364 int mem_base;
41365 int ret_val;
41366 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41367 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041368 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041369 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041370
Daniel Veillarde43cc572004-11-03 11:50:29 +000041371 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41372 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041374 writer = gen_xmlTextWriterPtr(n_writer, 0);
41375 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041376
William M. Brackf13f77f2004-11-12 16:03:48 +000041377 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041378 desret_int(ret_val);
41379 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041380 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041381 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041382 xmlResetLastError();
41383 if (mem_base != xmlMemBlocks()) {
41384 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041386 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041387 printf(" %d", n_writer);
41388 printf(" %d", n_content);
41389 printf("\n");
41390 }
41391 }
41392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041393 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041394#endif
41395
Daniel Veillard42595322004-11-08 10:52:06 +000041396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041397}
41398
41399
41400static int
41401test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041403
William M. Brack21e4ef22005-01-02 09:53:13 +000041404#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041405 int mem_base;
41406 int ret_val;
41407 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41408 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041409 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041410 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041411
Daniel Veillarde43cc572004-11-03 11:50:29 +000041412 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41413 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41414 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041415 writer = gen_xmlTextWriterPtr(n_writer, 0);
41416 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041417
William M. Brackf13f77f2004-11-12 16:03:48 +000041418 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041419 desret_int(ret_val);
41420 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041421 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041422 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041423 xmlResetLastError();
41424 if (mem_base != xmlMemBlocks()) {
41425 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041427 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041428 printf(" %d", n_writer);
41429 printf(" %d", n_content);
41430 printf("\n");
41431 }
41432 }
41433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041434 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041435#endif
41436
Daniel Veillard42595322004-11-08 10:52:06 +000041437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041438}
41439
41440
41441static int
41442test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041444
William M. Brack21e4ef22005-01-02 09:53:13 +000041445#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041446 int mem_base;
41447 int ret_val;
41448 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41449 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041450 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041451 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041452 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041453 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041454 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041455 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041456 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041457 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041458
Daniel Veillarde43cc572004-11-03 11:50:29 +000041459 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41460 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41461 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41462 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41463 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041465 writer = gen_xmlTextWriterPtr(n_writer, 0);
41466 name = gen_const_xmlChar_ptr(n_name, 1);
41467 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41468 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41469 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041470
William M. Brackf13f77f2004-11-12 16:03:48 +000041471 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041472 desret_int(ret_val);
41473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041474 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041475 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41476 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41477 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41478 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041479 xmlResetLastError();
41480 if (mem_base != xmlMemBlocks()) {
41481 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041483 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041484 printf(" %d", n_writer);
41485 printf(" %d", n_name);
41486 printf(" %d", n_pubid);
41487 printf(" %d", n_sysid);
41488 printf(" %d", n_subset);
41489 printf("\n");
41490 }
41491 }
41492 }
41493 }
41494 }
41495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041496 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041497#endif
41498
Daniel Veillard42595322004-11-08 10:52:06 +000041499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041500}
41501
41502
41503static int
41504test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041506
William M. Brack21e4ef22005-01-02 09:53:13 +000041507#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041508 int mem_base;
41509 int ret_val;
41510 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41511 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041512 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041513 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041514 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041515 int n_content;
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_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41519 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041521 writer = gen_xmlTextWriterPtr(n_writer, 0);
41522 name = gen_const_xmlChar_ptr(n_name, 1);
41523 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041524
William M. Brackf13f77f2004-11-12 16:03:48 +000041525 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041526 desret_int(ret_val);
41527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041528 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041529 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41530 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531 xmlResetLastError();
41532 if (mem_base != xmlMemBlocks()) {
41533 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041535 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041536 printf(" %d", n_writer);
41537 printf(" %d", n_name);
41538 printf(" %d", n_content);
41539 printf("\n");
41540 }
41541 }
41542 }
41543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041544 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041545#endif
41546
Daniel Veillard42595322004-11-08 10:52:06 +000041547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041548}
41549
41550
41551static int
41552test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041554
William M. Brack21e4ef22005-01-02 09:53:13 +000041555#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041556 int mem_base;
41557 int ret_val;
41558 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41559 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041560 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041561 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041562 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041563 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041564
Daniel Veillarde43cc572004-11-03 11:50:29 +000041565 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41566 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41567 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041569 writer = gen_xmlTextWriterPtr(n_writer, 0);
41570 name = gen_const_xmlChar_ptr(n_name, 1);
41571 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041572
William M. Brackf13f77f2004-11-12 16:03:48 +000041573 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041574 desret_int(ret_val);
41575 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041576 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041577 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41578 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041579 xmlResetLastError();
41580 if (mem_base != xmlMemBlocks()) {
41581 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041583 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041584 printf(" %d", n_writer);
41585 printf(" %d", n_name);
41586 printf(" %d", n_content);
41587 printf("\n");
41588 }
41589 }
41590 }
41591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041592 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041593#endif
41594
Daniel Veillard42595322004-11-08 10:52:06 +000041595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041596}
41597
41598
41599static int
41600test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041602
William M. Brack21e4ef22005-01-02 09:53:13 +000041603#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041604 int mem_base;
41605 int ret_val;
41606 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41607 int n_writer;
41608 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41609 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041610 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041611 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041612 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041613 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041614 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041615 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041616 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041617 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041618 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041619 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041620
Daniel Veillarde43cc572004-11-03 11:50:29 +000041621 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41622 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41623 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41624 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41625 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41626 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41627 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41628 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041629 writer = gen_xmlTextWriterPtr(n_writer, 0);
41630 pe = gen_int(n_pe, 1);
41631 name = gen_const_xmlChar_ptr(n_name, 2);
41632 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41633 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41634 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41635 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041636
William M. Brackf13f77f2004-11-12 16:03:48 +000041637 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 +000041638 desret_int(ret_val);
41639 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041640 des_xmlTextWriterPtr(n_writer, writer, 0);
41641 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041642 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41643 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41644 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41645 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41646 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041647 xmlResetLastError();
41648 if (mem_base != xmlMemBlocks()) {
41649 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041651 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041652 printf(" %d", n_writer);
41653 printf(" %d", n_pe);
41654 printf(" %d", n_name);
41655 printf(" %d", n_pubid);
41656 printf(" %d", n_sysid);
41657 printf(" %d", n_ndataid);
41658 printf(" %d", n_content);
41659 printf("\n");
41660 }
41661 }
41662 }
41663 }
41664 }
41665 }
41666 }
41667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041668 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041669#endif
41670
Daniel Veillard42595322004-11-08 10:52:06 +000041671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041672}
41673
41674
41675static int
41676test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041678
William M. Brack21e4ef22005-01-02 09:53:13 +000041679#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041680 int mem_base;
41681 int ret_val;
41682 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41683 int n_writer;
41684 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41685 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041686 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041687 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041688 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041689 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041690 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041691 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041692 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041693 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041694
Daniel Veillarde43cc572004-11-03 11:50:29 +000041695 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41696 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41697 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41698 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41699 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41700 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041702 writer = gen_xmlTextWriterPtr(n_writer, 0);
41703 pe = gen_int(n_pe, 1);
41704 name = gen_const_xmlChar_ptr(n_name, 2);
41705 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41706 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41707 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041708
William M. Brackf13f77f2004-11-12 16:03:48 +000041709 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041710 desret_int(ret_val);
41711 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041712 des_xmlTextWriterPtr(n_writer, writer, 0);
41713 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041714 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41715 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41716 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41717 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041718 xmlResetLastError();
41719 if (mem_base != xmlMemBlocks()) {
41720 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041722 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041723 printf(" %d", n_writer);
41724 printf(" %d", n_pe);
41725 printf(" %d", n_name);
41726 printf(" %d", n_pubid);
41727 printf(" %d", n_sysid);
41728 printf(" %d", n_ndataid);
41729 printf("\n");
41730 }
41731 }
41732 }
41733 }
41734 }
41735 }
41736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041737 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738#endif
41739
Daniel Veillard42595322004-11-08 10:52:06 +000041740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041741}
41742
41743
41744static int
41745test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041747
William M. Brack21e4ef22005-01-02 09:53:13 +000041748#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041749 int mem_base;
41750 int ret_val;
41751 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41752 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041753 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041754 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041755 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041756 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041757 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041758 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041759
Daniel Veillarde43cc572004-11-03 11:50:29 +000041760 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41761 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41762 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41763 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041765 writer = gen_xmlTextWriterPtr(n_writer, 0);
41766 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41767 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41768 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041769
William M. Brackf13f77f2004-11-12 16:03:48 +000041770 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041771 desret_int(ret_val);
41772 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041773 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041774 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41775 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41776 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041777 xmlResetLastError();
41778 if (mem_base != xmlMemBlocks()) {
41779 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041781 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041782 printf(" %d", n_writer);
41783 printf(" %d", n_pubid);
41784 printf(" %d", n_sysid);
41785 printf(" %d", n_ndataid);
41786 printf("\n");
41787 }
41788 }
41789 }
41790 }
41791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041792 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041793#endif
41794
Daniel Veillard42595322004-11-08 10:52:06 +000041795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041796}
41797
41798
41799static int
41800test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041802
William M. Brack21e4ef22005-01-02 09:53:13 +000041803#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041804 int mem_base;
41805 int ret_val;
41806 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41807 int n_writer;
41808 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41809 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041810 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041811 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041812 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041813 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041814
Daniel Veillarde43cc572004-11-03 11:50:29 +000041815 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41816 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41817 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41818 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41819 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041820 writer = gen_xmlTextWriterPtr(n_writer, 0);
41821 pe = gen_int(n_pe, 1);
41822 name = gen_const_xmlChar_ptr(n_name, 2);
41823 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041824
William M. Brackf13f77f2004-11-12 16:03:48 +000041825 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041826 desret_int(ret_val);
41827 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041828 des_xmlTextWriterPtr(n_writer, writer, 0);
41829 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041830 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41831 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041832 xmlResetLastError();
41833 if (mem_base != xmlMemBlocks()) {
41834 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041836 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041837 printf(" %d", n_writer);
41838 printf(" %d", n_pe);
41839 printf(" %d", n_name);
41840 printf(" %d", n_content);
41841 printf("\n");
41842 }
41843 }
41844 }
41845 }
41846 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041847 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041848#endif
41849
Daniel Veillard42595322004-11-08 10:52:06 +000041850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041851}
41852
41853
41854static int
41855test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041857
William M. Brack21e4ef22005-01-02 09:53:13 +000041858#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041859 int mem_base;
41860 int ret_val;
41861 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41862 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041863 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041864 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041865 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041866 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041867 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041868 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041869
Daniel Veillarde43cc572004-11-03 11:50:29 +000041870 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41871 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41872 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41873 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41874 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041875 writer = gen_xmlTextWriterPtr(n_writer, 0);
41876 name = gen_const_xmlChar_ptr(n_name, 1);
41877 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41878 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041879
William M. Brackf13f77f2004-11-12 16:03:48 +000041880 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041881 desret_int(ret_val);
41882 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041883 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041884 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41885 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41886 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041887 xmlResetLastError();
41888 if (mem_base != xmlMemBlocks()) {
41889 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041891 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041892 printf(" %d", n_writer);
41893 printf(" %d", n_name);
41894 printf(" %d", n_pubid);
41895 printf(" %d", n_sysid);
41896 printf("\n");
41897 }
41898 }
41899 }
41900 }
41901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041902 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041903#endif
41904
Daniel Veillard42595322004-11-08 10:52:06 +000041905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041906}
41907
41908
41909static int
41910test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041912
William M. Brack21e4ef22005-01-02 09:53:13 +000041913#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041914 int mem_base;
41915 int ret_val;
41916 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41917 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041918 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041919 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041920 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041921 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041922
Daniel Veillarde43cc572004-11-03 11:50:29 +000041923 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41924 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41925 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041927 writer = gen_xmlTextWriterPtr(n_writer, 0);
41928 name = gen_const_xmlChar_ptr(n_name, 1);
41929 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041930
William M. Brackf13f77f2004-11-12 16:03:48 +000041931 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041932 desret_int(ret_val);
41933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041934 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041935 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41936 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041937 xmlResetLastError();
41938 if (mem_base != xmlMemBlocks()) {
41939 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041941 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041942 printf(" %d", n_writer);
41943 printf(" %d", n_name);
41944 printf(" %d", n_content);
41945 printf("\n");
41946 }
41947 }
41948 }
41949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041950 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041951#endif
41952
Daniel Veillard42595322004-11-08 10:52:06 +000041953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041954}
41955
41956
41957static int
41958test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041960
William M. Brack21e4ef22005-01-02 09:53:13 +000041961#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041962 int mem_base;
41963 int ret_val;
41964 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41965 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041966 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041967 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041968 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041969 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041970 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041971 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041972 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041973 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041974
Daniel Veillarde43cc572004-11-03 11:50:29 +000041975 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41976 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41977 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41978 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41979 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041981 writer = gen_xmlTextWriterPtr(n_writer, 0);
41982 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41983 name = gen_const_xmlChar_ptr(n_name, 2);
41984 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41985 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041986
William M. Brackf13f77f2004-11-12 16:03:48 +000041987 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041988 desret_int(ret_val);
41989 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041990 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041991 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41992 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41993 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41994 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041995 xmlResetLastError();
41996 if (mem_base != xmlMemBlocks()) {
41997 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041999 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042000 printf(" %d", n_writer);
42001 printf(" %d", n_prefix);
42002 printf(" %d", n_name);
42003 printf(" %d", n_namespaceURI);
42004 printf(" %d", n_content);
42005 printf("\n");
42006 }
42007 }
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_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042022
42023
42024 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042026}
42027
42028
42029static int
42030test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042032
42033
42034 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042036}
42037
42038
42039static int
42040test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042042
42043
42044 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042046}
42047
42048
42049static int
42050test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042052
42053
42054 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042056}
42057
42058
42059static int
42060test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042062
42063
42064 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042066}
42067
42068
42069static int
42070test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042072
42073
42074 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042076}
42077
42078
42079static int
42080test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042082
42083
42084 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042086}
42087
42088
42089static int
42090test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042092
42093
42094 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042096}
42097
42098
42099static int
42100test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042102
42103
42104 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042106}
42107
42108
42109static int
42110test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042112
42113
42114 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042116}
42117
42118
42119static int
42120test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042122
42123
42124 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042126}
42127
42128
42129static int
42130test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042132
42133
42134 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042136}
42137
42138
42139static int
42140test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042142
42143
42144 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042146}
42147
42148
42149static int
42150test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042152
William M. Brack21e4ef22005-01-02 09:53:13 +000042153#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042154 int mem_base;
42155 int ret_val;
42156 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42157 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042158 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042159 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042160 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042161 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042162
Daniel Veillarde43cc572004-11-03 11:50:29 +000042163 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42164 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42165 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042167 writer = gen_xmlTextWriterPtr(n_writer, 0);
42168 target = gen_const_xmlChar_ptr(n_target, 1);
42169 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042170
William M. Brackf13f77f2004-11-12 16:03:48 +000042171 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042172 desret_int(ret_val);
42173 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042174 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042175 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42176 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042177 xmlResetLastError();
42178 if (mem_base != xmlMemBlocks()) {
42179 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042181 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042182 printf(" %d", n_writer);
42183 printf(" %d", n_target);
42184 printf(" %d", n_content);
42185 printf("\n");
42186 }
42187 }
42188 }
42189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042190 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042191#endif
42192
Daniel Veillard42595322004-11-08 10:52:06 +000042193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042194}
42195
42196
42197static int
42198test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042200
William M. Brack21e4ef22005-01-02 09:53:13 +000042201#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042202 int mem_base;
42203 int ret_val;
42204 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42205 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042206 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042207 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042208
Daniel Veillarde43cc572004-11-03 11:50:29 +000042209 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42210 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042212 writer = gen_xmlTextWriterPtr(n_writer, 0);
42213 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042214
William M. Brackf13f77f2004-11-12 16:03:48 +000042215 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042216 desret_int(ret_val);
42217 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042218 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042219 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042220 xmlResetLastError();
42221 if (mem_base != xmlMemBlocks()) {
42222 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042224 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042225 printf(" %d", n_writer);
42226 printf(" %d", n_content);
42227 printf("\n");
42228 }
42229 }
42230 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042231 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042232#endif
42233
Daniel Veillard42595322004-11-08 10:52:06 +000042234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042235}
42236
42237
42238static int
42239test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042241
William M. Brack21e4ef22005-01-02 09:53:13 +000042242#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042243 int mem_base;
42244 int ret_val;
42245 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42246 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042247 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042248 int n_content;
42249 int len; /* length of the text string */
42250 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042251
Daniel Veillarde43cc572004-11-03 11:50:29 +000042252 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42253 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42254 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42255 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042256 writer = gen_xmlTextWriterPtr(n_writer, 0);
42257 content = gen_const_xmlChar_ptr(n_content, 1);
42258 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042259
William M. Brackf13f77f2004-11-12 16:03:48 +000042260 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042261 desret_int(ret_val);
42262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042263 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042264 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042265 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042266 xmlResetLastError();
42267 if (mem_base != xmlMemBlocks()) {
42268 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042270 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042271 printf(" %d", n_writer);
42272 printf(" %d", n_content);
42273 printf(" %d", n_len);
42274 printf("\n");
42275 }
42276 }
42277 }
42278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042279 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042280#endif
42281
Daniel Veillard42595322004-11-08 10:52:06 +000042282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042283}
42284
42285
42286static int
42287test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042289
William M. Brack21e4ef22005-01-02 09:53:13 +000042290#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042291 int mem_base;
42292 int ret_val;
42293 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42294 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042295 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042296 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042297
Daniel Veillarde43cc572004-11-03 11:50:29 +000042298 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42299 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042301 writer = gen_xmlTextWriterPtr(n_writer, 0);
42302 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042303
William M. Brackf13f77f2004-11-12 16:03:48 +000042304 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042305 desret_int(ret_val);
42306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042307 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042308 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042309 xmlResetLastError();
42310 if (mem_base != xmlMemBlocks()) {
42311 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042313 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042314 printf(" %d", n_writer);
42315 printf(" %d", n_content);
42316 printf("\n");
42317 }
42318 }
42319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042320 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042321#endif
42322
Daniel Veillard42595322004-11-08 10:52:06 +000042323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042324}
42325
42326
42327static int
42328test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042330
42331
42332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042334}
42335
42336
42337static int
42338test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042340
42341
42342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042344}
42345
42346
42347static int
42348test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042350
42351
42352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042354}
42355
42356
42357static int
42358test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042360
42361
42362 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042364}
42365
42366
42367static int
42368test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042370
42371
42372 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042374}
42375
42376
42377static int
42378test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042380
42381
42382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042384}
42385
42386
42387static int
42388test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042390
42391
42392 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042394}
42395
42396
42397static int
42398test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042400
42401
42402 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042404}
42405
42406
42407static int
42408test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042410
42411
42412 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042414}
42415
42416
42417static int
42418test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042420
42421
42422 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042424}
42425
42426
42427static int
42428test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042430
42431
42432 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042434}
42435
42436
42437static int
42438test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042440
42441
42442 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042444}
42445
42446
42447static int
42448test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042450
42451
42452 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042454}
42455
42456static int
42457test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042459
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042460 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042461 test_ret += test_xmlNewTextWriter();
42462 test_ret += test_xmlNewTextWriterFilename();
42463 test_ret += test_xmlNewTextWriterMemory();
42464 test_ret += test_xmlNewTextWriterPushParser();
42465 test_ret += test_xmlNewTextWriterTree();
42466 test_ret += test_xmlTextWriterEndAttribute();
42467 test_ret += test_xmlTextWriterEndCDATA();
42468 test_ret += test_xmlTextWriterEndComment();
42469 test_ret += test_xmlTextWriterEndDTD();
42470 test_ret += test_xmlTextWriterEndDTDAttlist();
42471 test_ret += test_xmlTextWriterEndDTDElement();
42472 test_ret += test_xmlTextWriterEndDTDEntity();
42473 test_ret += test_xmlTextWriterEndDocument();
42474 test_ret += test_xmlTextWriterEndElement();
42475 test_ret += test_xmlTextWriterEndPI();
42476 test_ret += test_xmlTextWriterFlush();
42477 test_ret += test_xmlTextWriterFullEndElement();
42478 test_ret += test_xmlTextWriterSetIndent();
42479 test_ret += test_xmlTextWriterSetIndentString();
42480 test_ret += test_xmlTextWriterStartAttribute();
42481 test_ret += test_xmlTextWriterStartAttributeNS();
42482 test_ret += test_xmlTextWriterStartCDATA();
42483 test_ret += test_xmlTextWriterStartComment();
42484 test_ret += test_xmlTextWriterStartDTD();
42485 test_ret += test_xmlTextWriterStartDTDAttlist();
42486 test_ret += test_xmlTextWriterStartDTDElement();
42487 test_ret += test_xmlTextWriterStartDTDEntity();
42488 test_ret += test_xmlTextWriterStartDocument();
42489 test_ret += test_xmlTextWriterStartElement();
42490 test_ret += test_xmlTextWriterStartElementNS();
42491 test_ret += test_xmlTextWriterStartPI();
42492 test_ret += test_xmlTextWriterWriteAttribute();
42493 test_ret += test_xmlTextWriterWriteAttributeNS();
42494 test_ret += test_xmlTextWriterWriteBase64();
42495 test_ret += test_xmlTextWriterWriteBinHex();
42496 test_ret += test_xmlTextWriterWriteCDATA();
42497 test_ret += test_xmlTextWriterWriteComment();
42498 test_ret += test_xmlTextWriterWriteDTD();
42499 test_ret += test_xmlTextWriterWriteDTDAttlist();
42500 test_ret += test_xmlTextWriterWriteDTDElement();
42501 test_ret += test_xmlTextWriterWriteDTDEntity();
42502 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42503 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42504 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42505 test_ret += test_xmlTextWriterWriteDTDNotation();
42506 test_ret += test_xmlTextWriterWriteElement();
42507 test_ret += test_xmlTextWriterWriteElementNS();
42508 test_ret += test_xmlTextWriterWriteFormatAttribute();
42509 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42510 test_ret += test_xmlTextWriterWriteFormatCDATA();
42511 test_ret += test_xmlTextWriterWriteFormatComment();
42512 test_ret += test_xmlTextWriterWriteFormatDTD();
42513 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42514 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42515 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42516 test_ret += test_xmlTextWriterWriteFormatElement();
42517 test_ret += test_xmlTextWriterWriteFormatElementNS();
42518 test_ret += test_xmlTextWriterWriteFormatPI();
42519 test_ret += test_xmlTextWriterWriteFormatRaw();
42520 test_ret += test_xmlTextWriterWriteFormatString();
42521 test_ret += test_xmlTextWriterWritePI();
42522 test_ret += test_xmlTextWriterWriteRaw();
42523 test_ret += test_xmlTextWriterWriteRawLen();
42524 test_ret += test_xmlTextWriterWriteString();
42525 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42526 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42527 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42528 test_ret += test_xmlTextWriterWriteVFormatComment();
42529 test_ret += test_xmlTextWriterWriteVFormatDTD();
42530 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42531 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42532 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42533 test_ret += test_xmlTextWriterWriteVFormatElement();
42534 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42535 test_ret += test_xmlTextWriterWriteVFormatPI();
42536 test_ret += test_xmlTextWriterWriteVFormatRaw();
42537 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042538
Daniel Veillard42595322004-11-08 10:52:06 +000042539 if (test_ret != 0)
42540 printf("Module xmlwriter: %d errors\n", test_ret);
42541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042542}
42543
42544static int
42545test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042547
William M. Brack21e4ef22005-01-02 09:53:13 +000042548#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042549 int mem_base;
42550 double ret_val;
42551 int val; /* a boolean */
42552 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042553
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042554 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42555 mem_base = xmlMemBlocks();
42556 val = gen_int(n_val, 0);
42557
42558 ret_val = xmlXPathCastBooleanToNumber(val);
42559 desret_double(ret_val);
42560 call_tests++;
42561 des_int(n_val, val, 0);
42562 xmlResetLastError();
42563 if (mem_base != xmlMemBlocks()) {
42564 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042566 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042567 printf(" %d", n_val);
42568 printf("\n");
42569 }
42570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042571 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042572#endif
42573
Daniel Veillard42595322004-11-08 10:52:06 +000042574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042575}
42576
42577
42578static int
42579test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042581
William M. Brack21e4ef22005-01-02 09:53:13 +000042582#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042583 int mem_base;
42584 xmlChar * ret_val;
42585 int val; /* a boolean */
42586 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042587
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042588 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042590 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042591
42592 ret_val = xmlXPathCastBooleanToString(val);
42593 desret_xmlChar_ptr(ret_val);
42594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042595 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042596 xmlResetLastError();
42597 if (mem_base != xmlMemBlocks()) {
42598 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042600 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042601 printf(" %d", n_val);
42602 printf("\n");
42603 }
42604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042605 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042606#endif
42607
Daniel Veillard42595322004-11-08 10:52:06 +000042608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042609}
42610
42611
42612static int
42613test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042615
William M. Brack21e4ef22005-01-02 09:53:13 +000042616#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042617 int mem_base;
42618 int ret_val;
42619 xmlNodeSetPtr ns; /* a node-set */
42620 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042621
Daniel Veillardce682bc2004-11-05 17:22:25 +000042622 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42623 mem_base = xmlMemBlocks();
42624 ns = gen_xmlNodeSetPtr(n_ns, 0);
42625
42626 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42627 desret_int(ret_val);
42628 call_tests++;
42629 des_xmlNodeSetPtr(n_ns, ns, 0);
42630 xmlResetLastError();
42631 if (mem_base != xmlMemBlocks()) {
42632 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042634 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042635 printf(" %d", n_ns);
42636 printf("\n");
42637 }
42638 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042639 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042640#endif
42641
Daniel Veillard42595322004-11-08 10:52:06 +000042642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042643}
42644
42645
42646static int
42647test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042649
William M. Brack21e4ef22005-01-02 09:53:13 +000042650#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042651 int mem_base;
42652 double ret_val;
42653 xmlNodeSetPtr ns; /* a node-set */
42654 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042655
Daniel Veillardce682bc2004-11-05 17:22:25 +000042656 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42657 mem_base = xmlMemBlocks();
42658 ns = gen_xmlNodeSetPtr(n_ns, 0);
42659
42660 ret_val = xmlXPathCastNodeSetToNumber(ns);
42661 desret_double(ret_val);
42662 call_tests++;
42663 des_xmlNodeSetPtr(n_ns, ns, 0);
42664 xmlResetLastError();
42665 if (mem_base != xmlMemBlocks()) {
42666 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042668 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042669 printf(" %d", n_ns);
42670 printf("\n");
42671 }
42672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042673 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042674#endif
42675
Daniel Veillard42595322004-11-08 10:52:06 +000042676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042677}
42678
42679
42680static int
42681test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042683
William M. Brack21e4ef22005-01-02 09:53:13 +000042684#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042685 int mem_base;
42686 xmlChar * ret_val;
42687 xmlNodeSetPtr ns; /* a node-set */
42688 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042689
Daniel Veillardce682bc2004-11-05 17:22:25 +000042690 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42691 mem_base = xmlMemBlocks();
42692 ns = gen_xmlNodeSetPtr(n_ns, 0);
42693
42694 ret_val = xmlXPathCastNodeSetToString(ns);
42695 desret_xmlChar_ptr(ret_val);
42696 call_tests++;
42697 des_xmlNodeSetPtr(n_ns, ns, 0);
42698 xmlResetLastError();
42699 if (mem_base != xmlMemBlocks()) {
42700 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042702 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042703 printf(" %d", n_ns);
42704 printf("\n");
42705 }
42706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042707 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042708#endif
42709
Daniel Veillard42595322004-11-08 10:52:06 +000042710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042711}
42712
42713
42714static int
42715test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042717
William M. Brack21e4ef22005-01-02 09:53:13 +000042718#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042719 int mem_base;
42720 double ret_val;
42721 xmlNodePtr node; /* a node */
42722 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042723
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042724 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42725 mem_base = xmlMemBlocks();
42726 node = gen_xmlNodePtr(n_node, 0);
42727
42728 ret_val = xmlXPathCastNodeToNumber(node);
42729 desret_double(ret_val);
42730 call_tests++;
42731 des_xmlNodePtr(n_node, node, 0);
42732 xmlResetLastError();
42733 if (mem_base != xmlMemBlocks()) {
42734 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042736 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042737 printf(" %d", n_node);
42738 printf("\n");
42739 }
42740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042741 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042742#endif
42743
Daniel Veillard42595322004-11-08 10:52:06 +000042744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042745}
42746
42747
42748static int
42749test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042751
William M. Brack21e4ef22005-01-02 09:53:13 +000042752#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042753 int mem_base;
42754 xmlChar * ret_val;
42755 xmlNodePtr node; /* a node */
42756 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042757
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042758 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042760 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042761
42762 ret_val = xmlXPathCastNodeToString(node);
42763 desret_xmlChar_ptr(ret_val);
42764 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042765 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042766 xmlResetLastError();
42767 if (mem_base != xmlMemBlocks()) {
42768 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042770 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042771 printf(" %d", n_node);
42772 printf("\n");
42773 }
42774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042775 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042776#endif
42777
Daniel Veillard42595322004-11-08 10:52:06 +000042778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042779}
42780
42781
42782static int
42783test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042785
William M. Brack21e4ef22005-01-02 09:53:13 +000042786#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042787 int mem_base;
42788 int ret_val;
42789 double val; /* a number */
42790 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042791
Daniel Veillard3d95c732004-11-06 22:25:14 +000042792 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42793 mem_base = xmlMemBlocks();
42794 val = gen_double(n_val, 0);
42795
42796 ret_val = xmlXPathCastNumberToBoolean(val);
42797 desret_int(ret_val);
42798 call_tests++;
42799 des_double(n_val, val, 0);
42800 xmlResetLastError();
42801 if (mem_base != xmlMemBlocks()) {
42802 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042804 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042805 printf(" %d", n_val);
42806 printf("\n");
42807 }
42808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042809 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042810#endif
42811
Daniel Veillard42595322004-11-08 10:52:06 +000042812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042813}
42814
42815
42816static int
42817test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042819
William M. Brack21e4ef22005-01-02 09:53:13 +000042820#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042821 int mem_base;
42822 xmlChar * ret_val;
42823 double val; /* a number */
42824 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042825
Daniel Veillard3d95c732004-11-06 22:25:14 +000042826 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42827 mem_base = xmlMemBlocks();
42828 val = gen_double(n_val, 0);
42829
42830 ret_val = xmlXPathCastNumberToString(val);
42831 desret_xmlChar_ptr(ret_val);
42832 call_tests++;
42833 des_double(n_val, val, 0);
42834 xmlResetLastError();
42835 if (mem_base != xmlMemBlocks()) {
42836 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042838 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042839 printf(" %d", n_val);
42840 printf("\n");
42841 }
42842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042843 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042844#endif
42845
Daniel Veillard42595322004-11-08 10:52:06 +000042846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042847}
42848
42849
42850static int
42851test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042853
William M. Brack21e4ef22005-01-02 09:53:13 +000042854#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000042855 int mem_base;
42856 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042857 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042858 int n_val;
42859
42860 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42861 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042862 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042863
William M. Brackf13f77f2004-11-12 16:03:48 +000042864 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042865 desret_int(ret_val);
42866 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042867 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042868 xmlResetLastError();
42869 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042870 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042872 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042873 printf(" %d", n_val);
42874 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042875 }
42876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042877 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042878#endif
42879
Daniel Veillard42595322004-11-08 10:52:06 +000042880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042881}
42882
42883
42884static int
42885test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042887
William M. Brack21e4ef22005-01-02 09:53:13 +000042888#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042889 int mem_base;
42890 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042891 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042892 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042893
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042894 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42895 mem_base = xmlMemBlocks();
42896 val = gen_const_xmlChar_ptr(n_val, 0);
42897
William M. Brackf13f77f2004-11-12 16:03:48 +000042898 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042899 desret_double(ret_val);
42900 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042901 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042902 xmlResetLastError();
42903 if (mem_base != xmlMemBlocks()) {
42904 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042906 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042907 printf(" %d", n_val);
42908 printf("\n");
42909 }
42910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042911 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042912#endif
42913
Daniel Veillard42595322004-11-08 10:52:06 +000042914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042915}
42916
42917
42918static int
42919test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042921
William M. Brack21e4ef22005-01-02 09:53:13 +000042922#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042923 int mem_base;
42924 int ret_val;
42925 xmlXPathObjectPtr val; /* an XPath object */
42926 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042927
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042928 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042930 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042931
42932 ret_val = xmlXPathCastToBoolean(val);
42933 desret_int(ret_val);
42934 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042935 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042936 xmlResetLastError();
42937 if (mem_base != xmlMemBlocks()) {
42938 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042940 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042941 printf(" %d", n_val);
42942 printf("\n");
42943 }
42944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042945 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042946#endif
42947
Daniel Veillard42595322004-11-08 10:52:06 +000042948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042949}
42950
42951
42952static int
42953test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042955
William M. Brack21e4ef22005-01-02 09:53:13 +000042956#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042957 int mem_base;
42958 double ret_val;
42959 xmlXPathObjectPtr val; /* an XPath object */
42960 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042961
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042962 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42963 mem_base = xmlMemBlocks();
42964 val = gen_xmlXPathObjectPtr(n_val, 0);
42965
42966 ret_val = xmlXPathCastToNumber(val);
42967 desret_double(ret_val);
42968 call_tests++;
42969 des_xmlXPathObjectPtr(n_val, val, 0);
42970 xmlResetLastError();
42971 if (mem_base != xmlMemBlocks()) {
42972 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042974 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042975 printf(" %d", n_val);
42976 printf("\n");
42977 }
42978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042979 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042980#endif
42981
Daniel Veillard42595322004-11-08 10:52:06 +000042982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042983}
42984
42985
42986static int
42987test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042989
William M. Brack21e4ef22005-01-02 09:53:13 +000042990#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042991 int mem_base;
42992 xmlChar * ret_val;
42993 xmlXPathObjectPtr val; /* an XPath object */
42994 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042995
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042996 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42997 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042998 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042999
43000 ret_val = xmlXPathCastToString(val);
43001 desret_xmlChar_ptr(ret_val);
43002 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043003 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043004 xmlResetLastError();
43005 if (mem_base != xmlMemBlocks()) {
43006 printf("Leak of %d blocks found in xmlXPathCastToString",
43007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043008 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043009 printf(" %d", n_val);
43010 printf("\n");
43011 }
43012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043013 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043014#endif
43015
Daniel Veillard42595322004-11-08 10:52:06 +000043016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043017}
43018
43019
43020static int
43021test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043023
William M. Brack21e4ef22005-01-02 09:53:13 +000043024#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043025 int mem_base;
43026 int ret_val;
43027 xmlNodePtr node1; /* the first node */
43028 int n_node1;
43029 xmlNodePtr node2; /* the second node */
43030 int n_node2;
43031
43032 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43033 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43034 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043035 node1 = gen_xmlNodePtr(n_node1, 0);
43036 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043037
43038 ret_val = xmlXPathCmpNodes(node1, node2);
43039 desret_int(ret_val);
43040 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043041 des_xmlNodePtr(n_node1, node1, 0);
43042 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043043 xmlResetLastError();
43044 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043045 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043047 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043048 printf(" %d", n_node1);
43049 printf(" %d", n_node2);
43050 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043051 }
43052 }
43053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043054 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043055#endif
43056
Daniel Veillard42595322004-11-08 10:52:06 +000043057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043058}
43059
43060
43061static int
43062test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043064
43065
43066 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043068}
43069
Daniel Veillarda521d282004-11-09 14:59:59 +000043070#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043071
Daniel Veillardce682bc2004-11-05 17:22:25 +000043072#define gen_nb_xmlXPathCompExprPtr 1
43073static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43074 return(NULL);
43075}
43076static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43077}
Daniel Veillarda521d282004-11-09 14:59:59 +000043078#endif
43079
43080#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043081
43082#define gen_nb_xmlXPathContextPtr 1
43083static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43084 return(NULL);
43085}
43086static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43087}
Daniel Veillarda521d282004-11-09 14:59:59 +000043088#endif
43089
Daniel Veillardce682bc2004-11-05 17:22:25 +000043090
Daniel Veillardd93f6252004-11-02 15:53:51 +000043091static int
43092test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043094
William M. Brack21e4ef22005-01-02 09:53:13 +000043095#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043096 int mem_base;
43097 xmlXPathObjectPtr ret_val;
43098 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43099 int n_comp;
43100 xmlXPathContextPtr ctx; /* the XPath context */
43101 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043102
Daniel Veillardce682bc2004-11-05 17:22:25 +000043103 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43104 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43105 mem_base = xmlMemBlocks();
43106 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43107 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43108
43109 ret_val = xmlXPathCompiledEval(comp, ctx);
43110 desret_xmlXPathObjectPtr(ret_val);
43111 call_tests++;
43112 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43113 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43114 xmlResetLastError();
43115 if (mem_base != xmlMemBlocks()) {
43116 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043118 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043119 printf(" %d", n_comp);
43120 printf(" %d", n_ctx);
43121 printf("\n");
43122 }
43123 }
43124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043125 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043126#endif
43127
Daniel Veillard42595322004-11-08 10:52:06 +000043128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043129}
43130
43131
43132static int
43133test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043135
William M. Brack21e4ef22005-01-02 09:53:13 +000043136#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043137 int mem_base;
43138 xmlXPathObjectPtr ret_val;
43139 xmlXPathObjectPtr val; /* an XPath object */
43140 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043141
Daniel Veillard3d97e662004-11-04 10:49:00 +000043142 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43143 mem_base = xmlMemBlocks();
43144 val = gen_xmlXPathObjectPtr(n_val, 0);
43145
43146 ret_val = xmlXPathConvertBoolean(val);
43147 val = NULL;
43148 desret_xmlXPathObjectPtr(ret_val);
43149 call_tests++;
43150 des_xmlXPathObjectPtr(n_val, val, 0);
43151 xmlResetLastError();
43152 if (mem_base != xmlMemBlocks()) {
43153 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043155 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043156 printf(" %d", n_val);
43157 printf("\n");
43158 }
43159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043160 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043161#endif
43162
Daniel Veillard42595322004-11-08 10:52:06 +000043163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043164}
43165
43166
43167static int
43168test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043170
William M. Brack21e4ef22005-01-02 09:53:13 +000043171#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043172 int mem_base;
43173 xmlXPathObjectPtr ret_val;
43174 xmlXPathObjectPtr val; /* an XPath object */
43175 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043176
Daniel Veillard3d97e662004-11-04 10:49:00 +000043177 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43178 mem_base = xmlMemBlocks();
43179 val = gen_xmlXPathObjectPtr(n_val, 0);
43180
43181 ret_val = xmlXPathConvertNumber(val);
43182 val = NULL;
43183 desret_xmlXPathObjectPtr(ret_val);
43184 call_tests++;
43185 des_xmlXPathObjectPtr(n_val, val, 0);
43186 xmlResetLastError();
43187 if (mem_base != xmlMemBlocks()) {
43188 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043190 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043191 printf(" %d", n_val);
43192 printf("\n");
43193 }
43194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043195 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043196#endif
43197
Daniel Veillard42595322004-11-08 10:52:06 +000043198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043199}
43200
43201
43202static int
43203test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043205
William M. Brack21e4ef22005-01-02 09:53:13 +000043206#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043207 int mem_base;
43208 xmlXPathObjectPtr ret_val;
43209 xmlXPathObjectPtr val; /* an XPath object */
43210 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043211
Daniel Veillard3d97e662004-11-04 10:49:00 +000043212 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43213 mem_base = xmlMemBlocks();
43214 val = gen_xmlXPathObjectPtr(n_val, 0);
43215
43216 ret_val = xmlXPathConvertString(val);
43217 val = NULL;
43218 desret_xmlXPathObjectPtr(ret_val);
43219 call_tests++;
43220 des_xmlXPathObjectPtr(n_val, val, 0);
43221 xmlResetLastError();
43222 if (mem_base != xmlMemBlocks()) {
43223 printf("Leak of %d blocks found in xmlXPathConvertString",
43224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043225 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043226 printf(" %d", n_val);
43227 printf("\n");
43228 }
43229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043230 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043231#endif
43232
Daniel Veillard42595322004-11-08 10:52:06 +000043233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043234}
43235
43236
43237static int
43238test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043240
43241
43242 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043244}
43245
43246
43247static int
43248test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043250
William M. Brack21e4ef22005-01-02 09:53:13 +000043251#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043252 int mem_base;
43253 xmlXPathObjectPtr ret_val;
43254 xmlChar * str; /* the XPath expression */
43255 int n_str;
43256 xmlXPathContextPtr ctx; /* the XPath context */
43257 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043258
Daniel Veillardce682bc2004-11-05 17:22:25 +000043259 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43260 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43261 mem_base = xmlMemBlocks();
43262 str = gen_const_xmlChar_ptr(n_str, 0);
43263 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43264
William M. Brackf13f77f2004-11-12 16:03:48 +000043265 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043266 desret_xmlXPathObjectPtr(ret_val);
43267 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043268 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043269 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43270 xmlResetLastError();
43271 if (mem_base != xmlMemBlocks()) {
43272 printf("Leak of %d blocks found in xmlXPathEval",
43273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043274 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043275 printf(" %d", n_str);
43276 printf(" %d", n_ctx);
43277 printf("\n");
43278 }
43279 }
43280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043281 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043282#endif
43283
Daniel Veillard42595322004-11-08 10:52:06 +000043284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043285}
43286
43287
43288static int
43289test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043291
William M. Brack21e4ef22005-01-02 09:53:13 +000043292#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043293 int mem_base;
43294 xmlXPathObjectPtr ret_val;
43295 xmlChar * str; /* the XPath expression */
43296 int n_str;
43297 xmlXPathContextPtr ctxt; /* the XPath context */
43298 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043299
Daniel Veillardce682bc2004-11-05 17:22:25 +000043300 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43302 mem_base = xmlMemBlocks();
43303 str = gen_const_xmlChar_ptr(n_str, 0);
43304 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43305
William M. Brackf13f77f2004-11-12 16:03:48 +000043306 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043307 desret_xmlXPathObjectPtr(ret_val);
43308 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043309 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043310 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43311 xmlResetLastError();
43312 if (mem_base != xmlMemBlocks()) {
43313 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043315 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043316 printf(" %d", n_str);
43317 printf(" %d", n_ctxt);
43318 printf("\n");
43319 }
43320 }
43321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043322 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +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_xmlXPathEvalPredicate(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 Veillardce682bc2004-11-05 17:22:25 +000043334 int mem_base;
43335 int ret_val;
43336 xmlXPathContextPtr ctxt; /* the XPath context */
43337 int n_ctxt;
43338 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43339 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043340
Daniel Veillardce682bc2004-11-05 17:22:25 +000043341 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43342 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43343 mem_base = xmlMemBlocks();
43344 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43345 res = gen_xmlXPathObjectPtr(n_res, 1);
43346
43347 ret_val = xmlXPathEvalPredicate(ctxt, res);
43348 desret_int(ret_val);
43349 call_tests++;
43350 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43351 des_xmlXPathObjectPtr(n_res, res, 1);
43352 xmlResetLastError();
43353 if (mem_base != xmlMemBlocks()) {
43354 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043356 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043357 printf(" %d", n_ctxt);
43358 printf(" %d", n_res);
43359 printf("\n");
43360 }
43361 }
43362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043363 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043364#endif
43365
Daniel Veillard42595322004-11-08 10:52:06 +000043366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043367}
43368
43369
43370static int
43371test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043373
William M. Brack21e4ef22005-01-02 09:53:13 +000043374#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043375 int mem_base;
43376
43377 mem_base = xmlMemBlocks();
43378
43379 xmlXPathInit();
43380 call_tests++;
43381 xmlResetLastError();
43382 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043383 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043385 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043386 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043388 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043389#endif
43390
Daniel Veillard42595322004-11-08 10:52:06 +000043391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043392}
43393
43394
43395static int
43396test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043398
William M. Brack21e4ef22005-01-02 09:53:13 +000043399#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043400 int mem_base;
43401 int ret_val;
43402 double val; /* a double value */
43403 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043404
Daniel Veillard3d95c732004-11-06 22:25:14 +000043405 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43406 mem_base = xmlMemBlocks();
43407 val = gen_double(n_val, 0);
43408
43409 ret_val = xmlXPathIsInf(val);
43410 desret_int(ret_val);
43411 call_tests++;
43412 des_double(n_val, val, 0);
43413 xmlResetLastError();
43414 if (mem_base != xmlMemBlocks()) {
43415 printf("Leak of %d blocks found in xmlXPathIsInf",
43416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043417 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043418 printf(" %d", n_val);
43419 printf("\n");
43420 }
43421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043422 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043423#endif
43424
Daniel Veillard42595322004-11-08 10:52:06 +000043425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043426}
43427
43428
43429static int
43430test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043432
William M. Brack21e4ef22005-01-02 09:53:13 +000043433#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043434 int mem_base;
43435 int ret_val;
43436 double val; /* a double value */
43437 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043438
Daniel Veillard3d95c732004-11-06 22:25:14 +000043439 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43440 mem_base = xmlMemBlocks();
43441 val = gen_double(n_val, 0);
43442
43443 ret_val = xmlXPathIsNaN(val);
43444 desret_int(ret_val);
43445 call_tests++;
43446 des_double(n_val, val, 0);
43447 xmlResetLastError();
43448 if (mem_base != xmlMemBlocks()) {
43449 printf("Leak of %d blocks found in xmlXPathIsNaN",
43450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043451 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043452 printf(" %d", n_val);
43453 printf("\n");
43454 }
43455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043456 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043457#endif
43458
Daniel Veillard42595322004-11-08 10:52:06 +000043459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043460}
43461
43462
43463static int
43464test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043466
43467
43468 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043470}
43471
43472
43473static int
43474test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043476
William M. Brack21e4ef22005-01-02 09:53:13 +000043477#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043478 int mem_base;
43479 xmlNodeSetPtr ret_val;
43480 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43481 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043482
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043483 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43484 mem_base = xmlMemBlocks();
43485 val = gen_xmlNodePtr(n_val, 0);
43486
43487 ret_val = xmlXPathNodeSetCreate(val);
43488 desret_xmlNodeSetPtr(ret_val);
43489 call_tests++;
43490 des_xmlNodePtr(n_val, val, 0);
43491 xmlResetLastError();
43492 if (mem_base != xmlMemBlocks()) {
43493 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43494 xmlMemBlocks() - mem_base);
43495 test_ret++;
43496 printf(" %d", n_val);
43497 printf("\n");
43498 }
43499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043500 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043501#endif
43502
Daniel Veillard42595322004-11-08 10:52:06 +000043503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043504}
43505
43506
43507static int
43508test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043510
William M. Brack21e4ef22005-01-02 09:53:13 +000043511#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043512 int mem_base;
43513 xmlXPathObjectPtr ret_val;
43514 xmlXPathObjectPtr val; /* the original object */
43515 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043516
Daniel Veillard3d97e662004-11-04 10:49:00 +000043517 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43518 mem_base = xmlMemBlocks();
43519 val = gen_xmlXPathObjectPtr(n_val, 0);
43520
43521 ret_val = xmlXPathObjectCopy(val);
43522 desret_xmlXPathObjectPtr(ret_val);
43523 call_tests++;
43524 des_xmlXPathObjectPtr(n_val, val, 0);
43525 xmlResetLastError();
43526 if (mem_base != xmlMemBlocks()) {
43527 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043529 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043530 printf(" %d", n_val);
43531 printf("\n");
43532 }
43533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043534 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043535#endif
43536
Daniel Veillard42595322004-11-08 10:52:06 +000043537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043538}
43539
43540
43541static int
43542test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043544
William M. Brack21e4ef22005-01-02 09:53:13 +000043545#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043546 int mem_base;
43547 long ret_val;
43548 xmlDocPtr doc; /* an input document */
43549 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043550
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043551 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43552 mem_base = xmlMemBlocks();
43553 doc = gen_xmlDocPtr(n_doc, 0);
43554
43555 ret_val = xmlXPathOrderDocElems(doc);
43556 desret_long(ret_val);
43557 call_tests++;
43558 des_xmlDocPtr(n_doc, doc, 0);
43559 xmlResetLastError();
43560 if (mem_base != xmlMemBlocks()) {
43561 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043563 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043564 printf(" %d", n_doc);
43565 printf("\n");
43566 }
43567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043568 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043569#endif
43570
Daniel Veillard42595322004-11-08 10:52:06 +000043571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043572}
43573
43574static int
43575test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043577
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043578 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043579 test_ret += test_xmlXPathCastBooleanToNumber();
43580 test_ret += test_xmlXPathCastBooleanToString();
43581 test_ret += test_xmlXPathCastNodeSetToBoolean();
43582 test_ret += test_xmlXPathCastNodeSetToNumber();
43583 test_ret += test_xmlXPathCastNodeSetToString();
43584 test_ret += test_xmlXPathCastNodeToNumber();
43585 test_ret += test_xmlXPathCastNodeToString();
43586 test_ret += test_xmlXPathCastNumberToBoolean();
43587 test_ret += test_xmlXPathCastNumberToString();
43588 test_ret += test_xmlXPathCastStringToBoolean();
43589 test_ret += test_xmlXPathCastStringToNumber();
43590 test_ret += test_xmlXPathCastToBoolean();
43591 test_ret += test_xmlXPathCastToNumber();
43592 test_ret += test_xmlXPathCastToString();
43593 test_ret += test_xmlXPathCmpNodes();
43594 test_ret += test_xmlXPathCompile();
43595 test_ret += test_xmlXPathCompiledEval();
43596 test_ret += test_xmlXPathConvertBoolean();
43597 test_ret += test_xmlXPathConvertNumber();
43598 test_ret += test_xmlXPathConvertString();
43599 test_ret += test_xmlXPathCtxtCompile();
43600 test_ret += test_xmlXPathEval();
43601 test_ret += test_xmlXPathEvalExpression();
43602 test_ret += test_xmlXPathEvalPredicate();
43603 test_ret += test_xmlXPathInit();
43604 test_ret += test_xmlXPathIsInf();
43605 test_ret += test_xmlXPathIsNaN();
43606 test_ret += test_xmlXPathNewContext();
43607 test_ret += test_xmlXPathNodeSetCreate();
43608 test_ret += test_xmlXPathObjectCopy();
43609 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043610
Daniel Veillard42595322004-11-08 10:52:06 +000043611 if (test_ret != 0)
43612 printf("Module xpath: %d errors\n", test_ret);
43613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043614}
Daniel Veillarda521d282004-11-09 14:59:59 +000043615#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043616
Daniel Veillarda82b1822004-11-08 16:24:57 +000043617#define gen_nb_xmlXPathParserContextPtr 1
43618static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43619 return(NULL);
43620}
43621static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43622}
Daniel Veillarda521d282004-11-09 14:59:59 +000043623#endif
43624
Daniel Veillarda82b1822004-11-08 16:24:57 +000043625
43626static int
43627test_valuePop(void) {
43628 int test_ret = 0;
43629
William M. Brack21e4ef22005-01-02 09:53:13 +000043630#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043631 int mem_base;
43632 xmlXPathObjectPtr ret_val;
43633 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43634 int n_ctxt;
43635
43636 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43637 mem_base = xmlMemBlocks();
43638 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43639
43640 ret_val = valuePop(ctxt);
43641 desret_xmlXPathObjectPtr(ret_val);
43642 call_tests++;
43643 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43644 xmlResetLastError();
43645 if (mem_base != xmlMemBlocks()) {
43646 printf("Leak of %d blocks found in valuePop",
43647 xmlMemBlocks() - mem_base);
43648 test_ret++;
43649 printf(" %d", n_ctxt);
43650 printf("\n");
43651 }
43652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043653 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043654#endif
43655
Daniel Veillarda82b1822004-11-08 16:24:57 +000043656 return(test_ret);
43657}
43658
43659
43660static int
43661test_valuePush(void) {
43662 int test_ret = 0;
43663
William M. Brack21e4ef22005-01-02 09:53:13 +000043664#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043665 int mem_base;
43666 int ret_val;
43667 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43668 int n_ctxt;
43669 xmlXPathObjectPtr value; /* the XPath object */
43670 int n_value;
43671
43672 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43673 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43674 mem_base = xmlMemBlocks();
43675 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43676 value = gen_xmlXPathObjectPtr(n_value, 1);
43677
43678 ret_val = valuePush(ctxt, value);
43679 desret_int(ret_val);
43680 call_tests++;
43681 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43682 des_xmlXPathObjectPtr(n_value, value, 1);
43683 xmlResetLastError();
43684 if (mem_base != xmlMemBlocks()) {
43685 printf("Leak of %d blocks found in valuePush",
43686 xmlMemBlocks() - mem_base);
43687 test_ret++;
43688 printf(" %d", n_ctxt);
43689 printf(" %d", n_value);
43690 printf("\n");
43691 }
43692 }
43693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043694 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043695#endif
43696
Daniel Veillarda82b1822004-11-08 16:24:57 +000043697 return(test_ret);
43698}
43699
43700
43701static int
43702test_xmlXPathAddValues(void) {
43703 int test_ret = 0;
43704
William M. Brack21e4ef22005-01-02 09:53:13 +000043705#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043706 int mem_base;
43707 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43708 int n_ctxt;
43709
43710 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43711 mem_base = xmlMemBlocks();
43712 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43713
43714 xmlXPathAddValues(ctxt);
43715 call_tests++;
43716 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43717 xmlResetLastError();
43718 if (mem_base != xmlMemBlocks()) {
43719 printf("Leak of %d blocks found in xmlXPathAddValues",
43720 xmlMemBlocks() - mem_base);
43721 test_ret++;
43722 printf(" %d", n_ctxt);
43723 printf("\n");
43724 }
43725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043726 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043727#endif
43728
Daniel Veillarda82b1822004-11-08 16:24:57 +000043729 return(test_ret);
43730}
43731
43732
43733static int
43734test_xmlXPathBooleanFunction(void) {
43735 int test_ret = 0;
43736
William M. Brack21e4ef22005-01-02 09:53:13 +000043737#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043738 int mem_base;
43739 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43740 int n_ctxt;
43741 int nargs; /* the number of arguments */
43742 int n_nargs;
43743
43744 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43745 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43746 mem_base = xmlMemBlocks();
43747 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43748 nargs = gen_int(n_nargs, 1);
43749
43750 xmlXPathBooleanFunction(ctxt, nargs);
43751 call_tests++;
43752 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43753 des_int(n_nargs, nargs, 1);
43754 xmlResetLastError();
43755 if (mem_base != xmlMemBlocks()) {
43756 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43757 xmlMemBlocks() - mem_base);
43758 test_ret++;
43759 printf(" %d", n_ctxt);
43760 printf(" %d", n_nargs);
43761 printf("\n");
43762 }
43763 }
43764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043765 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043766#endif
43767
Daniel Veillarda82b1822004-11-08 16:24:57 +000043768 return(test_ret);
43769}
43770
43771
43772static int
43773test_xmlXPathCeilingFunction(void) {
43774 int test_ret = 0;
43775
William M. Brack21e4ef22005-01-02 09:53:13 +000043776#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043777 int mem_base;
43778 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43779 int n_ctxt;
43780 int nargs; /* the number of arguments */
43781 int n_nargs;
43782
43783 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43784 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43785 mem_base = xmlMemBlocks();
43786 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43787 nargs = gen_int(n_nargs, 1);
43788
43789 xmlXPathCeilingFunction(ctxt, nargs);
43790 call_tests++;
43791 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43792 des_int(n_nargs, nargs, 1);
43793 xmlResetLastError();
43794 if (mem_base != xmlMemBlocks()) {
43795 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43796 xmlMemBlocks() - mem_base);
43797 test_ret++;
43798 printf(" %d", n_ctxt);
43799 printf(" %d", n_nargs);
43800 printf("\n");
43801 }
43802 }
43803 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043804 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043805#endif
43806
Daniel Veillarda82b1822004-11-08 16:24:57 +000043807 return(test_ret);
43808}
43809
43810
43811static int
43812test_xmlXPathCompareValues(void) {
43813 int test_ret = 0;
43814
William M. Brack21e4ef22005-01-02 09:53:13 +000043815#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043816 int mem_base;
43817 int ret_val;
43818 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43819 int n_ctxt;
43820 int inf; /* less than (1) or greater than (0) */
43821 int n_inf;
43822 int strict; /* is the comparison strict */
43823 int n_strict;
43824
43825 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43826 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43827 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43828 mem_base = xmlMemBlocks();
43829 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43830 inf = gen_int(n_inf, 1);
43831 strict = gen_int(n_strict, 2);
43832
43833 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43834 desret_int(ret_val);
43835 call_tests++;
43836 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43837 des_int(n_inf, inf, 1);
43838 des_int(n_strict, strict, 2);
43839 xmlResetLastError();
43840 if (mem_base != xmlMemBlocks()) {
43841 printf("Leak of %d blocks found in xmlXPathCompareValues",
43842 xmlMemBlocks() - mem_base);
43843 test_ret++;
43844 printf(" %d", n_ctxt);
43845 printf(" %d", n_inf);
43846 printf(" %d", n_strict);
43847 printf("\n");
43848 }
43849 }
43850 }
43851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043852 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043853#endif
43854
Daniel Veillarda82b1822004-11-08 16:24:57 +000043855 return(test_ret);
43856}
43857
43858
43859static int
43860test_xmlXPathConcatFunction(void) {
43861 int test_ret = 0;
43862
William M. Brack21e4ef22005-01-02 09:53:13 +000043863#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043864 int mem_base;
43865 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43866 int n_ctxt;
43867 int nargs; /* the number of arguments */
43868 int n_nargs;
43869
43870 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43871 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43872 mem_base = xmlMemBlocks();
43873 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43874 nargs = gen_int(n_nargs, 1);
43875
43876 xmlXPathConcatFunction(ctxt, nargs);
43877 call_tests++;
43878 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43879 des_int(n_nargs, nargs, 1);
43880 xmlResetLastError();
43881 if (mem_base != xmlMemBlocks()) {
43882 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43883 xmlMemBlocks() - mem_base);
43884 test_ret++;
43885 printf(" %d", n_ctxt);
43886 printf(" %d", n_nargs);
43887 printf("\n");
43888 }
43889 }
43890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043891 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043892#endif
43893
Daniel Veillarda82b1822004-11-08 16:24:57 +000043894 return(test_ret);
43895}
43896
43897
43898static int
43899test_xmlXPathContainsFunction(void) {
43900 int test_ret = 0;
43901
William M. Brack21e4ef22005-01-02 09:53:13 +000043902#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043903 int mem_base;
43904 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43905 int n_ctxt;
43906 int nargs; /* the number of arguments */
43907 int n_nargs;
43908
43909 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43910 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43911 mem_base = xmlMemBlocks();
43912 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43913 nargs = gen_int(n_nargs, 1);
43914
43915 xmlXPathContainsFunction(ctxt, nargs);
43916 call_tests++;
43917 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43918 des_int(n_nargs, nargs, 1);
43919 xmlResetLastError();
43920 if (mem_base != xmlMemBlocks()) {
43921 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43922 xmlMemBlocks() - mem_base);
43923 test_ret++;
43924 printf(" %d", n_ctxt);
43925 printf(" %d", n_nargs);
43926 printf("\n");
43927 }
43928 }
43929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043930 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043931#endif
43932
Daniel Veillarda82b1822004-11-08 16:24:57 +000043933 return(test_ret);
43934}
43935
43936
43937static int
43938test_xmlXPathCountFunction(void) {
43939 int test_ret = 0;
43940
William M. Brack21e4ef22005-01-02 09:53:13 +000043941#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043942 int mem_base;
43943 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43944 int n_ctxt;
43945 int nargs; /* the number of arguments */
43946 int n_nargs;
43947
43948 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43949 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43950 mem_base = xmlMemBlocks();
43951 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43952 nargs = gen_int(n_nargs, 1);
43953
43954 xmlXPathCountFunction(ctxt, nargs);
43955 call_tests++;
43956 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43957 des_int(n_nargs, nargs, 1);
43958 xmlResetLastError();
43959 if (mem_base != xmlMemBlocks()) {
43960 printf("Leak of %d blocks found in xmlXPathCountFunction",
43961 xmlMemBlocks() - mem_base);
43962 test_ret++;
43963 printf(" %d", n_ctxt);
43964 printf(" %d", n_nargs);
43965 printf("\n");
43966 }
43967 }
43968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043969 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043970#endif
43971
Daniel Veillarda82b1822004-11-08 16:24:57 +000043972 return(test_ret);
43973}
43974
43975
43976static int
43977test_xmlXPathDebugDumpCompExpr(void) {
43978 int test_ret = 0;
43979
William M. Brack21e4ef22005-01-02 09:53:13 +000043980#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043981 int mem_base;
43982 FILE * output; /* the FILE * for the output */
43983 int n_output;
43984 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43985 int n_comp;
43986 int depth; /* the indentation level. */
43987 int n_depth;
43988
43989 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43990 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43991 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43992 mem_base = xmlMemBlocks();
43993 output = gen_FILE_ptr(n_output, 0);
43994 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43995 depth = gen_int(n_depth, 2);
43996
43997 xmlXPathDebugDumpCompExpr(output, comp, depth);
43998 call_tests++;
43999 des_FILE_ptr(n_output, output, 0);
44000 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44001 des_int(n_depth, depth, 2);
44002 xmlResetLastError();
44003 if (mem_base != xmlMemBlocks()) {
44004 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44005 xmlMemBlocks() - mem_base);
44006 test_ret++;
44007 printf(" %d", n_output);
44008 printf(" %d", n_comp);
44009 printf(" %d", n_depth);
44010 printf("\n");
44011 }
44012 }
44013 }
44014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044015 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044016#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044017
Daniel Veillarda82b1822004-11-08 16:24:57 +000044018 return(test_ret);
44019}
44020
44021
44022static int
44023test_xmlXPathDebugDumpObject(void) {
44024 int test_ret = 0;
44025
William M. Brack21e4ef22005-01-02 09:53:13 +000044026#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044027 int mem_base;
44028 FILE * output; /* the FILE * to dump the output */
44029 int n_output;
44030 xmlXPathObjectPtr cur; /* the object to inspect */
44031 int n_cur;
44032 int depth; /* indentation level */
44033 int n_depth;
44034
44035 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44036 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44037 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44038 mem_base = xmlMemBlocks();
44039 output = gen_FILE_ptr(n_output, 0);
44040 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44041 depth = gen_int(n_depth, 2);
44042
44043 xmlXPathDebugDumpObject(output, cur, depth);
44044 call_tests++;
44045 des_FILE_ptr(n_output, output, 0);
44046 des_xmlXPathObjectPtr(n_cur, cur, 1);
44047 des_int(n_depth, depth, 2);
44048 xmlResetLastError();
44049 if (mem_base != xmlMemBlocks()) {
44050 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44051 xmlMemBlocks() - mem_base);
44052 test_ret++;
44053 printf(" %d", n_output);
44054 printf(" %d", n_cur);
44055 printf(" %d", n_depth);
44056 printf("\n");
44057 }
44058 }
44059 }
44060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044061 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044062#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044063
Daniel Veillarda82b1822004-11-08 16:24:57 +000044064 return(test_ret);
44065}
44066
44067
44068static int
44069test_xmlXPathDifference(void) {
44070 int test_ret = 0;
44071
William M. Brack21e4ef22005-01-02 09:53:13 +000044072#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044073 int mem_base;
44074 xmlNodeSetPtr ret_val;
44075 xmlNodeSetPtr nodes1; /* a node-set */
44076 int n_nodes1;
44077 xmlNodeSetPtr nodes2; /* a node-set */
44078 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044079
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044080 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44081 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44082 mem_base = xmlMemBlocks();
44083 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44084 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44085
44086 ret_val = xmlXPathDifference(nodes1, nodes2);
44087 desret_xmlNodeSetPtr(ret_val);
44088 call_tests++;
44089 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44090 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44091 xmlResetLastError();
44092 if (mem_base != xmlMemBlocks()) {
44093 printf("Leak of %d blocks found in xmlXPathDifference",
44094 xmlMemBlocks() - mem_base);
44095 test_ret++;
44096 printf(" %d", n_nodes1);
44097 printf(" %d", n_nodes2);
44098 printf("\n");
44099 }
44100 }
44101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044102 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044103#endif
44104
Daniel Veillarda82b1822004-11-08 16:24:57 +000044105 return(test_ret);
44106}
44107
44108
44109static int
44110test_xmlXPathDistinct(void) {
44111 int test_ret = 0;
44112
William M. Brack21e4ef22005-01-02 09:53:13 +000044113#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044114 int mem_base;
44115 xmlNodeSetPtr ret_val;
44116 xmlNodeSetPtr nodes; /* a node-set */
44117 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044118
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044119 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44120 mem_base = xmlMemBlocks();
44121 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44122
44123 ret_val = xmlXPathDistinct(nodes);
44124 desret_xmlNodeSetPtr(ret_val);
44125 call_tests++;
44126 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44127 xmlResetLastError();
44128 if (mem_base != xmlMemBlocks()) {
44129 printf("Leak of %d blocks found in xmlXPathDistinct",
44130 xmlMemBlocks() - mem_base);
44131 test_ret++;
44132 printf(" %d", n_nodes);
44133 printf("\n");
44134 }
44135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044136 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044137#endif
44138
Daniel Veillarda82b1822004-11-08 16:24:57 +000044139 return(test_ret);
44140}
44141
44142
44143static int
44144test_xmlXPathDistinctSorted(void) {
44145 int test_ret = 0;
44146
William M. Brack21e4ef22005-01-02 09:53:13 +000044147#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044148 int mem_base;
44149 xmlNodeSetPtr ret_val;
44150 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44151 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044152
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044153 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44154 mem_base = xmlMemBlocks();
44155 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44156
44157 ret_val = xmlXPathDistinctSorted(nodes);
44158 desret_xmlNodeSetPtr(ret_val);
44159 call_tests++;
44160 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44161 xmlResetLastError();
44162 if (mem_base != xmlMemBlocks()) {
44163 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44164 xmlMemBlocks() - mem_base);
44165 test_ret++;
44166 printf(" %d", n_nodes);
44167 printf("\n");
44168 }
44169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044170 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044171#endif
44172
Daniel Veillarda82b1822004-11-08 16:24:57 +000044173 return(test_ret);
44174}
44175
44176
44177static int
44178test_xmlXPathDivValues(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
44186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44187 mem_base = xmlMemBlocks();
44188 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44189
44190 xmlXPathDivValues(ctxt);
44191 call_tests++;
44192 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44193 xmlResetLastError();
44194 if (mem_base != xmlMemBlocks()) {
44195 printf("Leak of %d blocks found in xmlXPathDivValues",
44196 xmlMemBlocks() - mem_base);
44197 test_ret++;
44198 printf(" %d", n_ctxt);
44199 printf("\n");
44200 }
44201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044202 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044203#endif
44204
Daniel Veillarda82b1822004-11-08 16:24:57 +000044205 return(test_ret);
44206}
44207
44208
44209static int
44210test_xmlXPathEqualValues(void) {
44211 int test_ret = 0;
44212
William M. Brack21e4ef22005-01-02 09:53:13 +000044213#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044214 int mem_base;
44215 int ret_val;
44216 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44217 int n_ctxt;
44218
44219 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44220 mem_base = xmlMemBlocks();
44221 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44222
44223 ret_val = xmlXPathEqualValues(ctxt);
44224 desret_int(ret_val);
44225 call_tests++;
44226 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44227 xmlResetLastError();
44228 if (mem_base != xmlMemBlocks()) {
44229 printf("Leak of %d blocks found in xmlXPathEqualValues",
44230 xmlMemBlocks() - mem_base);
44231 test_ret++;
44232 printf(" %d", n_ctxt);
44233 printf("\n");
44234 }
44235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044236 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044237#endif
44238
Daniel Veillarda82b1822004-11-08 16:24:57 +000044239 return(test_ret);
44240}
44241
44242
44243static int
44244test_xmlXPathErr(void) {
44245 int test_ret = 0;
44246
William M. Brack21e4ef22005-01-02 09:53:13 +000044247#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044248 int mem_base;
44249 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44250 int n_ctxt;
44251 int error; /* the error code */
44252 int n_error;
44253
44254 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44255 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44256 mem_base = xmlMemBlocks();
44257 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44258 error = gen_int(n_error, 1);
44259
44260 xmlXPathErr(ctxt, error);
44261 call_tests++;
44262 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44263 des_int(n_error, error, 1);
44264 xmlResetLastError();
44265 if (mem_base != xmlMemBlocks()) {
44266 printf("Leak of %d blocks found in xmlXPathErr",
44267 xmlMemBlocks() - mem_base);
44268 test_ret++;
44269 printf(" %d", n_ctxt);
44270 printf(" %d", n_error);
44271 printf("\n");
44272 }
44273 }
44274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044275 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044276#endif
44277
Daniel Veillarda82b1822004-11-08 16:24:57 +000044278 return(test_ret);
44279}
44280
44281
44282static int
44283test_xmlXPathEvalExpr(void) {
44284 int test_ret = 0;
44285
William M. Brack21e4ef22005-01-02 09:53:13 +000044286#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044287 int mem_base;
44288 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44289 int n_ctxt;
44290
44291 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44292 mem_base = xmlMemBlocks();
44293 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44294
44295 xmlXPathEvalExpr(ctxt);
44296 call_tests++;
44297 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44298 xmlResetLastError();
44299 if (mem_base != xmlMemBlocks()) {
44300 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44301 xmlMemBlocks() - mem_base);
44302 test_ret++;
44303 printf(" %d", n_ctxt);
44304 printf("\n");
44305 }
44306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044307 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044308#endif
44309
Daniel Veillarda82b1822004-11-08 16:24:57 +000044310 return(test_ret);
44311}
44312
44313
44314static int
44315test_xmlXPathEvaluatePredicateResult(void) {
44316 int test_ret = 0;
44317
William M. Brack21e4ef22005-01-02 09:53:13 +000044318#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044319 int mem_base;
44320 int ret_val;
44321 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44322 int n_ctxt;
44323 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44324 int n_res;
44325
44326 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44327 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44328 mem_base = xmlMemBlocks();
44329 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44330 res = gen_xmlXPathObjectPtr(n_res, 1);
44331
44332 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44333 desret_int(ret_val);
44334 call_tests++;
44335 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44336 des_xmlXPathObjectPtr(n_res, res, 1);
44337 xmlResetLastError();
44338 if (mem_base != xmlMemBlocks()) {
44339 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44340 xmlMemBlocks() - mem_base);
44341 test_ret++;
44342 printf(" %d", n_ctxt);
44343 printf(" %d", n_res);
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_xmlXPathFalseFunction(void) {
44357 int test_ret = 0;
44358
William M. Brack21e4ef22005-01-02 09:53:13 +000044359#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044360 int mem_base;
44361 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44362 int n_ctxt;
44363 int nargs; /* the number of arguments */
44364 int n_nargs;
44365
44366 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44367 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44368 mem_base = xmlMemBlocks();
44369 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44370 nargs = gen_int(n_nargs, 1);
44371
44372 xmlXPathFalseFunction(ctxt, nargs);
44373 call_tests++;
44374 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44375 des_int(n_nargs, nargs, 1);
44376 xmlResetLastError();
44377 if (mem_base != xmlMemBlocks()) {
44378 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44379 xmlMemBlocks() - mem_base);
44380 test_ret++;
44381 printf(" %d", n_ctxt);
44382 printf(" %d", n_nargs);
44383 printf("\n");
44384 }
44385 }
44386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044387 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044388#endif
44389
Daniel Veillarda82b1822004-11-08 16:24:57 +000044390 return(test_ret);
44391}
44392
44393
44394static int
44395test_xmlXPathFloorFunction(void) {
44396 int test_ret = 0;
44397
William M. Brack21e4ef22005-01-02 09:53:13 +000044398#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044399 int mem_base;
44400 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44401 int n_ctxt;
44402 int nargs; /* the number of arguments */
44403 int n_nargs;
44404
44405 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44406 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44407 mem_base = xmlMemBlocks();
44408 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44409 nargs = gen_int(n_nargs, 1);
44410
44411 xmlXPathFloorFunction(ctxt, nargs);
44412 call_tests++;
44413 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44414 des_int(n_nargs, nargs, 1);
44415 xmlResetLastError();
44416 if (mem_base != xmlMemBlocks()) {
44417 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44418 xmlMemBlocks() - mem_base);
44419 test_ret++;
44420 printf(" %d", n_ctxt);
44421 printf(" %d", n_nargs);
44422 printf("\n");
44423 }
44424 }
44425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044426 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044427#endif
44428
Daniel Veillarda82b1822004-11-08 16:24:57 +000044429 return(test_ret);
44430}
44431
44432
44433static int
44434test_xmlXPathFunctionLookup(void) {
44435 int test_ret = 0;
44436
44437
44438 /* missing type support */
44439 return(test_ret);
44440}
44441
44442
44443static int
44444test_xmlXPathFunctionLookupNS(void) {
44445 int test_ret = 0;
44446
44447
44448 /* missing type support */
44449 return(test_ret);
44450}
44451
44452
44453static int
44454test_xmlXPathHasSameNodes(void) {
44455 int test_ret = 0;
44456
William M. Brack21e4ef22005-01-02 09:53:13 +000044457#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044458 int mem_base;
44459 int ret_val;
44460 xmlNodeSetPtr nodes1; /* a node-set */
44461 int n_nodes1;
44462 xmlNodeSetPtr nodes2; /* a node-set */
44463 int n_nodes2;
44464
44465 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44466 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44467 mem_base = xmlMemBlocks();
44468 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44469 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44470
44471 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44472 desret_int(ret_val);
44473 call_tests++;
44474 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44475 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44476 xmlResetLastError();
44477 if (mem_base != xmlMemBlocks()) {
44478 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44479 xmlMemBlocks() - mem_base);
44480 test_ret++;
44481 printf(" %d", n_nodes1);
44482 printf(" %d", n_nodes2);
44483 printf("\n");
44484 }
44485 }
44486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044487 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044488#endif
44489
Daniel Veillarda82b1822004-11-08 16:24:57 +000044490 return(test_ret);
44491}
44492
44493
44494static int
44495test_xmlXPathIdFunction(void) {
44496 int test_ret = 0;
44497
William M. Brack21e4ef22005-01-02 09:53:13 +000044498#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044499 int mem_base;
44500 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44501 int n_ctxt;
44502 int nargs; /* the number of arguments */
44503 int n_nargs;
44504
44505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44506 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44507 mem_base = xmlMemBlocks();
44508 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44509 nargs = gen_int(n_nargs, 1);
44510
44511 xmlXPathIdFunction(ctxt, nargs);
44512 call_tests++;
44513 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44514 des_int(n_nargs, nargs, 1);
44515 xmlResetLastError();
44516 if (mem_base != xmlMemBlocks()) {
44517 printf("Leak of %d blocks found in xmlXPathIdFunction",
44518 xmlMemBlocks() - mem_base);
44519 test_ret++;
44520 printf(" %d", n_ctxt);
44521 printf(" %d", n_nargs);
44522 printf("\n");
44523 }
44524 }
44525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044526 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044527#endif
44528
Daniel Veillarda82b1822004-11-08 16:24:57 +000044529 return(test_ret);
44530}
44531
44532
44533static int
44534test_xmlXPathIntersection(void) {
44535 int test_ret = 0;
44536
William M. Brack21e4ef22005-01-02 09:53:13 +000044537#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044538 int mem_base;
44539 xmlNodeSetPtr ret_val;
44540 xmlNodeSetPtr nodes1; /* a node-set */
44541 int n_nodes1;
44542 xmlNodeSetPtr nodes2; /* a node-set */
44543 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044544
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044545 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44546 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44547 mem_base = xmlMemBlocks();
44548 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44549 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44550
44551 ret_val = xmlXPathIntersection(nodes1, nodes2);
44552 desret_xmlNodeSetPtr(ret_val);
44553 call_tests++;
44554 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44555 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44556 xmlResetLastError();
44557 if (mem_base != xmlMemBlocks()) {
44558 printf("Leak of %d blocks found in xmlXPathIntersection",
44559 xmlMemBlocks() - mem_base);
44560 test_ret++;
44561 printf(" %d", n_nodes1);
44562 printf(" %d", n_nodes2);
44563 printf("\n");
44564 }
44565 }
44566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044567 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044568#endif
44569
Daniel Veillarda82b1822004-11-08 16:24:57 +000044570 return(test_ret);
44571}
44572
44573
44574static int
44575test_xmlXPathIsNodeType(void) {
44576 int test_ret = 0;
44577
William M. Brack21e4ef22005-01-02 09:53:13 +000044578#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044579 int mem_base;
44580 int ret_val;
44581 xmlChar * name; /* a name string */
44582 int n_name;
44583
44584 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44585 mem_base = xmlMemBlocks();
44586 name = gen_const_xmlChar_ptr(n_name, 0);
44587
William M. Brackf13f77f2004-11-12 16:03:48 +000044588 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044589 desret_int(ret_val);
44590 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044591 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044592 xmlResetLastError();
44593 if (mem_base != xmlMemBlocks()) {
44594 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44595 xmlMemBlocks() - mem_base);
44596 test_ret++;
44597 printf(" %d", n_name);
44598 printf("\n");
44599 }
44600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044601 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044602#endif
44603
Daniel Veillarda82b1822004-11-08 16:24:57 +000044604 return(test_ret);
44605}
44606
44607
44608static int
44609test_xmlXPathLangFunction(void) {
44610 int test_ret = 0;
44611
William M. Brack21e4ef22005-01-02 09:53:13 +000044612#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044613 int mem_base;
44614 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44615 int n_ctxt;
44616 int nargs; /* the number of arguments */
44617 int n_nargs;
44618
44619 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44620 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44621 mem_base = xmlMemBlocks();
44622 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44623 nargs = gen_int(n_nargs, 1);
44624
44625 xmlXPathLangFunction(ctxt, nargs);
44626 call_tests++;
44627 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44628 des_int(n_nargs, nargs, 1);
44629 xmlResetLastError();
44630 if (mem_base != xmlMemBlocks()) {
44631 printf("Leak of %d blocks found in xmlXPathLangFunction",
44632 xmlMemBlocks() - mem_base);
44633 test_ret++;
44634 printf(" %d", n_ctxt);
44635 printf(" %d", n_nargs);
44636 printf("\n");
44637 }
44638 }
44639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044640 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044641#endif
44642
Daniel Veillarda82b1822004-11-08 16:24:57 +000044643 return(test_ret);
44644}
44645
44646
44647static int
44648test_xmlXPathLastFunction(void) {
44649 int test_ret = 0;
44650
William M. Brack21e4ef22005-01-02 09:53:13 +000044651#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044652 int mem_base;
44653 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44654 int n_ctxt;
44655 int nargs; /* the number of arguments */
44656 int n_nargs;
44657
44658 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44659 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44660 mem_base = xmlMemBlocks();
44661 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44662 nargs = gen_int(n_nargs, 1);
44663
44664 xmlXPathLastFunction(ctxt, nargs);
44665 call_tests++;
44666 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44667 des_int(n_nargs, nargs, 1);
44668 xmlResetLastError();
44669 if (mem_base != xmlMemBlocks()) {
44670 printf("Leak of %d blocks found in xmlXPathLastFunction",
44671 xmlMemBlocks() - mem_base);
44672 test_ret++;
44673 printf(" %d", n_ctxt);
44674 printf(" %d", n_nargs);
44675 printf("\n");
44676 }
44677 }
44678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044679 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044680#endif
44681
Daniel Veillarda82b1822004-11-08 16:24:57 +000044682 return(test_ret);
44683}
44684
44685
44686static int
44687test_xmlXPathLeading(void) {
44688 int test_ret = 0;
44689
William M. Brack21e4ef22005-01-02 09:53:13 +000044690#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044691 int mem_base;
44692 xmlNodeSetPtr ret_val;
44693 xmlNodeSetPtr nodes1; /* a node-set */
44694 int n_nodes1;
44695 xmlNodeSetPtr nodes2; /* a node-set */
44696 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044697
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044698 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44699 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44700 mem_base = xmlMemBlocks();
44701 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44702 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44703
44704 ret_val = xmlXPathLeading(nodes1, nodes2);
44705 desret_xmlNodeSetPtr(ret_val);
44706 call_tests++;
44707 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44708 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44709 xmlResetLastError();
44710 if (mem_base != xmlMemBlocks()) {
44711 printf("Leak of %d blocks found in xmlXPathLeading",
44712 xmlMemBlocks() - mem_base);
44713 test_ret++;
44714 printf(" %d", n_nodes1);
44715 printf(" %d", n_nodes2);
44716 printf("\n");
44717 }
44718 }
44719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044720 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044721#endif
44722
Daniel Veillarda82b1822004-11-08 16:24:57 +000044723 return(test_ret);
44724}
44725
44726
44727static int
44728test_xmlXPathLeadingSorted(void) {
44729 int test_ret = 0;
44730
William M. Brack21e4ef22005-01-02 09:53:13 +000044731#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044732 int mem_base;
44733 xmlNodeSetPtr ret_val;
44734 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44735 int n_nodes1;
44736 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44737 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044738
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044739 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44740 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44741 mem_base = xmlMemBlocks();
44742 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44743 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44744
44745 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44746 desret_xmlNodeSetPtr(ret_val);
44747 call_tests++;
44748 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44749 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44750 xmlResetLastError();
44751 if (mem_base != xmlMemBlocks()) {
44752 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44753 xmlMemBlocks() - mem_base);
44754 test_ret++;
44755 printf(" %d", n_nodes1);
44756 printf(" %d", n_nodes2);
44757 printf("\n");
44758 }
44759 }
44760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044761 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044762#endif
44763
Daniel Veillarda82b1822004-11-08 16:24:57 +000044764 return(test_ret);
44765}
44766
44767
44768static int
44769test_xmlXPathLocalNameFunction(void) {
44770 int test_ret = 0;
44771
William M. Brack21e4ef22005-01-02 09:53:13 +000044772#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044773 int mem_base;
44774 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44775 int n_ctxt;
44776 int nargs; /* the number of arguments */
44777 int n_nargs;
44778
44779 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44780 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44781 mem_base = xmlMemBlocks();
44782 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44783 nargs = gen_int(n_nargs, 1);
44784
44785 xmlXPathLocalNameFunction(ctxt, nargs);
44786 call_tests++;
44787 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44788 des_int(n_nargs, nargs, 1);
44789 xmlResetLastError();
44790 if (mem_base != xmlMemBlocks()) {
44791 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44792 xmlMemBlocks() - mem_base);
44793 test_ret++;
44794 printf(" %d", n_ctxt);
44795 printf(" %d", n_nargs);
44796 printf("\n");
44797 }
44798 }
44799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044800 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044801#endif
44802
Daniel Veillarda82b1822004-11-08 16:24:57 +000044803 return(test_ret);
44804}
44805
44806
44807static int
44808test_xmlXPathModValues(void) {
44809 int test_ret = 0;
44810
William M. Brack21e4ef22005-01-02 09:53:13 +000044811#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044812 int mem_base;
44813 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44814 int n_ctxt;
44815
44816 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44817 mem_base = xmlMemBlocks();
44818 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44819
44820 xmlXPathModValues(ctxt);
44821 call_tests++;
44822 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44823 xmlResetLastError();
44824 if (mem_base != xmlMemBlocks()) {
44825 printf("Leak of %d blocks found in xmlXPathModValues",
44826 xmlMemBlocks() - mem_base);
44827 test_ret++;
44828 printf(" %d", n_ctxt);
44829 printf("\n");
44830 }
44831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044832 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044833#endif
44834
Daniel Veillarda82b1822004-11-08 16:24:57 +000044835 return(test_ret);
44836}
44837
44838
44839static int
44840test_xmlXPathMultValues(void) {
44841 int test_ret = 0;
44842
William M. Brack21e4ef22005-01-02 09:53:13 +000044843#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044844 int mem_base;
44845 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44846 int n_ctxt;
44847
44848 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44849 mem_base = xmlMemBlocks();
44850 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44851
44852 xmlXPathMultValues(ctxt);
44853 call_tests++;
44854 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44855 xmlResetLastError();
44856 if (mem_base != xmlMemBlocks()) {
44857 printf("Leak of %d blocks found in xmlXPathMultValues",
44858 xmlMemBlocks() - mem_base);
44859 test_ret++;
44860 printf(" %d", n_ctxt);
44861 printf("\n");
44862 }
44863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044864 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044865#endif
44866
Daniel Veillarda82b1822004-11-08 16:24:57 +000044867 return(test_ret);
44868}
44869
44870
44871static int
44872test_xmlXPathNamespaceURIFunction(void) {
44873 int test_ret = 0;
44874
William M. Brack21e4ef22005-01-02 09:53:13 +000044875#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044876 int mem_base;
44877 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44878 int n_ctxt;
44879 int nargs; /* the number of arguments */
44880 int n_nargs;
44881
44882 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44883 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44884 mem_base = xmlMemBlocks();
44885 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44886 nargs = gen_int(n_nargs, 1);
44887
44888 xmlXPathNamespaceURIFunction(ctxt, nargs);
44889 call_tests++;
44890 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44891 des_int(n_nargs, nargs, 1);
44892 xmlResetLastError();
44893 if (mem_base != xmlMemBlocks()) {
44894 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44895 xmlMemBlocks() - mem_base);
44896 test_ret++;
44897 printf(" %d", n_ctxt);
44898 printf(" %d", n_nargs);
44899 printf("\n");
44900 }
44901 }
44902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044903 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044904#endif
44905
Daniel Veillarda82b1822004-11-08 16:24:57 +000044906 return(test_ret);
44907}
44908
44909
44910static int
44911test_xmlXPathNewBoolean(void) {
44912 int test_ret = 0;
44913
William M. Brack21e4ef22005-01-02 09:53:13 +000044914#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044915 int mem_base;
44916 xmlXPathObjectPtr ret_val;
44917 int val; /* the boolean value */
44918 int n_val;
44919
44920 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44921 mem_base = xmlMemBlocks();
44922 val = gen_int(n_val, 0);
44923
44924 ret_val = xmlXPathNewBoolean(val);
44925 desret_xmlXPathObjectPtr(ret_val);
44926 call_tests++;
44927 des_int(n_val, val, 0);
44928 xmlResetLastError();
44929 if (mem_base != xmlMemBlocks()) {
44930 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44931 xmlMemBlocks() - mem_base);
44932 test_ret++;
44933 printf(" %d", n_val);
44934 printf("\n");
44935 }
44936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044937 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044938#endif
44939
Daniel Veillarda82b1822004-11-08 16:24:57 +000044940 return(test_ret);
44941}
44942
44943
44944static int
44945test_xmlXPathNewCString(void) {
44946 int test_ret = 0;
44947
William M. Brack21e4ef22005-01-02 09:53:13 +000044948#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044949 int mem_base;
44950 xmlXPathObjectPtr ret_val;
44951 char * val; /* the char * value */
44952 int n_val;
44953
44954 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44955 mem_base = xmlMemBlocks();
44956 val = gen_const_char_ptr(n_val, 0);
44957
William M. Brackf13f77f2004-11-12 16:03:48 +000044958 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044959 desret_xmlXPathObjectPtr(ret_val);
44960 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044961 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044962 xmlResetLastError();
44963 if (mem_base != xmlMemBlocks()) {
44964 printf("Leak of %d blocks found in xmlXPathNewCString",
44965 xmlMemBlocks() - mem_base);
44966 test_ret++;
44967 printf(" %d", n_val);
44968 printf("\n");
44969 }
44970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044971 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044972#endif
44973
Daniel Veillarda82b1822004-11-08 16:24:57 +000044974 return(test_ret);
44975}
44976
44977
44978static int
44979test_xmlXPathNewFloat(void) {
44980 int test_ret = 0;
44981
William M. Brack21e4ef22005-01-02 09:53:13 +000044982#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044983 int mem_base;
44984 xmlXPathObjectPtr ret_val;
44985 double val; /* the double value */
44986 int n_val;
44987
44988 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44989 mem_base = xmlMemBlocks();
44990 val = gen_double(n_val, 0);
44991
44992 ret_val = xmlXPathNewFloat(val);
44993 desret_xmlXPathObjectPtr(ret_val);
44994 call_tests++;
44995 des_double(n_val, val, 0);
44996 xmlResetLastError();
44997 if (mem_base != xmlMemBlocks()) {
44998 printf("Leak of %d blocks found in xmlXPathNewFloat",
44999 xmlMemBlocks() - mem_base);
45000 test_ret++;
45001 printf(" %d", n_val);
45002 printf("\n");
45003 }
45004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045005 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045006#endif
45007
Daniel Veillarda82b1822004-11-08 16:24:57 +000045008 return(test_ret);
45009}
45010
45011
45012static int
45013test_xmlXPathNewNodeSet(void) {
45014 int test_ret = 0;
45015
William M. Brack21e4ef22005-01-02 09:53:13 +000045016#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045017 int mem_base;
45018 xmlXPathObjectPtr ret_val;
45019 xmlNodePtr val; /* the NodePtr value */
45020 int n_val;
45021
45022 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45023 mem_base = xmlMemBlocks();
45024 val = gen_xmlNodePtr(n_val, 0);
45025
45026 ret_val = xmlXPathNewNodeSet(val);
45027 desret_xmlXPathObjectPtr(ret_val);
45028 call_tests++;
45029 des_xmlNodePtr(n_val, val, 0);
45030 xmlResetLastError();
45031 if (mem_base != xmlMemBlocks()) {
45032 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45033 xmlMemBlocks() - mem_base);
45034 test_ret++;
45035 printf(" %d", n_val);
45036 printf("\n");
45037 }
45038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045039 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045040#endif
45041
Daniel Veillarda82b1822004-11-08 16:24:57 +000045042 return(test_ret);
45043}
45044
45045
45046static int
45047test_xmlXPathNewNodeSetList(void) {
45048 int test_ret = 0;
45049
William M. Brack21e4ef22005-01-02 09:53:13 +000045050#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045051 int mem_base;
45052 xmlXPathObjectPtr ret_val;
45053 xmlNodeSetPtr val; /* an existing NodeSet */
45054 int n_val;
45055
45056 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45057 mem_base = xmlMemBlocks();
45058 val = gen_xmlNodeSetPtr(n_val, 0);
45059
45060 ret_val = xmlXPathNewNodeSetList(val);
45061 desret_xmlXPathObjectPtr(ret_val);
45062 call_tests++;
45063 des_xmlNodeSetPtr(n_val, val, 0);
45064 xmlResetLastError();
45065 if (mem_base != xmlMemBlocks()) {
45066 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45067 xmlMemBlocks() - mem_base);
45068 test_ret++;
45069 printf(" %d", n_val);
45070 printf("\n");
45071 }
45072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045073 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045074#endif
45075
Daniel Veillarda82b1822004-11-08 16:24:57 +000045076 return(test_ret);
45077}
45078
45079
45080static int
45081test_xmlXPathNewParserContext(void) {
45082 int test_ret = 0;
45083
45084
45085 /* missing type support */
45086 return(test_ret);
45087}
45088
45089
45090static int
45091test_xmlXPathNewString(void) {
45092 int test_ret = 0;
45093
William M. Brack21e4ef22005-01-02 09:53:13 +000045094#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045095 int mem_base;
45096 xmlXPathObjectPtr ret_val;
45097 xmlChar * val; /* the xmlChar * value */
45098 int n_val;
45099
45100 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45101 mem_base = xmlMemBlocks();
45102 val = gen_const_xmlChar_ptr(n_val, 0);
45103
William M. Brackf13f77f2004-11-12 16:03:48 +000045104 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045105 desret_xmlXPathObjectPtr(ret_val);
45106 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045107 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045108 xmlResetLastError();
45109 if (mem_base != xmlMemBlocks()) {
45110 printf("Leak of %d blocks found in xmlXPathNewString",
45111 xmlMemBlocks() - mem_base);
45112 test_ret++;
45113 printf(" %d", n_val);
45114 printf("\n");
45115 }
45116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045117 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045118#endif
45119
Daniel Veillarda82b1822004-11-08 16:24:57 +000045120 return(test_ret);
45121}
45122
45123
45124static int
45125test_xmlXPathNextAncestor(void) {
45126 int test_ret = 0;
45127
William M. Brack21e4ef22005-01-02 09:53:13 +000045128#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045129 int mem_base;
45130 xmlNodePtr ret_val;
45131 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45132 int n_ctxt;
45133 xmlNodePtr cur; /* the current node in the traversal */
45134 int n_cur;
45135
45136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45137 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45138 mem_base = xmlMemBlocks();
45139 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45140 cur = gen_xmlNodePtr(n_cur, 1);
45141
45142 ret_val = xmlXPathNextAncestor(ctxt, cur);
45143 desret_xmlNodePtr(ret_val);
45144 call_tests++;
45145 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45146 des_xmlNodePtr(n_cur, cur, 1);
45147 xmlResetLastError();
45148 if (mem_base != xmlMemBlocks()) {
45149 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45150 xmlMemBlocks() - mem_base);
45151 test_ret++;
45152 printf(" %d", n_ctxt);
45153 printf(" %d", n_cur);
45154 printf("\n");
45155 }
45156 }
45157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045158 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045159#endif
45160
Daniel Veillarda82b1822004-11-08 16:24:57 +000045161 return(test_ret);
45162}
45163
45164
45165static int
45166test_xmlXPathNextAncestorOrSelf(void) {
45167 int test_ret = 0;
45168
William M. Brack21e4ef22005-01-02 09:53:13 +000045169#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045170 int mem_base;
45171 xmlNodePtr ret_val;
45172 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45173 int n_ctxt;
45174 xmlNodePtr cur; /* the current node in the traversal */
45175 int n_cur;
45176
45177 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45178 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45179 mem_base = xmlMemBlocks();
45180 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45181 cur = gen_xmlNodePtr(n_cur, 1);
45182
45183 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45184 desret_xmlNodePtr(ret_val);
45185 call_tests++;
45186 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45187 des_xmlNodePtr(n_cur, cur, 1);
45188 xmlResetLastError();
45189 if (mem_base != xmlMemBlocks()) {
45190 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45191 xmlMemBlocks() - mem_base);
45192 test_ret++;
45193 printf(" %d", n_ctxt);
45194 printf(" %d", n_cur);
45195 printf("\n");
45196 }
45197 }
45198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045199 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045200#endif
45201
Daniel Veillarda82b1822004-11-08 16:24:57 +000045202 return(test_ret);
45203}
45204
45205
45206static int
45207test_xmlXPathNextAttribute(void) {
45208 int test_ret = 0;
45209
William M. Brack21e4ef22005-01-02 09:53:13 +000045210#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045211 int mem_base;
45212 xmlNodePtr ret_val;
45213 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45214 int n_ctxt;
45215 xmlNodePtr cur; /* the current attribute in the traversal */
45216 int n_cur;
45217
45218 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45219 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45220 mem_base = xmlMemBlocks();
45221 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45222 cur = gen_xmlNodePtr(n_cur, 1);
45223
45224 ret_val = xmlXPathNextAttribute(ctxt, cur);
45225 desret_xmlNodePtr(ret_val);
45226 call_tests++;
45227 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45228 des_xmlNodePtr(n_cur, cur, 1);
45229 xmlResetLastError();
45230 if (mem_base != xmlMemBlocks()) {
45231 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45232 xmlMemBlocks() - mem_base);
45233 test_ret++;
45234 printf(" %d", n_ctxt);
45235 printf(" %d", n_cur);
45236 printf("\n");
45237 }
45238 }
45239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045240 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045241#endif
45242
Daniel Veillarda82b1822004-11-08 16:24:57 +000045243 return(test_ret);
45244}
45245
45246
45247static int
45248test_xmlXPathNextChild(void) {
45249 int test_ret = 0;
45250
William M. Brack21e4ef22005-01-02 09:53:13 +000045251#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045252 int mem_base;
45253 xmlNodePtr ret_val;
45254 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45255 int n_ctxt;
45256 xmlNodePtr cur; /* the current node in the traversal */
45257 int n_cur;
45258
45259 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45260 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45261 mem_base = xmlMemBlocks();
45262 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45263 cur = gen_xmlNodePtr(n_cur, 1);
45264
45265 ret_val = xmlXPathNextChild(ctxt, cur);
45266 desret_xmlNodePtr(ret_val);
45267 call_tests++;
45268 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45269 des_xmlNodePtr(n_cur, cur, 1);
45270 xmlResetLastError();
45271 if (mem_base != xmlMemBlocks()) {
45272 printf("Leak of %d blocks found in xmlXPathNextChild",
45273 xmlMemBlocks() - mem_base);
45274 test_ret++;
45275 printf(" %d", n_ctxt);
45276 printf(" %d", n_cur);
45277 printf("\n");
45278 }
45279 }
45280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045281 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045282#endif
45283
Daniel Veillarda82b1822004-11-08 16:24:57 +000045284 return(test_ret);
45285}
45286
45287
45288static int
45289test_xmlXPathNextDescendant(void) {
45290 int test_ret = 0;
45291
William M. Brack21e4ef22005-01-02 09:53:13 +000045292#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045293 int mem_base;
45294 xmlNodePtr ret_val;
45295 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45296 int n_ctxt;
45297 xmlNodePtr cur; /* the current node in the traversal */
45298 int n_cur;
45299
45300 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45301 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45302 mem_base = xmlMemBlocks();
45303 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45304 cur = gen_xmlNodePtr(n_cur, 1);
45305
45306 ret_val = xmlXPathNextDescendant(ctxt, cur);
45307 desret_xmlNodePtr(ret_val);
45308 call_tests++;
45309 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45310 des_xmlNodePtr(n_cur, cur, 1);
45311 xmlResetLastError();
45312 if (mem_base != xmlMemBlocks()) {
45313 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45314 xmlMemBlocks() - mem_base);
45315 test_ret++;
45316 printf(" %d", n_ctxt);
45317 printf(" %d", n_cur);
45318 printf("\n");
45319 }
45320 }
45321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045322 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045323#endif
45324
Daniel Veillarda82b1822004-11-08 16:24:57 +000045325 return(test_ret);
45326}
45327
45328
45329static int
45330test_xmlXPathNextDescendantOrSelf(void) {
45331 int test_ret = 0;
45332
William M. Brack21e4ef22005-01-02 09:53:13 +000045333#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045334 int mem_base;
45335 xmlNodePtr ret_val;
45336 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45337 int n_ctxt;
45338 xmlNodePtr cur; /* the current node in the traversal */
45339 int n_cur;
45340
45341 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45342 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45343 mem_base = xmlMemBlocks();
45344 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45345 cur = gen_xmlNodePtr(n_cur, 1);
45346
45347 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45348 desret_xmlNodePtr(ret_val);
45349 call_tests++;
45350 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45351 des_xmlNodePtr(n_cur, cur, 1);
45352 xmlResetLastError();
45353 if (mem_base != xmlMemBlocks()) {
45354 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45355 xmlMemBlocks() - mem_base);
45356 test_ret++;
45357 printf(" %d", n_ctxt);
45358 printf(" %d", n_cur);
45359 printf("\n");
45360 }
45361 }
45362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045363 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045364#endif
45365
Daniel Veillarda82b1822004-11-08 16:24:57 +000045366 return(test_ret);
45367}
45368
45369
45370static int
45371test_xmlXPathNextFollowing(void) {
45372 int test_ret = 0;
45373
William M. Brack21e4ef22005-01-02 09:53:13 +000045374#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045375 int mem_base;
45376 xmlNodePtr ret_val;
45377 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45378 int n_ctxt;
45379 xmlNodePtr cur; /* the current node in the traversal */
45380 int n_cur;
45381
45382 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45383 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45384 mem_base = xmlMemBlocks();
45385 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45386 cur = gen_xmlNodePtr(n_cur, 1);
45387
45388 ret_val = xmlXPathNextFollowing(ctxt, cur);
45389 desret_xmlNodePtr(ret_val);
45390 call_tests++;
45391 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45392 des_xmlNodePtr(n_cur, cur, 1);
45393 xmlResetLastError();
45394 if (mem_base != xmlMemBlocks()) {
45395 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45396 xmlMemBlocks() - mem_base);
45397 test_ret++;
45398 printf(" %d", n_ctxt);
45399 printf(" %d", n_cur);
45400 printf("\n");
45401 }
45402 }
45403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045404 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045405#endif
45406
Daniel Veillarda82b1822004-11-08 16:24:57 +000045407 return(test_ret);
45408}
45409
45410
45411static int
45412test_xmlXPathNextFollowingSibling(void) {
45413 int test_ret = 0;
45414
William M. Brack21e4ef22005-01-02 09:53:13 +000045415#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045416 int mem_base;
45417 xmlNodePtr ret_val;
45418 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45419 int n_ctxt;
45420 xmlNodePtr cur; /* the current node in the traversal */
45421 int n_cur;
45422
45423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45424 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45425 mem_base = xmlMemBlocks();
45426 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45427 cur = gen_xmlNodePtr(n_cur, 1);
45428
45429 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45430 desret_xmlNodePtr(ret_val);
45431 call_tests++;
45432 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45433 des_xmlNodePtr(n_cur, cur, 1);
45434 xmlResetLastError();
45435 if (mem_base != xmlMemBlocks()) {
45436 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45437 xmlMemBlocks() - mem_base);
45438 test_ret++;
45439 printf(" %d", n_ctxt);
45440 printf(" %d", n_cur);
45441 printf("\n");
45442 }
45443 }
45444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045445 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045446#endif
45447
Daniel Veillarda82b1822004-11-08 16:24:57 +000045448 return(test_ret);
45449}
45450
45451
45452static int
45453test_xmlXPathNextNamespace(void) {
45454 int test_ret = 0;
45455
William M. Brack21e4ef22005-01-02 09:53:13 +000045456#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045457 int mem_base;
45458 xmlNodePtr ret_val;
45459 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45460 int n_ctxt;
45461 xmlNodePtr cur; /* the current attribute in the traversal */
45462 int n_cur;
45463
45464 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45465 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45466 mem_base = xmlMemBlocks();
45467 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45468 cur = gen_xmlNodePtr(n_cur, 1);
45469
45470 ret_val = xmlXPathNextNamespace(ctxt, cur);
45471 desret_xmlNodePtr(ret_val);
45472 call_tests++;
45473 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45474 des_xmlNodePtr(n_cur, cur, 1);
45475 xmlResetLastError();
45476 if (mem_base != xmlMemBlocks()) {
45477 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45478 xmlMemBlocks() - mem_base);
45479 test_ret++;
45480 printf(" %d", n_ctxt);
45481 printf(" %d", n_cur);
45482 printf("\n");
45483 }
45484 }
45485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045486 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045487#endif
45488
Daniel Veillarda82b1822004-11-08 16:24:57 +000045489 return(test_ret);
45490}
45491
45492
45493static int
45494test_xmlXPathNextParent(void) {
45495 int test_ret = 0;
45496
William M. Brack21e4ef22005-01-02 09:53:13 +000045497#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045498 int mem_base;
45499 xmlNodePtr ret_val;
45500 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45501 int n_ctxt;
45502 xmlNodePtr cur; /* the current node in the traversal */
45503 int n_cur;
45504
45505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45506 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45507 mem_base = xmlMemBlocks();
45508 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45509 cur = gen_xmlNodePtr(n_cur, 1);
45510
45511 ret_val = xmlXPathNextParent(ctxt, cur);
45512 desret_xmlNodePtr(ret_val);
45513 call_tests++;
45514 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45515 des_xmlNodePtr(n_cur, cur, 1);
45516 xmlResetLastError();
45517 if (mem_base != xmlMemBlocks()) {
45518 printf("Leak of %d blocks found in xmlXPathNextParent",
45519 xmlMemBlocks() - mem_base);
45520 test_ret++;
45521 printf(" %d", n_ctxt);
45522 printf(" %d", n_cur);
45523 printf("\n");
45524 }
45525 }
45526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045527 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045528#endif
45529
Daniel Veillarda82b1822004-11-08 16:24:57 +000045530 return(test_ret);
45531}
45532
45533
45534static int
45535test_xmlXPathNextPreceding(void) {
45536 int test_ret = 0;
45537
William M. Brack21e4ef22005-01-02 09:53:13 +000045538#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045539 int mem_base;
45540 xmlNodePtr ret_val;
45541 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45542 int n_ctxt;
45543 xmlNodePtr cur; /* the current node in the traversal */
45544 int n_cur;
45545
45546 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45547 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45548 mem_base = xmlMemBlocks();
45549 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45550 cur = gen_xmlNodePtr(n_cur, 1);
45551
45552 ret_val = xmlXPathNextPreceding(ctxt, cur);
45553 desret_xmlNodePtr(ret_val);
45554 call_tests++;
45555 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45556 des_xmlNodePtr(n_cur, cur, 1);
45557 xmlResetLastError();
45558 if (mem_base != xmlMemBlocks()) {
45559 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45560 xmlMemBlocks() - mem_base);
45561 test_ret++;
45562 printf(" %d", n_ctxt);
45563 printf(" %d", n_cur);
45564 printf("\n");
45565 }
45566 }
45567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045568 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045569#endif
45570
Daniel Veillarda82b1822004-11-08 16:24:57 +000045571 return(test_ret);
45572}
45573
45574
45575static int
45576test_xmlXPathNextPrecedingSibling(void) {
45577 int test_ret = 0;
45578
William M. Brack21e4ef22005-01-02 09:53:13 +000045579#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045580 int mem_base;
45581 xmlNodePtr ret_val;
45582 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45583 int n_ctxt;
45584 xmlNodePtr cur; /* the current node in the traversal */
45585 int n_cur;
45586
45587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45588 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45589 mem_base = xmlMemBlocks();
45590 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45591 cur = gen_xmlNodePtr(n_cur, 1);
45592
45593 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45594 desret_xmlNodePtr(ret_val);
45595 call_tests++;
45596 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45597 des_xmlNodePtr(n_cur, cur, 1);
45598 xmlResetLastError();
45599 if (mem_base != xmlMemBlocks()) {
45600 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45601 xmlMemBlocks() - mem_base);
45602 test_ret++;
45603 printf(" %d", n_ctxt);
45604 printf(" %d", n_cur);
45605 printf("\n");
45606 }
45607 }
45608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045609 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045610#endif
45611
Daniel Veillarda82b1822004-11-08 16:24:57 +000045612 return(test_ret);
45613}
45614
45615
45616static int
45617test_xmlXPathNextSelf(void) {
45618 int test_ret = 0;
45619
William M. Brack21e4ef22005-01-02 09:53:13 +000045620#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045621 int mem_base;
45622 xmlNodePtr ret_val;
45623 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45624 int n_ctxt;
45625 xmlNodePtr cur; /* the current node in the traversal */
45626 int n_cur;
45627
45628 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45629 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45630 mem_base = xmlMemBlocks();
45631 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45632 cur = gen_xmlNodePtr(n_cur, 1);
45633
45634 ret_val = xmlXPathNextSelf(ctxt, cur);
45635 desret_xmlNodePtr(ret_val);
45636 call_tests++;
45637 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45638 des_xmlNodePtr(n_cur, cur, 1);
45639 xmlResetLastError();
45640 if (mem_base != xmlMemBlocks()) {
45641 printf("Leak of %d blocks found in xmlXPathNextSelf",
45642 xmlMemBlocks() - mem_base);
45643 test_ret++;
45644 printf(" %d", n_ctxt);
45645 printf(" %d", n_cur);
45646 printf("\n");
45647 }
45648 }
45649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045650 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045651#endif
45652
Daniel Veillarda82b1822004-11-08 16:24:57 +000045653 return(test_ret);
45654}
45655
45656
45657static int
45658test_xmlXPathNodeLeading(void) {
45659 int test_ret = 0;
45660
William M. Brack21e4ef22005-01-02 09:53:13 +000045661#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045662 int mem_base;
45663 xmlNodeSetPtr ret_val;
45664 xmlNodeSetPtr nodes; /* a node-set */
45665 int n_nodes;
45666 xmlNodePtr node; /* a node */
45667 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045668
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045669 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45670 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45671 mem_base = xmlMemBlocks();
45672 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45673 node = gen_xmlNodePtr(n_node, 1);
45674
45675 ret_val = xmlXPathNodeLeading(nodes, node);
45676 desret_xmlNodeSetPtr(ret_val);
45677 call_tests++;
45678 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45679 des_xmlNodePtr(n_node, node, 1);
45680 xmlResetLastError();
45681 if (mem_base != xmlMemBlocks()) {
45682 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45683 xmlMemBlocks() - mem_base);
45684 test_ret++;
45685 printf(" %d", n_nodes);
45686 printf(" %d", n_node);
45687 printf("\n");
45688 }
45689 }
45690 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045691 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045692#endif
45693
Daniel Veillarda82b1822004-11-08 16:24:57 +000045694 return(test_ret);
45695}
45696
45697
45698static int
45699test_xmlXPathNodeLeadingSorted(void) {
45700 int test_ret = 0;
45701
William M. Brack21e4ef22005-01-02 09:53:13 +000045702#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045703 int mem_base;
45704 xmlNodeSetPtr ret_val;
45705 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45706 int n_nodes;
45707 xmlNodePtr node; /* a node */
45708 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045709
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045710 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45711 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45712 mem_base = xmlMemBlocks();
45713 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45714 node = gen_xmlNodePtr(n_node, 1);
45715
45716 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45717 desret_xmlNodeSetPtr(ret_val);
45718 call_tests++;
45719 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45720 des_xmlNodePtr(n_node, node, 1);
45721 xmlResetLastError();
45722 if (mem_base != xmlMemBlocks()) {
45723 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45724 xmlMemBlocks() - mem_base);
45725 test_ret++;
45726 printf(" %d", n_nodes);
45727 printf(" %d", n_node);
45728 printf("\n");
45729 }
45730 }
45731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045732 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045733#endif
45734
Daniel Veillarda82b1822004-11-08 16:24:57 +000045735 return(test_ret);
45736}
45737
45738
45739static int
45740test_xmlXPathNodeSetAdd(void) {
45741 int test_ret = 0;
45742
William M. Brack21e4ef22005-01-02 09:53:13 +000045743#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045744 int mem_base;
45745 xmlNodeSetPtr cur; /* the initial node set */
45746 int n_cur;
45747 xmlNodePtr val; /* a new xmlNodePtr */
45748 int n_val;
45749
45750 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45751 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45752 mem_base = xmlMemBlocks();
45753 cur = gen_xmlNodeSetPtr(n_cur, 0);
45754 val = gen_xmlNodePtr(n_val, 1);
45755
45756 xmlXPathNodeSetAdd(cur, val);
45757 call_tests++;
45758 des_xmlNodeSetPtr(n_cur, cur, 0);
45759 des_xmlNodePtr(n_val, val, 1);
45760 xmlResetLastError();
45761 if (mem_base != xmlMemBlocks()) {
45762 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45763 xmlMemBlocks() - mem_base);
45764 test_ret++;
45765 printf(" %d", n_cur);
45766 printf(" %d", n_val);
45767 printf("\n");
45768 }
45769 }
45770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045771 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045772#endif
45773
Daniel Veillarda82b1822004-11-08 16:24:57 +000045774 return(test_ret);
45775}
45776
45777
45778static int
45779test_xmlXPathNodeSetAddNs(void) {
45780 int test_ret = 0;
45781
William M. Brack21e4ef22005-01-02 09:53:13 +000045782#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045783 int mem_base;
45784 xmlNodeSetPtr cur; /* the initial node set */
45785 int n_cur;
45786 xmlNodePtr node; /* the hosting node */
45787 int n_node;
45788 xmlNsPtr ns; /* a the namespace node */
45789 int n_ns;
45790
45791 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45792 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45793 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45794 mem_base = xmlMemBlocks();
45795 cur = gen_xmlNodeSetPtr(n_cur, 0);
45796 node = gen_xmlNodePtr(n_node, 1);
45797 ns = gen_xmlNsPtr(n_ns, 2);
45798
45799 xmlXPathNodeSetAddNs(cur, node, ns);
45800 call_tests++;
45801 des_xmlNodeSetPtr(n_cur, cur, 0);
45802 des_xmlNodePtr(n_node, node, 1);
45803 des_xmlNsPtr(n_ns, ns, 2);
45804 xmlResetLastError();
45805 if (mem_base != xmlMemBlocks()) {
45806 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45807 xmlMemBlocks() - mem_base);
45808 test_ret++;
45809 printf(" %d", n_cur);
45810 printf(" %d", n_node);
45811 printf(" %d", n_ns);
45812 printf("\n");
45813 }
45814 }
45815 }
45816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045817 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045818#endif
45819
Daniel Veillarda82b1822004-11-08 16:24:57 +000045820 return(test_ret);
45821}
45822
45823
45824static int
45825test_xmlXPathNodeSetAddUnique(void) {
45826 int test_ret = 0;
45827
William M. Brack21e4ef22005-01-02 09:53:13 +000045828#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045829 int mem_base;
45830 xmlNodeSetPtr cur; /* the initial node set */
45831 int n_cur;
45832 xmlNodePtr val; /* a new xmlNodePtr */
45833 int n_val;
45834
45835 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45836 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45837 mem_base = xmlMemBlocks();
45838 cur = gen_xmlNodeSetPtr(n_cur, 0);
45839 val = gen_xmlNodePtr(n_val, 1);
45840
45841 xmlXPathNodeSetAddUnique(cur, val);
45842 call_tests++;
45843 des_xmlNodeSetPtr(n_cur, cur, 0);
45844 des_xmlNodePtr(n_val, val, 1);
45845 xmlResetLastError();
45846 if (mem_base != xmlMemBlocks()) {
45847 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45848 xmlMemBlocks() - mem_base);
45849 test_ret++;
45850 printf(" %d", n_cur);
45851 printf(" %d", n_val);
45852 printf("\n");
45853 }
45854 }
45855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045856 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045857#endif
45858
Daniel Veillarda82b1822004-11-08 16:24:57 +000045859 return(test_ret);
45860}
45861
45862
45863static int
45864test_xmlXPathNodeSetContains(void) {
45865 int test_ret = 0;
45866
William M. Brack21e4ef22005-01-02 09:53:13 +000045867#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045868 int mem_base;
45869 int ret_val;
45870 xmlNodeSetPtr cur; /* the node-set */
45871 int n_cur;
45872 xmlNodePtr val; /* the node */
45873 int n_val;
45874
45875 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45876 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45877 mem_base = xmlMemBlocks();
45878 cur = gen_xmlNodeSetPtr(n_cur, 0);
45879 val = gen_xmlNodePtr(n_val, 1);
45880
45881 ret_val = xmlXPathNodeSetContains(cur, val);
45882 desret_int(ret_val);
45883 call_tests++;
45884 des_xmlNodeSetPtr(n_cur, cur, 0);
45885 des_xmlNodePtr(n_val, val, 1);
45886 xmlResetLastError();
45887 if (mem_base != xmlMemBlocks()) {
45888 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45889 xmlMemBlocks() - mem_base);
45890 test_ret++;
45891 printf(" %d", n_cur);
45892 printf(" %d", n_val);
45893 printf("\n");
45894 }
45895 }
45896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045897 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045898#endif
45899
Daniel Veillarda82b1822004-11-08 16:24:57 +000045900 return(test_ret);
45901}
45902
45903
45904static int
45905test_xmlXPathNodeSetDel(void) {
45906 int test_ret = 0;
45907
William M. Brack21e4ef22005-01-02 09:53:13 +000045908#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045909 int mem_base;
45910 xmlNodeSetPtr cur; /* the initial node set */
45911 int n_cur;
45912 xmlNodePtr val; /* an xmlNodePtr */
45913 int n_val;
45914
45915 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45916 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45917 mem_base = xmlMemBlocks();
45918 cur = gen_xmlNodeSetPtr(n_cur, 0);
45919 val = gen_xmlNodePtr(n_val, 1);
45920
45921 xmlXPathNodeSetDel(cur, val);
45922 call_tests++;
45923 des_xmlNodeSetPtr(n_cur, cur, 0);
45924 des_xmlNodePtr(n_val, val, 1);
45925 xmlResetLastError();
45926 if (mem_base != xmlMemBlocks()) {
45927 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45928 xmlMemBlocks() - mem_base);
45929 test_ret++;
45930 printf(" %d", n_cur);
45931 printf(" %d", n_val);
45932 printf("\n");
45933 }
45934 }
45935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045936 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045937#endif
45938
Daniel Veillarda82b1822004-11-08 16:24:57 +000045939 return(test_ret);
45940}
45941
45942
45943static int
45944test_xmlXPathNodeSetMerge(void) {
45945 int test_ret = 0;
45946
William M. Brack21e4ef22005-01-02 09:53:13 +000045947#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045948 int mem_base;
45949 xmlNodeSetPtr ret_val;
45950 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45951 int n_val1;
45952 xmlNodeSetPtr val2; /* the second NodeSet */
45953 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045954
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045955 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45956 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45957 mem_base = xmlMemBlocks();
45958 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45959 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45960
45961 ret_val = xmlXPathNodeSetMerge(val1, val2);
45962 desret_xmlNodeSetPtr(ret_val);
45963 call_tests++;
45964 des_xmlNodeSetPtr(n_val1, val1, 0);
45965 des_xmlNodeSetPtr(n_val2, val2, 1);
45966 xmlResetLastError();
45967 if (mem_base != xmlMemBlocks()) {
45968 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45969 xmlMemBlocks() - mem_base);
45970 test_ret++;
45971 printf(" %d", n_val1);
45972 printf(" %d", n_val2);
45973 printf("\n");
45974 }
45975 }
45976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045977 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045978#endif
45979
Daniel Veillarda82b1822004-11-08 16:24:57 +000045980 return(test_ret);
45981}
45982
45983
45984static int
45985test_xmlXPathNodeSetRemove(void) {
45986 int test_ret = 0;
45987
William M. Brack21e4ef22005-01-02 09:53:13 +000045988#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045989 int mem_base;
45990 xmlNodeSetPtr cur; /* the initial node set */
45991 int n_cur;
45992 int val; /* the index to remove */
45993 int n_val;
45994
45995 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45996 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45997 mem_base = xmlMemBlocks();
45998 cur = gen_xmlNodeSetPtr(n_cur, 0);
45999 val = gen_int(n_val, 1);
46000
46001 xmlXPathNodeSetRemove(cur, val);
46002 call_tests++;
46003 des_xmlNodeSetPtr(n_cur, cur, 0);
46004 des_int(n_val, val, 1);
46005 xmlResetLastError();
46006 if (mem_base != xmlMemBlocks()) {
46007 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46008 xmlMemBlocks() - mem_base);
46009 test_ret++;
46010 printf(" %d", n_cur);
46011 printf(" %d", n_val);
46012 printf("\n");
46013 }
46014 }
46015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046016 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046017#endif
46018
Daniel Veillarda82b1822004-11-08 16:24:57 +000046019 return(test_ret);
46020}
46021
46022
46023static int
46024test_xmlXPathNodeSetSort(void) {
46025 int test_ret = 0;
46026
William M. Brack21e4ef22005-01-02 09:53:13 +000046027#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046028 int mem_base;
46029 xmlNodeSetPtr set; /* the node set */
46030 int n_set;
46031
46032 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46033 mem_base = xmlMemBlocks();
46034 set = gen_xmlNodeSetPtr(n_set, 0);
46035
46036 xmlXPathNodeSetSort(set);
46037 call_tests++;
46038 des_xmlNodeSetPtr(n_set, set, 0);
46039 xmlResetLastError();
46040 if (mem_base != xmlMemBlocks()) {
46041 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46042 xmlMemBlocks() - mem_base);
46043 test_ret++;
46044 printf(" %d", n_set);
46045 printf("\n");
46046 }
46047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046048 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046049#endif
46050
Daniel Veillarda82b1822004-11-08 16:24:57 +000046051 return(test_ret);
46052}
46053
46054
46055static int
46056test_xmlXPathNodeTrailing(void) {
46057 int test_ret = 0;
46058
William M. Brack21e4ef22005-01-02 09:53:13 +000046059#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046060 int mem_base;
46061 xmlNodeSetPtr ret_val;
46062 xmlNodeSetPtr nodes; /* a node-set */
46063 int n_nodes;
46064 xmlNodePtr node; /* a node */
46065 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046066
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046067 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46068 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46069 mem_base = xmlMemBlocks();
46070 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46071 node = gen_xmlNodePtr(n_node, 1);
46072
46073 ret_val = xmlXPathNodeTrailing(nodes, node);
46074 desret_xmlNodeSetPtr(ret_val);
46075 call_tests++;
46076 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46077 des_xmlNodePtr(n_node, node, 1);
46078 xmlResetLastError();
46079 if (mem_base != xmlMemBlocks()) {
46080 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46081 xmlMemBlocks() - mem_base);
46082 test_ret++;
46083 printf(" %d", n_nodes);
46084 printf(" %d", n_node);
46085 printf("\n");
46086 }
46087 }
46088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046089 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046090#endif
46091
Daniel Veillarda82b1822004-11-08 16:24:57 +000046092 return(test_ret);
46093}
46094
46095
46096static int
46097test_xmlXPathNodeTrailingSorted(void) {
46098 int test_ret = 0;
46099
William M. Brack21e4ef22005-01-02 09:53:13 +000046100#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046101 int mem_base;
46102 xmlNodeSetPtr ret_val;
46103 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46104 int n_nodes;
46105 xmlNodePtr node; /* a node */
46106 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046107
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046108 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46109 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46110 mem_base = xmlMemBlocks();
46111 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46112 node = gen_xmlNodePtr(n_node, 1);
46113
46114 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46115 desret_xmlNodeSetPtr(ret_val);
46116 call_tests++;
46117 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46118 des_xmlNodePtr(n_node, node, 1);
46119 xmlResetLastError();
46120 if (mem_base != xmlMemBlocks()) {
46121 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46122 xmlMemBlocks() - mem_base);
46123 test_ret++;
46124 printf(" %d", n_nodes);
46125 printf(" %d", n_node);
46126 printf("\n");
46127 }
46128 }
46129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046130 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046131#endif
46132
Daniel Veillarda82b1822004-11-08 16:24:57 +000046133 return(test_ret);
46134}
46135
46136
46137static int
46138test_xmlXPathNormalizeFunction(void) {
46139 int test_ret = 0;
46140
William M. Brack21e4ef22005-01-02 09:53:13 +000046141#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046142 int mem_base;
46143 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46144 int n_ctxt;
46145 int nargs; /* the number of arguments */
46146 int n_nargs;
46147
46148 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46149 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46150 mem_base = xmlMemBlocks();
46151 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46152 nargs = gen_int(n_nargs, 1);
46153
46154 xmlXPathNormalizeFunction(ctxt, nargs);
46155 call_tests++;
46156 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46157 des_int(n_nargs, nargs, 1);
46158 xmlResetLastError();
46159 if (mem_base != xmlMemBlocks()) {
46160 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46161 xmlMemBlocks() - mem_base);
46162 test_ret++;
46163 printf(" %d", n_ctxt);
46164 printf(" %d", n_nargs);
46165 printf("\n");
46166 }
46167 }
46168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046169 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046170#endif
46171
Daniel Veillarda82b1822004-11-08 16:24:57 +000046172 return(test_ret);
46173}
46174
46175
46176static int
46177test_xmlXPathNotEqualValues(void) {
46178 int test_ret = 0;
46179
William M. Brack21e4ef22005-01-02 09:53:13 +000046180#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046181 int mem_base;
46182 int ret_val;
46183 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46184 int n_ctxt;
46185
46186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46187 mem_base = xmlMemBlocks();
46188 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46189
46190 ret_val = xmlXPathNotEqualValues(ctxt);
46191 desret_int(ret_val);
46192 call_tests++;
46193 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46194 xmlResetLastError();
46195 if (mem_base != xmlMemBlocks()) {
46196 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46197 xmlMemBlocks() - mem_base);
46198 test_ret++;
46199 printf(" %d", n_ctxt);
46200 printf("\n");
46201 }
46202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046203 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046204#endif
46205
Daniel Veillarda82b1822004-11-08 16:24:57 +000046206 return(test_ret);
46207}
46208
46209
46210static int
46211test_xmlXPathNotFunction(void) {
46212 int test_ret = 0;
46213
William M. Brack21e4ef22005-01-02 09:53:13 +000046214#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046215 int mem_base;
46216 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46217 int n_ctxt;
46218 int nargs; /* the number of arguments */
46219 int n_nargs;
46220
46221 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46222 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46223 mem_base = xmlMemBlocks();
46224 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46225 nargs = gen_int(n_nargs, 1);
46226
46227 xmlXPathNotFunction(ctxt, nargs);
46228 call_tests++;
46229 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46230 des_int(n_nargs, nargs, 1);
46231 xmlResetLastError();
46232 if (mem_base != xmlMemBlocks()) {
46233 printf("Leak of %d blocks found in xmlXPathNotFunction",
46234 xmlMemBlocks() - mem_base);
46235 test_ret++;
46236 printf(" %d", n_ctxt);
46237 printf(" %d", n_nargs);
46238 printf("\n");
46239 }
46240 }
46241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046242 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046243#endif
46244
Daniel Veillarda82b1822004-11-08 16:24:57 +000046245 return(test_ret);
46246}
46247
46248
46249static int
46250test_xmlXPathNsLookup(void) {
46251 int test_ret = 0;
46252
William M. Brack21e4ef22005-01-02 09:53:13 +000046253#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046254 int mem_base;
46255 const xmlChar * ret_val;
46256 xmlXPathContextPtr ctxt; /* the XPath context */
46257 int n_ctxt;
46258 xmlChar * prefix; /* the namespace prefix value */
46259 int n_prefix;
46260
46261 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46262 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46263 mem_base = xmlMemBlocks();
46264 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46265 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46266
William M. Brackf13f77f2004-11-12 16:03:48 +000046267 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046268 desret_const_xmlChar_ptr(ret_val);
46269 call_tests++;
46270 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046271 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046272 xmlResetLastError();
46273 if (mem_base != xmlMemBlocks()) {
46274 printf("Leak of %d blocks found in xmlXPathNsLookup",
46275 xmlMemBlocks() - mem_base);
46276 test_ret++;
46277 printf(" %d", n_ctxt);
46278 printf(" %d", n_prefix);
46279 printf("\n");
46280 }
46281 }
46282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046283 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046284#endif
46285
Daniel Veillarda82b1822004-11-08 16:24:57 +000046286 return(test_ret);
46287}
46288
46289
46290static int
46291test_xmlXPathNumberFunction(void) {
46292 int test_ret = 0;
46293
William M. Brack21e4ef22005-01-02 09:53:13 +000046294#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046295 int mem_base;
46296 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46297 int n_ctxt;
46298 int nargs; /* the number of arguments */
46299 int n_nargs;
46300
46301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46302 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46303 mem_base = xmlMemBlocks();
46304 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46305 nargs = gen_int(n_nargs, 1);
46306
46307 xmlXPathNumberFunction(ctxt, nargs);
46308 call_tests++;
46309 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46310 des_int(n_nargs, nargs, 1);
46311 xmlResetLastError();
46312 if (mem_base != xmlMemBlocks()) {
46313 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46314 xmlMemBlocks() - mem_base);
46315 test_ret++;
46316 printf(" %d", n_ctxt);
46317 printf(" %d", n_nargs);
46318 printf("\n");
46319 }
46320 }
46321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046322 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046323#endif
46324
Daniel Veillarda82b1822004-11-08 16:24:57 +000046325 return(test_ret);
46326}
46327
46328
46329static int
46330test_xmlXPathParseNCName(void) {
46331 int test_ret = 0;
46332
William M. Brack21e4ef22005-01-02 09:53:13 +000046333#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046334 int mem_base;
46335 xmlChar * ret_val;
46336 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46337 int n_ctxt;
46338
46339 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46340 mem_base = xmlMemBlocks();
46341 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46342
46343 ret_val = xmlXPathParseNCName(ctxt);
46344 desret_xmlChar_ptr(ret_val);
46345 call_tests++;
46346 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46347 xmlResetLastError();
46348 if (mem_base != xmlMemBlocks()) {
46349 printf("Leak of %d blocks found in xmlXPathParseNCName",
46350 xmlMemBlocks() - mem_base);
46351 test_ret++;
46352 printf(" %d", n_ctxt);
46353 printf("\n");
46354 }
46355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046356 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046357#endif
46358
Daniel Veillarda82b1822004-11-08 16:24:57 +000046359 return(test_ret);
46360}
46361
46362
46363static int
46364test_xmlXPathParseName(void) {
46365 int test_ret = 0;
46366
William M. Brack21e4ef22005-01-02 09:53:13 +000046367#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046368 int mem_base;
46369 xmlChar * ret_val;
46370 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46371 int n_ctxt;
46372
46373 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46374 mem_base = xmlMemBlocks();
46375 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46376
46377 ret_val = xmlXPathParseName(ctxt);
46378 desret_xmlChar_ptr(ret_val);
46379 call_tests++;
46380 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46381 xmlResetLastError();
46382 if (mem_base != xmlMemBlocks()) {
46383 printf("Leak of %d blocks found in xmlXPathParseName",
46384 xmlMemBlocks() - mem_base);
46385 test_ret++;
46386 printf(" %d", n_ctxt);
46387 printf("\n");
46388 }
46389 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046390 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046391#endif
46392
Daniel Veillarda82b1822004-11-08 16:24:57 +000046393 return(test_ret);
46394}
46395
46396
46397static int
46398test_xmlXPathPopBoolean(void) {
46399 int test_ret = 0;
46400
William M. Brack21e4ef22005-01-02 09:53:13 +000046401#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046402 int mem_base;
46403 int ret_val;
46404 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46405 int n_ctxt;
46406
46407 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46408 mem_base = xmlMemBlocks();
46409 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46410
46411 ret_val = xmlXPathPopBoolean(ctxt);
46412 desret_int(ret_val);
46413 call_tests++;
46414 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46415 xmlResetLastError();
46416 if (mem_base != xmlMemBlocks()) {
46417 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46418 xmlMemBlocks() - mem_base);
46419 test_ret++;
46420 printf(" %d", n_ctxt);
46421 printf("\n");
46422 }
46423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046424 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046425#endif
46426
Daniel Veillarda82b1822004-11-08 16:24:57 +000046427 return(test_ret);
46428}
46429
46430
46431static int
46432test_xmlXPathPopExternal(void) {
46433 int test_ret = 0;
46434
William M. Brack21e4ef22005-01-02 09:53:13 +000046435#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046436 int mem_base;
46437 void * ret_val;
46438 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46439 int n_ctxt;
46440
46441 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46442 mem_base = xmlMemBlocks();
46443 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46444
46445 ret_val = xmlXPathPopExternal(ctxt);
46446 desret_void_ptr(ret_val);
46447 call_tests++;
46448 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46449 xmlResetLastError();
46450 if (mem_base != xmlMemBlocks()) {
46451 printf("Leak of %d blocks found in xmlXPathPopExternal",
46452 xmlMemBlocks() - mem_base);
46453 test_ret++;
46454 printf(" %d", n_ctxt);
46455 printf("\n");
46456 }
46457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046458 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046459#endif
46460
Daniel Veillarda82b1822004-11-08 16:24:57 +000046461 return(test_ret);
46462}
46463
46464
46465static int
46466test_xmlXPathPopNodeSet(void) {
46467 int test_ret = 0;
46468
William M. Brack21e4ef22005-01-02 09:53:13 +000046469#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046470 int mem_base;
46471 xmlNodeSetPtr ret_val;
46472 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46473 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046474
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046475 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46476 mem_base = xmlMemBlocks();
46477 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46478
46479 ret_val = xmlXPathPopNodeSet(ctxt);
46480 desret_xmlNodeSetPtr(ret_val);
46481 call_tests++;
46482 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46483 xmlResetLastError();
46484 if (mem_base != xmlMemBlocks()) {
46485 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46486 xmlMemBlocks() - mem_base);
46487 test_ret++;
46488 printf(" %d", n_ctxt);
46489 printf("\n");
46490 }
46491 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046492 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046493#endif
46494
Daniel Veillarda82b1822004-11-08 16:24:57 +000046495 return(test_ret);
46496}
46497
46498
46499static int
46500test_xmlXPathPopNumber(void) {
46501 int test_ret = 0;
46502
William M. Brack21e4ef22005-01-02 09:53:13 +000046503#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046504 int mem_base;
46505 double ret_val;
46506 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46507 int n_ctxt;
46508
46509 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46510 mem_base = xmlMemBlocks();
46511 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46512
46513 ret_val = xmlXPathPopNumber(ctxt);
46514 desret_double(ret_val);
46515 call_tests++;
46516 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46517 xmlResetLastError();
46518 if (mem_base != xmlMemBlocks()) {
46519 printf("Leak of %d blocks found in xmlXPathPopNumber",
46520 xmlMemBlocks() - mem_base);
46521 test_ret++;
46522 printf(" %d", n_ctxt);
46523 printf("\n");
46524 }
46525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046526 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046527#endif
46528
Daniel Veillarda82b1822004-11-08 16:24:57 +000046529 return(test_ret);
46530}
46531
46532
46533static int
46534test_xmlXPathPopString(void) {
46535 int test_ret = 0;
46536
William M. Brack21e4ef22005-01-02 09:53:13 +000046537#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046538 int mem_base;
46539 xmlChar * ret_val;
46540 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46541 int n_ctxt;
46542
46543 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46544 mem_base = xmlMemBlocks();
46545 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46546
46547 ret_val = xmlXPathPopString(ctxt);
46548 desret_xmlChar_ptr(ret_val);
46549 call_tests++;
46550 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46551 xmlResetLastError();
46552 if (mem_base != xmlMemBlocks()) {
46553 printf("Leak of %d blocks found in xmlXPathPopString",
46554 xmlMemBlocks() - mem_base);
46555 test_ret++;
46556 printf(" %d", n_ctxt);
46557 printf("\n");
46558 }
46559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046560 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046561#endif
46562
Daniel Veillarda82b1822004-11-08 16:24:57 +000046563 return(test_ret);
46564}
46565
46566
46567static int
46568test_xmlXPathPositionFunction(void) {
46569 int test_ret = 0;
46570
William M. Brack21e4ef22005-01-02 09:53:13 +000046571#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046572 int mem_base;
46573 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46574 int n_ctxt;
46575 int nargs; /* the number of arguments */
46576 int n_nargs;
46577
46578 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46579 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46580 mem_base = xmlMemBlocks();
46581 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46582 nargs = gen_int(n_nargs, 1);
46583
46584 xmlXPathPositionFunction(ctxt, nargs);
46585 call_tests++;
46586 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46587 des_int(n_nargs, nargs, 1);
46588 xmlResetLastError();
46589 if (mem_base != xmlMemBlocks()) {
46590 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46591 xmlMemBlocks() - mem_base);
46592 test_ret++;
46593 printf(" %d", n_ctxt);
46594 printf(" %d", n_nargs);
46595 printf("\n");
46596 }
46597 }
46598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046599 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046600#endif
46601
Daniel Veillarda82b1822004-11-08 16:24:57 +000046602 return(test_ret);
46603}
46604
46605
46606static int
46607test_xmlXPathRegisterAllFunctions(void) {
46608 int test_ret = 0;
46609
William M. Brack21e4ef22005-01-02 09:53:13 +000046610#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046611 int mem_base;
46612 xmlXPathContextPtr ctxt; /* the XPath context */
46613 int n_ctxt;
46614
46615 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46616 mem_base = xmlMemBlocks();
46617 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46618
46619 xmlXPathRegisterAllFunctions(ctxt);
46620 call_tests++;
46621 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46622 xmlResetLastError();
46623 if (mem_base != xmlMemBlocks()) {
46624 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46625 xmlMemBlocks() - mem_base);
46626 test_ret++;
46627 printf(" %d", n_ctxt);
46628 printf("\n");
46629 }
46630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046631 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046632#endif
46633
Daniel Veillarda82b1822004-11-08 16:24:57 +000046634 return(test_ret);
46635}
46636
46637
46638static int
46639test_xmlXPathRegisterFunc(void) {
46640 int test_ret = 0;
46641
46642
46643 /* missing type support */
46644 return(test_ret);
46645}
46646
46647
46648static int
46649test_xmlXPathRegisterFuncLookup(void) {
46650 int test_ret = 0;
46651
46652
46653 /* missing type support */
46654 return(test_ret);
46655}
46656
46657
46658static int
46659test_xmlXPathRegisterFuncNS(void) {
46660 int test_ret = 0;
46661
46662
46663 /* missing type support */
46664 return(test_ret);
46665}
46666
46667
46668static int
46669test_xmlXPathRegisterNs(void) {
46670 int test_ret = 0;
46671
William M. Brack21e4ef22005-01-02 09:53:13 +000046672#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046673 int mem_base;
46674 int ret_val;
46675 xmlXPathContextPtr ctxt; /* the XPath context */
46676 int n_ctxt;
46677 xmlChar * prefix; /* the namespace prefix */
46678 int n_prefix;
46679 xmlChar * ns_uri; /* the namespace name */
46680 int n_ns_uri;
46681
46682 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46683 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46684 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46685 mem_base = xmlMemBlocks();
46686 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46687 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46688 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46689
William M. Brackf13f77f2004-11-12 16:03:48 +000046690 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046691 desret_int(ret_val);
46692 call_tests++;
46693 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046694 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46695 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046696 xmlResetLastError();
46697 if (mem_base != xmlMemBlocks()) {
46698 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46699 xmlMemBlocks() - mem_base);
46700 test_ret++;
46701 printf(" %d", n_ctxt);
46702 printf(" %d", n_prefix);
46703 printf(" %d", n_ns_uri);
46704 printf("\n");
46705 }
46706 }
46707 }
46708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046709 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046710#endif
46711
Daniel Veillarda82b1822004-11-08 16:24:57 +000046712 return(test_ret);
46713}
46714
46715
46716static int
46717test_xmlXPathRegisterVariable(void) {
46718 int test_ret = 0;
46719
William M. Brack21e4ef22005-01-02 09:53:13 +000046720#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046721 int mem_base;
46722 int ret_val;
46723 xmlXPathContextPtr ctxt; /* the XPath context */
46724 int n_ctxt;
46725 xmlChar * name; /* the variable name */
46726 int n_name;
46727 xmlXPathObjectPtr value; /* the variable value or NULL */
46728 int n_value;
46729
46730 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46731 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46732 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46733 mem_base = xmlMemBlocks();
46734 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46735 name = gen_const_xmlChar_ptr(n_name, 1);
46736 value = gen_xmlXPathObjectPtr(n_value, 2);
46737
William M. Brackf13f77f2004-11-12 16:03:48 +000046738 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046739 desret_int(ret_val);
46740 call_tests++;
46741 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046742 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046743 des_xmlXPathObjectPtr(n_value, value, 2);
46744 xmlResetLastError();
46745 if (mem_base != xmlMemBlocks()) {
46746 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46747 xmlMemBlocks() - mem_base);
46748 test_ret++;
46749 printf(" %d", n_ctxt);
46750 printf(" %d", n_name);
46751 printf(" %d", n_value);
46752 printf("\n");
46753 }
46754 }
46755 }
46756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046757 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046758#endif
46759
Daniel Veillarda82b1822004-11-08 16:24:57 +000046760 return(test_ret);
46761}
46762
46763
46764static int
46765test_xmlXPathRegisterVariableLookup(void) {
46766 int test_ret = 0;
46767
46768
46769 /* missing type support */
46770 return(test_ret);
46771}
46772
46773
46774static int
46775test_xmlXPathRegisterVariableNS(void) {
46776 int test_ret = 0;
46777
William M. Brack21e4ef22005-01-02 09:53:13 +000046778#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046779 int mem_base;
46780 int ret_val;
46781 xmlXPathContextPtr ctxt; /* the XPath context */
46782 int n_ctxt;
46783 xmlChar * name; /* the variable name */
46784 int n_name;
46785 xmlChar * ns_uri; /* the variable namespace URI */
46786 int n_ns_uri;
46787 xmlXPathObjectPtr value; /* the variable value or NULL */
46788 int n_value;
46789
46790 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46791 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46792 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46793 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46794 mem_base = xmlMemBlocks();
46795 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46796 name = gen_const_xmlChar_ptr(n_name, 1);
46797 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46798 value = gen_xmlXPathObjectPtr(n_value, 3);
46799
William M. Brackf13f77f2004-11-12 16:03:48 +000046800 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046801 desret_int(ret_val);
46802 call_tests++;
46803 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046804 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
46805 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046806 des_xmlXPathObjectPtr(n_value, value, 3);
46807 xmlResetLastError();
46808 if (mem_base != xmlMemBlocks()) {
46809 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46810 xmlMemBlocks() - mem_base);
46811 test_ret++;
46812 printf(" %d", n_ctxt);
46813 printf(" %d", n_name);
46814 printf(" %d", n_ns_uri);
46815 printf(" %d", n_value);
46816 printf("\n");
46817 }
46818 }
46819 }
46820 }
46821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046822 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046823#endif
46824
Daniel Veillarda82b1822004-11-08 16:24:57 +000046825 return(test_ret);
46826}
46827
46828
46829static int
46830test_xmlXPathRegisteredFuncsCleanup(void) {
46831 int test_ret = 0;
46832
William M. Brack21e4ef22005-01-02 09:53:13 +000046833#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046834 int mem_base;
46835 xmlXPathContextPtr ctxt; /* the XPath context */
46836 int n_ctxt;
46837
46838 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46839 mem_base = xmlMemBlocks();
46840 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46841
46842 xmlXPathRegisteredFuncsCleanup(ctxt);
46843 call_tests++;
46844 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46845 xmlResetLastError();
46846 if (mem_base != xmlMemBlocks()) {
46847 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46848 xmlMemBlocks() - mem_base);
46849 test_ret++;
46850 printf(" %d", n_ctxt);
46851 printf("\n");
46852 }
46853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046854 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046855#endif
46856
Daniel Veillarda82b1822004-11-08 16:24:57 +000046857 return(test_ret);
46858}
46859
46860
46861static int
46862test_xmlXPathRegisteredNsCleanup(void) {
46863 int test_ret = 0;
46864
William M. Brack21e4ef22005-01-02 09:53:13 +000046865#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046866 int mem_base;
46867 xmlXPathContextPtr ctxt; /* the XPath context */
46868 int n_ctxt;
46869
46870 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46871 mem_base = xmlMemBlocks();
46872 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46873
46874 xmlXPathRegisteredNsCleanup(ctxt);
46875 call_tests++;
46876 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46877 xmlResetLastError();
46878 if (mem_base != xmlMemBlocks()) {
46879 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46880 xmlMemBlocks() - mem_base);
46881 test_ret++;
46882 printf(" %d", n_ctxt);
46883 printf("\n");
46884 }
46885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046886 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046887#endif
46888
Daniel Veillarda82b1822004-11-08 16:24:57 +000046889 return(test_ret);
46890}
46891
46892
46893static int
46894test_xmlXPathRegisteredVariablesCleanup(void) {
46895 int test_ret = 0;
46896
William M. Brack21e4ef22005-01-02 09:53:13 +000046897#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046898 int mem_base;
46899 xmlXPathContextPtr ctxt; /* the XPath context */
46900 int n_ctxt;
46901
46902 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46903 mem_base = xmlMemBlocks();
46904 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46905
46906 xmlXPathRegisteredVariablesCleanup(ctxt);
46907 call_tests++;
46908 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46909 xmlResetLastError();
46910 if (mem_base != xmlMemBlocks()) {
46911 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46912 xmlMemBlocks() - mem_base);
46913 test_ret++;
46914 printf(" %d", n_ctxt);
46915 printf("\n");
46916 }
46917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046918 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046919#endif
46920
Daniel Veillarda82b1822004-11-08 16:24:57 +000046921 return(test_ret);
46922}
46923
46924
46925static int
46926test_xmlXPathRoot(void) {
46927 int test_ret = 0;
46928
William M. Brack21e4ef22005-01-02 09:53:13 +000046929#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046930 int mem_base;
46931 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46932 int n_ctxt;
46933
46934 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46935 mem_base = xmlMemBlocks();
46936 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46937
46938 xmlXPathRoot(ctxt);
46939 call_tests++;
46940 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46941 xmlResetLastError();
46942 if (mem_base != xmlMemBlocks()) {
46943 printf("Leak of %d blocks found in xmlXPathRoot",
46944 xmlMemBlocks() - mem_base);
46945 test_ret++;
46946 printf(" %d", n_ctxt);
46947 printf("\n");
46948 }
46949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046950 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046951#endif
46952
Daniel Veillarda82b1822004-11-08 16:24:57 +000046953 return(test_ret);
46954}
46955
46956
46957static int
46958test_xmlXPathRoundFunction(void) {
46959 int test_ret = 0;
46960
William M. Brack21e4ef22005-01-02 09:53:13 +000046961#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046962 int mem_base;
46963 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46964 int n_ctxt;
46965 int nargs; /* the number of arguments */
46966 int n_nargs;
46967
46968 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46969 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46970 mem_base = xmlMemBlocks();
46971 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46972 nargs = gen_int(n_nargs, 1);
46973
46974 xmlXPathRoundFunction(ctxt, nargs);
46975 call_tests++;
46976 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46977 des_int(n_nargs, nargs, 1);
46978 xmlResetLastError();
46979 if (mem_base != xmlMemBlocks()) {
46980 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46981 xmlMemBlocks() - mem_base);
46982 test_ret++;
46983 printf(" %d", n_ctxt);
46984 printf(" %d", n_nargs);
46985 printf("\n");
46986 }
46987 }
46988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046989 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046990#endif
46991
Daniel Veillarda82b1822004-11-08 16:24:57 +000046992 return(test_ret);
46993}
46994
46995
46996static int
46997test_xmlXPathStartsWithFunction(void) {
46998 int test_ret = 0;
46999
William M. Brack21e4ef22005-01-02 09:53:13 +000047000#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047001 int mem_base;
47002 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47003 int n_ctxt;
47004 int nargs; /* the number of arguments */
47005 int n_nargs;
47006
47007 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47008 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47009 mem_base = xmlMemBlocks();
47010 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47011 nargs = gen_int(n_nargs, 1);
47012
47013 xmlXPathStartsWithFunction(ctxt, nargs);
47014 call_tests++;
47015 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47016 des_int(n_nargs, nargs, 1);
47017 xmlResetLastError();
47018 if (mem_base != xmlMemBlocks()) {
47019 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47020 xmlMemBlocks() - mem_base);
47021 test_ret++;
47022 printf(" %d", n_ctxt);
47023 printf(" %d", n_nargs);
47024 printf("\n");
47025 }
47026 }
47027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047028 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047029#endif
47030
Daniel Veillarda82b1822004-11-08 16:24:57 +000047031 return(test_ret);
47032}
47033
47034
47035static int
47036test_xmlXPathStringEvalNumber(void) {
47037 int test_ret = 0;
47038
William M. Brack21e4ef22005-01-02 09:53:13 +000047039#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047040 int mem_base;
47041 double ret_val;
47042 xmlChar * str; /* A string to scan */
47043 int n_str;
47044
47045 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47046 mem_base = xmlMemBlocks();
47047 str = gen_const_xmlChar_ptr(n_str, 0);
47048
William M. Brackf13f77f2004-11-12 16:03:48 +000047049 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047050 desret_double(ret_val);
47051 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047052 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047053 xmlResetLastError();
47054 if (mem_base != xmlMemBlocks()) {
47055 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47056 xmlMemBlocks() - mem_base);
47057 test_ret++;
47058 printf(" %d", n_str);
47059 printf("\n");
47060 }
47061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047062 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047063#endif
47064
Daniel Veillarda82b1822004-11-08 16:24:57 +000047065 return(test_ret);
47066}
47067
47068
47069static int
47070test_xmlXPathStringFunction(void) {
47071 int test_ret = 0;
47072
William M. Brack21e4ef22005-01-02 09:53:13 +000047073#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047074 int mem_base;
47075 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47076 int n_ctxt;
47077 int nargs; /* the number of arguments */
47078 int n_nargs;
47079
47080 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47081 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47082 mem_base = xmlMemBlocks();
47083 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47084 nargs = gen_int(n_nargs, 1);
47085
47086 xmlXPathStringFunction(ctxt, nargs);
47087 call_tests++;
47088 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47089 des_int(n_nargs, nargs, 1);
47090 xmlResetLastError();
47091 if (mem_base != xmlMemBlocks()) {
47092 printf("Leak of %d blocks found in xmlXPathStringFunction",
47093 xmlMemBlocks() - mem_base);
47094 test_ret++;
47095 printf(" %d", n_ctxt);
47096 printf(" %d", n_nargs);
47097 printf("\n");
47098 }
47099 }
47100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047101 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047102#endif
47103
Daniel Veillarda82b1822004-11-08 16:24:57 +000047104 return(test_ret);
47105}
47106
47107
47108static int
47109test_xmlXPathStringLengthFunction(void) {
47110 int test_ret = 0;
47111
William M. Brack21e4ef22005-01-02 09:53:13 +000047112#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047113 int mem_base;
47114 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47115 int n_ctxt;
47116 int nargs; /* the number of arguments */
47117 int n_nargs;
47118
47119 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47120 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47121 mem_base = xmlMemBlocks();
47122 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47123 nargs = gen_int(n_nargs, 1);
47124
47125 xmlXPathStringLengthFunction(ctxt, nargs);
47126 call_tests++;
47127 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47128 des_int(n_nargs, nargs, 1);
47129 xmlResetLastError();
47130 if (mem_base != xmlMemBlocks()) {
47131 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47132 xmlMemBlocks() - mem_base);
47133 test_ret++;
47134 printf(" %d", n_ctxt);
47135 printf(" %d", n_nargs);
47136 printf("\n");
47137 }
47138 }
47139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047140 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047141#endif
47142
Daniel Veillarda82b1822004-11-08 16:24:57 +000047143 return(test_ret);
47144}
47145
47146
47147static int
47148test_xmlXPathSubValues(void) {
47149 int test_ret = 0;
47150
William M. Brack21e4ef22005-01-02 09:53:13 +000047151#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047152 int mem_base;
47153 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47154 int n_ctxt;
47155
47156 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47157 mem_base = xmlMemBlocks();
47158 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47159
47160 xmlXPathSubValues(ctxt);
47161 call_tests++;
47162 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47163 xmlResetLastError();
47164 if (mem_base != xmlMemBlocks()) {
47165 printf("Leak of %d blocks found in xmlXPathSubValues",
47166 xmlMemBlocks() - mem_base);
47167 test_ret++;
47168 printf(" %d", n_ctxt);
47169 printf("\n");
47170 }
47171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047172 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047173#endif
47174
Daniel Veillarda82b1822004-11-08 16:24:57 +000047175 return(test_ret);
47176}
47177
47178
47179static int
47180test_xmlXPathSubstringAfterFunction(void) {
47181 int test_ret = 0;
47182
William M. Brack21e4ef22005-01-02 09:53:13 +000047183#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047184 int mem_base;
47185 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47186 int n_ctxt;
47187 int nargs; /* the number of arguments */
47188 int n_nargs;
47189
47190 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47191 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47192 mem_base = xmlMemBlocks();
47193 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47194 nargs = gen_int(n_nargs, 1);
47195
47196 xmlXPathSubstringAfterFunction(ctxt, nargs);
47197 call_tests++;
47198 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47199 des_int(n_nargs, nargs, 1);
47200 xmlResetLastError();
47201 if (mem_base != xmlMemBlocks()) {
47202 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47203 xmlMemBlocks() - mem_base);
47204 test_ret++;
47205 printf(" %d", n_ctxt);
47206 printf(" %d", n_nargs);
47207 printf("\n");
47208 }
47209 }
47210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047211 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047212#endif
47213
Daniel Veillarda82b1822004-11-08 16:24:57 +000047214 return(test_ret);
47215}
47216
47217
47218static int
47219test_xmlXPathSubstringBeforeFunction(void) {
47220 int test_ret = 0;
47221
William M. Brack21e4ef22005-01-02 09:53:13 +000047222#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047223 int mem_base;
47224 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47225 int n_ctxt;
47226 int nargs; /* the number of arguments */
47227 int n_nargs;
47228
47229 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47230 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47231 mem_base = xmlMemBlocks();
47232 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47233 nargs = gen_int(n_nargs, 1);
47234
47235 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47236 call_tests++;
47237 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47238 des_int(n_nargs, nargs, 1);
47239 xmlResetLastError();
47240 if (mem_base != xmlMemBlocks()) {
47241 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47242 xmlMemBlocks() - mem_base);
47243 test_ret++;
47244 printf(" %d", n_ctxt);
47245 printf(" %d", n_nargs);
47246 printf("\n");
47247 }
47248 }
47249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047250 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047251#endif
47252
Daniel Veillarda82b1822004-11-08 16:24:57 +000047253 return(test_ret);
47254}
47255
47256
47257static int
47258test_xmlXPathSubstringFunction(void) {
47259 int test_ret = 0;
47260
William M. Brack21e4ef22005-01-02 09:53:13 +000047261#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047262 int mem_base;
47263 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47264 int n_ctxt;
47265 int nargs; /* the number of arguments */
47266 int n_nargs;
47267
47268 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47269 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47270 mem_base = xmlMemBlocks();
47271 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47272 nargs = gen_int(n_nargs, 1);
47273
47274 xmlXPathSubstringFunction(ctxt, nargs);
47275 call_tests++;
47276 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47277 des_int(n_nargs, nargs, 1);
47278 xmlResetLastError();
47279 if (mem_base != xmlMemBlocks()) {
47280 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47281 xmlMemBlocks() - mem_base);
47282 test_ret++;
47283 printf(" %d", n_ctxt);
47284 printf(" %d", n_nargs);
47285 printf("\n");
47286 }
47287 }
47288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047289 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047290#endif
47291
Daniel Veillarda82b1822004-11-08 16:24:57 +000047292 return(test_ret);
47293}
47294
47295
47296static int
47297test_xmlXPathSumFunction(void) {
47298 int test_ret = 0;
47299
William M. Brack21e4ef22005-01-02 09:53:13 +000047300#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047301 int mem_base;
47302 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47303 int n_ctxt;
47304 int nargs; /* the number of arguments */
47305 int n_nargs;
47306
47307 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47308 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47309 mem_base = xmlMemBlocks();
47310 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47311 nargs = gen_int(n_nargs, 1);
47312
47313 xmlXPathSumFunction(ctxt, nargs);
47314 call_tests++;
47315 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47316 des_int(n_nargs, nargs, 1);
47317 xmlResetLastError();
47318 if (mem_base != xmlMemBlocks()) {
47319 printf("Leak of %d blocks found in xmlXPathSumFunction",
47320 xmlMemBlocks() - mem_base);
47321 test_ret++;
47322 printf(" %d", n_ctxt);
47323 printf(" %d", n_nargs);
47324 printf("\n");
47325 }
47326 }
47327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047328 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047329#endif
47330
Daniel Veillarda82b1822004-11-08 16:24:57 +000047331 return(test_ret);
47332}
47333
47334
47335static int
47336test_xmlXPathTrailing(void) {
47337 int test_ret = 0;
47338
William M. Brack21e4ef22005-01-02 09:53:13 +000047339#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047340 int mem_base;
47341 xmlNodeSetPtr ret_val;
47342 xmlNodeSetPtr nodes1; /* a node-set */
47343 int n_nodes1;
47344 xmlNodeSetPtr nodes2; /* a node-set */
47345 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047346
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047347 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47348 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47349 mem_base = xmlMemBlocks();
47350 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47351 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47352
47353 ret_val = xmlXPathTrailing(nodes1, nodes2);
47354 desret_xmlNodeSetPtr(ret_val);
47355 call_tests++;
47356 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47357 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47358 xmlResetLastError();
47359 if (mem_base != xmlMemBlocks()) {
47360 printf("Leak of %d blocks found in xmlXPathTrailing",
47361 xmlMemBlocks() - mem_base);
47362 test_ret++;
47363 printf(" %d", n_nodes1);
47364 printf(" %d", n_nodes2);
47365 printf("\n");
47366 }
47367 }
47368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047369 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047370#endif
47371
Daniel Veillarda82b1822004-11-08 16:24:57 +000047372 return(test_ret);
47373}
47374
47375
47376static int
47377test_xmlXPathTrailingSorted(void) {
47378 int test_ret = 0;
47379
William M. Brack21e4ef22005-01-02 09:53:13 +000047380#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047381 int mem_base;
47382 xmlNodeSetPtr ret_val;
47383 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47384 int n_nodes1;
47385 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47386 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047387
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047388 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47389 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47390 mem_base = xmlMemBlocks();
47391 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47392 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47393
47394 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47395 desret_xmlNodeSetPtr(ret_val);
47396 call_tests++;
47397 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47398 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47399 xmlResetLastError();
47400 if (mem_base != xmlMemBlocks()) {
47401 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47402 xmlMemBlocks() - mem_base);
47403 test_ret++;
47404 printf(" %d", n_nodes1);
47405 printf(" %d", n_nodes2);
47406 printf("\n");
47407 }
47408 }
47409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047410 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047411#endif
47412
Daniel Veillarda82b1822004-11-08 16:24:57 +000047413 return(test_ret);
47414}
47415
47416
47417static int
47418test_xmlXPathTranslateFunction(void) {
47419 int test_ret = 0;
47420
William M. Brack21e4ef22005-01-02 09:53:13 +000047421#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047422 int mem_base;
47423 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47424 int n_ctxt;
47425 int nargs; /* the number of arguments */
47426 int n_nargs;
47427
47428 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47429 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47430 mem_base = xmlMemBlocks();
47431 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47432 nargs = gen_int(n_nargs, 1);
47433
47434 xmlXPathTranslateFunction(ctxt, nargs);
47435 call_tests++;
47436 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47437 des_int(n_nargs, nargs, 1);
47438 xmlResetLastError();
47439 if (mem_base != xmlMemBlocks()) {
47440 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47441 xmlMemBlocks() - mem_base);
47442 test_ret++;
47443 printf(" %d", n_ctxt);
47444 printf(" %d", n_nargs);
47445 printf("\n");
47446 }
47447 }
47448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047449 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047450#endif
47451
Daniel Veillarda82b1822004-11-08 16:24:57 +000047452 return(test_ret);
47453}
47454
47455
47456static int
47457test_xmlXPathTrueFunction(void) {
47458 int test_ret = 0;
47459
William M. Brack21e4ef22005-01-02 09:53:13 +000047460#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047461 int mem_base;
47462 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47463 int n_ctxt;
47464 int nargs; /* the number of arguments */
47465 int n_nargs;
47466
47467 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47468 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47469 mem_base = xmlMemBlocks();
47470 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47471 nargs = gen_int(n_nargs, 1);
47472
47473 xmlXPathTrueFunction(ctxt, nargs);
47474 call_tests++;
47475 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47476 des_int(n_nargs, nargs, 1);
47477 xmlResetLastError();
47478 if (mem_base != xmlMemBlocks()) {
47479 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47480 xmlMemBlocks() - mem_base);
47481 test_ret++;
47482 printf(" %d", n_ctxt);
47483 printf(" %d", n_nargs);
47484 printf("\n");
47485 }
47486 }
47487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047488 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047489#endif
47490
Daniel Veillarda82b1822004-11-08 16:24:57 +000047491 return(test_ret);
47492}
47493
47494
47495static int
47496test_xmlXPathValueFlipSign(void) {
47497 int test_ret = 0;
47498
William M. Brack21e4ef22005-01-02 09:53:13 +000047499#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047500 int mem_base;
47501 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47502 int n_ctxt;
47503
47504 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47505 mem_base = xmlMemBlocks();
47506 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47507
47508 xmlXPathValueFlipSign(ctxt);
47509 call_tests++;
47510 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47511 xmlResetLastError();
47512 if (mem_base != xmlMemBlocks()) {
47513 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47514 xmlMemBlocks() - mem_base);
47515 test_ret++;
47516 printf(" %d", n_ctxt);
47517 printf("\n");
47518 }
47519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047520 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047521#endif
47522
Daniel Veillarda82b1822004-11-08 16:24:57 +000047523 return(test_ret);
47524}
47525
47526
47527static int
47528test_xmlXPathVariableLookup(void) {
47529 int test_ret = 0;
47530
William M. Brack21e4ef22005-01-02 09:53:13 +000047531#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047532 int mem_base;
47533 xmlXPathObjectPtr ret_val;
47534 xmlXPathContextPtr ctxt; /* the XPath context */
47535 int n_ctxt;
47536 xmlChar * name; /* the variable name */
47537 int n_name;
47538
47539 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47540 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47541 mem_base = xmlMemBlocks();
47542 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47543 name = gen_const_xmlChar_ptr(n_name, 1);
47544
William M. Brackf13f77f2004-11-12 16:03:48 +000047545 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047546 desret_xmlXPathObjectPtr(ret_val);
47547 call_tests++;
47548 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047549 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047550 xmlResetLastError();
47551 if (mem_base != xmlMemBlocks()) {
47552 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47553 xmlMemBlocks() - mem_base);
47554 test_ret++;
47555 printf(" %d", n_ctxt);
47556 printf(" %d", n_name);
47557 printf("\n");
47558 }
47559 }
47560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047561 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047562#endif
47563
Daniel Veillarda82b1822004-11-08 16:24:57 +000047564 return(test_ret);
47565}
47566
47567
47568static int
47569test_xmlXPathVariableLookupNS(void) {
47570 int test_ret = 0;
47571
William M. Brack21e4ef22005-01-02 09:53:13 +000047572#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047573 int mem_base;
47574 xmlXPathObjectPtr ret_val;
47575 xmlXPathContextPtr ctxt; /* the XPath context */
47576 int n_ctxt;
47577 xmlChar * name; /* the variable name */
47578 int n_name;
47579 xmlChar * ns_uri; /* the variable namespace URI */
47580 int n_ns_uri;
47581
47582 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47583 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47584 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47585 mem_base = xmlMemBlocks();
47586 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47587 name = gen_const_xmlChar_ptr(n_name, 1);
47588 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47589
William M. Brackf13f77f2004-11-12 16:03:48 +000047590 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047591 desret_xmlXPathObjectPtr(ret_val);
47592 call_tests++;
47593 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047594 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47595 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047596 xmlResetLastError();
47597 if (mem_base != xmlMemBlocks()) {
47598 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47599 xmlMemBlocks() - mem_base);
47600 test_ret++;
47601 printf(" %d", n_ctxt);
47602 printf(" %d", n_name);
47603 printf(" %d", n_ns_uri);
47604 printf("\n");
47605 }
47606 }
47607 }
47608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047609 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047610#endif
47611
Daniel Veillarda82b1822004-11-08 16:24:57 +000047612 return(test_ret);
47613}
47614
47615
47616static int
47617test_xmlXPathWrapCString(void) {
47618 int test_ret = 0;
47619
William M. Brack21e4ef22005-01-02 09:53:13 +000047620#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047621 int mem_base;
47622 xmlXPathObjectPtr ret_val;
47623 char * val; /* the char * value */
47624 int n_val;
47625
47626 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47627 mem_base = xmlMemBlocks();
47628 val = gen_char_ptr(n_val, 0);
47629
47630 ret_val = xmlXPathWrapCString(val);
47631 desret_xmlXPathObjectPtr(ret_val);
47632 call_tests++;
47633 des_char_ptr(n_val, val, 0);
47634 xmlResetLastError();
47635 if (mem_base != xmlMemBlocks()) {
47636 printf("Leak of %d blocks found in xmlXPathWrapCString",
47637 xmlMemBlocks() - mem_base);
47638 test_ret++;
47639 printf(" %d", n_val);
47640 printf("\n");
47641 }
47642 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047643 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047644#endif
47645
Daniel Veillarda82b1822004-11-08 16:24:57 +000047646 return(test_ret);
47647}
47648
47649
47650static int
47651test_xmlXPathWrapExternal(void) {
47652 int test_ret = 0;
47653
William M. Brack21e4ef22005-01-02 09:53:13 +000047654#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047655 int mem_base;
47656 xmlXPathObjectPtr ret_val;
47657 void * val; /* the user data */
47658 int n_val;
47659
47660 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47661 mem_base = xmlMemBlocks();
47662 val = gen_void_ptr(n_val, 0);
47663
47664 ret_val = xmlXPathWrapExternal(val);
47665 desret_xmlXPathObjectPtr(ret_val);
47666 call_tests++;
47667 des_void_ptr(n_val, val, 0);
47668 xmlResetLastError();
47669 if (mem_base != xmlMemBlocks()) {
47670 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47671 xmlMemBlocks() - mem_base);
47672 test_ret++;
47673 printf(" %d", n_val);
47674 printf("\n");
47675 }
47676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047677 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047678#endif
47679
Daniel Veillarda82b1822004-11-08 16:24:57 +000047680 return(test_ret);
47681}
47682
47683
47684static int
47685test_xmlXPathWrapNodeSet(void) {
47686 int test_ret = 0;
47687
William M. Brack21e4ef22005-01-02 09:53:13 +000047688#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047689 int mem_base;
47690 xmlXPathObjectPtr ret_val;
47691 xmlNodeSetPtr val; /* the NodePtr value */
47692 int n_val;
47693
47694 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47695 mem_base = xmlMemBlocks();
47696 val = gen_xmlNodeSetPtr(n_val, 0);
47697
47698 ret_val = xmlXPathWrapNodeSet(val);
47699 desret_xmlXPathObjectPtr(ret_val);
47700 call_tests++;
47701 des_xmlNodeSetPtr(n_val, val, 0);
47702 xmlResetLastError();
47703 if (mem_base != xmlMemBlocks()) {
47704 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47705 xmlMemBlocks() - mem_base);
47706 test_ret++;
47707 printf(" %d", n_val);
47708 printf("\n");
47709 }
47710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047711 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047712#endif
47713
Daniel Veillarda82b1822004-11-08 16:24:57 +000047714 return(test_ret);
47715}
47716
47717
47718static int
47719test_xmlXPatherror(void) {
47720 int test_ret = 0;
47721
William M. Brack21e4ef22005-01-02 09:53:13 +000047722#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047723 int mem_base;
47724 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47725 int n_ctxt;
47726 const char * file; /* the file name */
47727 int n_file;
47728 int line; /* the line number */
47729 int n_line;
47730 int no; /* the error number */
47731 int n_no;
47732
47733 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47734 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47735 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47736 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47737 mem_base = xmlMemBlocks();
47738 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47739 file = gen_filepath(n_file, 1);
47740 line = gen_int(n_line, 2);
47741 no = gen_int(n_no, 3);
47742
47743 xmlXPatherror(ctxt, file, line, no);
47744 call_tests++;
47745 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47746 des_filepath(n_file, file, 1);
47747 des_int(n_line, line, 2);
47748 des_int(n_no, no, 3);
47749 xmlResetLastError();
47750 if (mem_base != xmlMemBlocks()) {
47751 printf("Leak of %d blocks found in xmlXPatherror",
47752 xmlMemBlocks() - mem_base);
47753 test_ret++;
47754 printf(" %d", n_ctxt);
47755 printf(" %d", n_file);
47756 printf(" %d", n_line);
47757 printf(" %d", n_no);
47758 printf("\n");
47759 }
47760 }
47761 }
47762 }
47763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047764 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047765#endif
47766
Daniel Veillarda82b1822004-11-08 16:24:57 +000047767 return(test_ret);
47768}
47769
47770static int
47771test_xpathInternals(void) {
47772 int test_ret = 0;
47773
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047774 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047775 test_ret += test_valuePop();
47776 test_ret += test_valuePush();
47777 test_ret += test_xmlXPathAddValues();
47778 test_ret += test_xmlXPathBooleanFunction();
47779 test_ret += test_xmlXPathCeilingFunction();
47780 test_ret += test_xmlXPathCompareValues();
47781 test_ret += test_xmlXPathConcatFunction();
47782 test_ret += test_xmlXPathContainsFunction();
47783 test_ret += test_xmlXPathCountFunction();
47784 test_ret += test_xmlXPathDebugDumpCompExpr();
47785 test_ret += test_xmlXPathDebugDumpObject();
47786 test_ret += test_xmlXPathDifference();
47787 test_ret += test_xmlXPathDistinct();
47788 test_ret += test_xmlXPathDistinctSorted();
47789 test_ret += test_xmlXPathDivValues();
47790 test_ret += test_xmlXPathEqualValues();
47791 test_ret += test_xmlXPathErr();
47792 test_ret += test_xmlXPathEvalExpr();
47793 test_ret += test_xmlXPathEvaluatePredicateResult();
47794 test_ret += test_xmlXPathFalseFunction();
47795 test_ret += test_xmlXPathFloorFunction();
47796 test_ret += test_xmlXPathFunctionLookup();
47797 test_ret += test_xmlXPathFunctionLookupNS();
47798 test_ret += test_xmlXPathHasSameNodes();
47799 test_ret += test_xmlXPathIdFunction();
47800 test_ret += test_xmlXPathIntersection();
47801 test_ret += test_xmlXPathIsNodeType();
47802 test_ret += test_xmlXPathLangFunction();
47803 test_ret += test_xmlXPathLastFunction();
47804 test_ret += test_xmlXPathLeading();
47805 test_ret += test_xmlXPathLeadingSorted();
47806 test_ret += test_xmlXPathLocalNameFunction();
47807 test_ret += test_xmlXPathModValues();
47808 test_ret += test_xmlXPathMultValues();
47809 test_ret += test_xmlXPathNamespaceURIFunction();
47810 test_ret += test_xmlXPathNewBoolean();
47811 test_ret += test_xmlXPathNewCString();
47812 test_ret += test_xmlXPathNewFloat();
47813 test_ret += test_xmlXPathNewNodeSet();
47814 test_ret += test_xmlXPathNewNodeSetList();
47815 test_ret += test_xmlXPathNewParserContext();
47816 test_ret += test_xmlXPathNewString();
47817 test_ret += test_xmlXPathNextAncestor();
47818 test_ret += test_xmlXPathNextAncestorOrSelf();
47819 test_ret += test_xmlXPathNextAttribute();
47820 test_ret += test_xmlXPathNextChild();
47821 test_ret += test_xmlXPathNextDescendant();
47822 test_ret += test_xmlXPathNextDescendantOrSelf();
47823 test_ret += test_xmlXPathNextFollowing();
47824 test_ret += test_xmlXPathNextFollowingSibling();
47825 test_ret += test_xmlXPathNextNamespace();
47826 test_ret += test_xmlXPathNextParent();
47827 test_ret += test_xmlXPathNextPreceding();
47828 test_ret += test_xmlXPathNextPrecedingSibling();
47829 test_ret += test_xmlXPathNextSelf();
47830 test_ret += test_xmlXPathNodeLeading();
47831 test_ret += test_xmlXPathNodeLeadingSorted();
47832 test_ret += test_xmlXPathNodeSetAdd();
47833 test_ret += test_xmlXPathNodeSetAddNs();
47834 test_ret += test_xmlXPathNodeSetAddUnique();
47835 test_ret += test_xmlXPathNodeSetContains();
47836 test_ret += test_xmlXPathNodeSetDel();
47837 test_ret += test_xmlXPathNodeSetMerge();
47838 test_ret += test_xmlXPathNodeSetRemove();
47839 test_ret += test_xmlXPathNodeSetSort();
47840 test_ret += test_xmlXPathNodeTrailing();
47841 test_ret += test_xmlXPathNodeTrailingSorted();
47842 test_ret += test_xmlXPathNormalizeFunction();
47843 test_ret += test_xmlXPathNotEqualValues();
47844 test_ret += test_xmlXPathNotFunction();
47845 test_ret += test_xmlXPathNsLookup();
47846 test_ret += test_xmlXPathNumberFunction();
47847 test_ret += test_xmlXPathParseNCName();
47848 test_ret += test_xmlXPathParseName();
47849 test_ret += test_xmlXPathPopBoolean();
47850 test_ret += test_xmlXPathPopExternal();
47851 test_ret += test_xmlXPathPopNodeSet();
47852 test_ret += test_xmlXPathPopNumber();
47853 test_ret += test_xmlXPathPopString();
47854 test_ret += test_xmlXPathPositionFunction();
47855 test_ret += test_xmlXPathRegisterAllFunctions();
47856 test_ret += test_xmlXPathRegisterFunc();
47857 test_ret += test_xmlXPathRegisterFuncLookup();
47858 test_ret += test_xmlXPathRegisterFuncNS();
47859 test_ret += test_xmlXPathRegisterNs();
47860 test_ret += test_xmlXPathRegisterVariable();
47861 test_ret += test_xmlXPathRegisterVariableLookup();
47862 test_ret += test_xmlXPathRegisterVariableNS();
47863 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47864 test_ret += test_xmlXPathRegisteredNsCleanup();
47865 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47866 test_ret += test_xmlXPathRoot();
47867 test_ret += test_xmlXPathRoundFunction();
47868 test_ret += test_xmlXPathStartsWithFunction();
47869 test_ret += test_xmlXPathStringEvalNumber();
47870 test_ret += test_xmlXPathStringFunction();
47871 test_ret += test_xmlXPathStringLengthFunction();
47872 test_ret += test_xmlXPathSubValues();
47873 test_ret += test_xmlXPathSubstringAfterFunction();
47874 test_ret += test_xmlXPathSubstringBeforeFunction();
47875 test_ret += test_xmlXPathSubstringFunction();
47876 test_ret += test_xmlXPathSumFunction();
47877 test_ret += test_xmlXPathTrailing();
47878 test_ret += test_xmlXPathTrailingSorted();
47879 test_ret += test_xmlXPathTranslateFunction();
47880 test_ret += test_xmlXPathTrueFunction();
47881 test_ret += test_xmlXPathValueFlipSign();
47882 test_ret += test_xmlXPathVariableLookup();
47883 test_ret += test_xmlXPathVariableLookupNS();
47884 test_ret += test_xmlXPathWrapCString();
47885 test_ret += test_xmlXPathWrapExternal();
47886 test_ret += test_xmlXPathWrapNodeSet();
47887 test_ret += test_xmlXPatherror();
47888
47889 if (test_ret != 0)
47890 printf("Module xpathInternals: %d errors\n", test_ret);
47891 return(test_ret);
47892}
47893
Daniel Veillardd93f6252004-11-02 15:53:51 +000047894static int
47895test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047897
William M. Brack21e4ef22005-01-02 09:53:13 +000047898#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047899 int mem_base;
47900 xmlNodePtr ret_val;
47901 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47902 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047903
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047904 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47905 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047906 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047907
47908 ret_val = xmlXPtrBuildNodeList(obj);
47909 desret_xmlNodePtr(ret_val);
47910 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047911 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047912 xmlResetLastError();
47913 if (mem_base != xmlMemBlocks()) {
47914 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047916 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047917 printf(" %d", n_obj);
47918 printf("\n");
47919 }
47920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047921 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047922#endif
47923
Daniel Veillard42595322004-11-08 10:52:06 +000047924 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047925}
47926
47927
47928static int
47929test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047930 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047931
William M. Brack21e4ef22005-01-02 09:53:13 +000047932#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047933 int mem_base;
47934 xmlXPathObjectPtr ret_val;
47935 xmlChar * str; /* the XPointer expression */
47936 int n_str;
47937 xmlXPathContextPtr ctx; /* the XPointer context */
47938 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047939
Daniel Veillardce682bc2004-11-05 17:22:25 +000047940 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47941 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47942 mem_base = xmlMemBlocks();
47943 str = gen_const_xmlChar_ptr(n_str, 0);
47944 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47945
William M. Brackf13f77f2004-11-12 16:03:48 +000047946 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047947 desret_xmlXPathObjectPtr(ret_val);
47948 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047949 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047950 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47951 xmlResetLastError();
47952 if (mem_base != xmlMemBlocks()) {
47953 printf("Leak of %d blocks found in xmlXPtrEval",
47954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047955 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047956 printf(" %d", n_str);
47957 printf(" %d", n_ctx);
47958 printf("\n");
47959 }
47960 }
47961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047962 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047963#endif
47964
Daniel Veillard42595322004-11-08 10:52:06 +000047965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047966}
47967
47968
47969static int
47970test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047972
William M. Brack21e4ef22005-01-02 09:53:13 +000047973#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047974 int mem_base;
47975 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47976 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047977
Daniel Veillardce682bc2004-11-05 17:22:25 +000047978 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47979 mem_base = xmlMemBlocks();
47980 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47981
47982 xmlXPtrEvalRangePredicate(ctxt);
47983 call_tests++;
47984 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47985 xmlResetLastError();
47986 if (mem_base != xmlMemBlocks()) {
47987 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047989 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047990 printf(" %d", n_ctxt);
47991 printf("\n");
47992 }
47993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047994 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047995#endif
47996
Daniel Veillard42595322004-11-08 10:52:06 +000047997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047998}
47999
Daniel Veillarda521d282004-11-09 14:59:59 +000048000#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048001
Daniel Veillardce682bc2004-11-05 17:22:25 +000048002#define gen_nb_xmlLocationSetPtr 1
48003static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48004 return(NULL);
48005}
48006static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48007}
Daniel Veillarda521d282004-11-09 14:59:59 +000048008#endif
48009
Daniel Veillardce682bc2004-11-05 17:22:25 +000048010
Daniel Veillardd93f6252004-11-02 15:53:51 +000048011static int
48012test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048013 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048014
William M. Brack21e4ef22005-01-02 09:53:13 +000048015#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048016 int mem_base;
48017 xmlLocationSetPtr cur; /* the initial range set */
48018 int n_cur;
48019 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48020 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048021
Daniel Veillardce682bc2004-11-05 17:22:25 +000048022 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48023 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48024 mem_base = xmlMemBlocks();
48025 cur = gen_xmlLocationSetPtr(n_cur, 0);
48026 val = gen_xmlXPathObjectPtr(n_val, 1);
48027
48028 xmlXPtrLocationSetAdd(cur, val);
48029 call_tests++;
48030 des_xmlLocationSetPtr(n_cur, cur, 0);
48031 des_xmlXPathObjectPtr(n_val, val, 1);
48032 xmlResetLastError();
48033 if (mem_base != xmlMemBlocks()) {
48034 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
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_cur);
48038 printf(" %d", n_val);
48039 printf("\n");
48040 }
48041 }
48042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048043 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048044#endif
48045
Daniel Veillard42595322004-11-08 10:52:06 +000048046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048047}
48048
48049
48050static int
48051test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048052 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048053
48054
48055 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048057}
48058
48059
48060static int
48061test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048063
William M. Brack21e4ef22005-01-02 09:53:13 +000048064#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048065 int mem_base;
48066 xmlLocationSetPtr cur; /* the initial range set */
48067 int n_cur;
48068 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48069 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048070
Daniel Veillardce682bc2004-11-05 17:22:25 +000048071 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48072 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48073 mem_base = xmlMemBlocks();
48074 cur = gen_xmlLocationSetPtr(n_cur, 0);
48075 val = gen_xmlXPathObjectPtr(n_val, 1);
48076
48077 xmlXPtrLocationSetDel(cur, val);
48078 call_tests++;
48079 des_xmlLocationSetPtr(n_cur, cur, 0);
48080 des_xmlXPathObjectPtr(n_val, val, 1);
48081 xmlResetLastError();
48082 if (mem_base != xmlMemBlocks()) {
48083 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048085 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048086 printf(" %d", n_cur);
48087 printf(" %d", n_val);
48088 printf("\n");
48089 }
48090 }
48091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048092 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048093#endif
48094
Daniel Veillard42595322004-11-08 10:52:06 +000048095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048096}
48097
48098
48099static int
48100test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048102
48103
48104 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048106}
48107
48108
48109static int
48110test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048112
William M. Brack21e4ef22005-01-02 09:53:13 +000048113#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048114 int mem_base;
48115 xmlLocationSetPtr cur; /* the initial range set */
48116 int n_cur;
48117 int val; /* the index to remove */
48118 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048119
Daniel Veillardce682bc2004-11-05 17:22:25 +000048120 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48121 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48122 mem_base = xmlMemBlocks();
48123 cur = gen_xmlLocationSetPtr(n_cur, 0);
48124 val = gen_int(n_val, 1);
48125
48126 xmlXPtrLocationSetRemove(cur, val);
48127 call_tests++;
48128 des_xmlLocationSetPtr(n_cur, cur, 0);
48129 des_int(n_val, val, 1);
48130 xmlResetLastError();
48131 if (mem_base != xmlMemBlocks()) {
48132 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048134 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048135 printf(" %d", n_cur);
48136 printf(" %d", n_val);
48137 printf("\n");
48138 }
48139 }
48140 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048141 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048142#endif
48143
Daniel Veillard42595322004-11-08 10:52:06 +000048144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048145}
48146
48147
48148static int
48149test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048151
William M. Brack21e4ef22005-01-02 09:53:13 +000048152#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048153 int mem_base;
48154 xmlXPathObjectPtr ret_val;
48155 xmlNodePtr start; /* the starting and ending node */
48156 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048157
Daniel Veillard3d97e662004-11-04 10:49:00 +000048158 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48159 mem_base = xmlMemBlocks();
48160 start = gen_xmlNodePtr(n_start, 0);
48161
48162 ret_val = xmlXPtrNewCollapsedRange(start);
48163 desret_xmlXPathObjectPtr(ret_val);
48164 call_tests++;
48165 des_xmlNodePtr(n_start, start, 0);
48166 xmlResetLastError();
48167 if (mem_base != xmlMemBlocks()) {
48168 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048170 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048171 printf(" %d", n_start);
48172 printf("\n");
48173 }
48174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048175 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048176#endif
48177
Daniel Veillard42595322004-11-08 10:52:06 +000048178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048179}
48180
48181
48182static int
48183test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048185
48186
48187 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048189}
48190
48191
48192static int
48193test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048195
William M. Brack21e4ef22005-01-02 09:53:13 +000048196#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048197 int mem_base;
48198 xmlXPathObjectPtr ret_val;
48199 xmlNodeSetPtr set; /* a node set */
48200 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048201
Daniel Veillardce682bc2004-11-05 17:22:25 +000048202 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48203 mem_base = xmlMemBlocks();
48204 set = gen_xmlNodeSetPtr(n_set, 0);
48205
48206 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48207 desret_xmlXPathObjectPtr(ret_val);
48208 call_tests++;
48209 des_xmlNodeSetPtr(n_set, set, 0);
48210 xmlResetLastError();
48211 if (mem_base != xmlMemBlocks()) {
48212 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048214 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048215 printf(" %d", n_set);
48216 printf("\n");
48217 }
48218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048219 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +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_xmlXPtrNewLocationSetNodes(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 start NodePtr value */
48234 int n_start;
48235 xmlNodePtr end; /* the end NodePtr value or NULL */
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 = xmlXPtrNewLocationSetNodes(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 xmlXPtrNewLocationSetNodes",
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_xmlXPtrNewRange(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 xmlNodePtr start; /* the starting node */
48275 int n_start;
48276 int startindex; /* the start index */
48277 int n_startindex;
48278 xmlNodePtr end; /* the ending point */
48279 int n_end;
48280 int endindex; /* the ending index */
48281 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048282
Daniel Veillard3d97e662004-11-04 10:49:00 +000048283 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48284 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48285 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48286 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48287 mem_base = xmlMemBlocks();
48288 start = gen_xmlNodePtr(n_start, 0);
48289 startindex = gen_int(n_startindex, 1);
48290 end = gen_xmlNodePtr(n_end, 2);
48291 endindex = gen_int(n_endindex, 3);
48292
48293 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48294 desret_xmlXPathObjectPtr(ret_val);
48295 call_tests++;
48296 des_xmlNodePtr(n_start, start, 0);
48297 des_int(n_startindex, startindex, 1);
48298 des_xmlNodePtr(n_end, end, 2);
48299 des_int(n_endindex, endindex, 3);
48300 xmlResetLastError();
48301 if (mem_base != xmlMemBlocks()) {
48302 printf("Leak of %d blocks found in xmlXPtrNewRange",
48303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048304 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048305 printf(" %d", n_start);
48306 printf(" %d", n_startindex);
48307 printf(" %d", n_end);
48308 printf(" %d", n_endindex);
48309 printf("\n");
48310 }
48311 }
48312 }
48313 }
48314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048315 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048316#endif
48317
Daniel Veillard42595322004-11-08 10:52:06 +000048318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048319}
48320
48321
48322static int
48323test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048325
William M. Brack21e4ef22005-01-02 09:53:13 +000048326#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048327 int mem_base;
48328 xmlXPathObjectPtr ret_val;
48329 xmlNodePtr start; /* the starting node */
48330 int n_start;
48331 xmlXPathObjectPtr end; /* the ending object */
48332 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048333
Daniel Veillard3d97e662004-11-04 10:49:00 +000048334 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48335 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48336 mem_base = xmlMemBlocks();
48337 start = gen_xmlNodePtr(n_start, 0);
48338 end = gen_xmlXPathObjectPtr(n_end, 1);
48339
48340 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48341 desret_xmlXPathObjectPtr(ret_val);
48342 call_tests++;
48343 des_xmlNodePtr(n_start, start, 0);
48344 des_xmlXPathObjectPtr(n_end, end, 1);
48345 xmlResetLastError();
48346 if (mem_base != xmlMemBlocks()) {
48347 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048349 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048350 printf(" %d", n_start);
48351 printf(" %d", n_end);
48352 printf("\n");
48353 }
48354 }
48355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048356 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048357#endif
48358
Daniel Veillard42595322004-11-08 10:52:06 +000048359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048360}
48361
48362
48363static int
48364test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048366
William M. Brack21e4ef22005-01-02 09:53:13 +000048367#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048368 int mem_base;
48369 xmlXPathObjectPtr ret_val;
48370 xmlNodePtr start; /* the starting node */
48371 int n_start;
48372 xmlXPathObjectPtr end; /* the ending point */
48373 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048374
Daniel Veillard3d97e662004-11-04 10:49:00 +000048375 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48376 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48377 mem_base = xmlMemBlocks();
48378 start = gen_xmlNodePtr(n_start, 0);
48379 end = gen_xmlXPathObjectPtr(n_end, 1);
48380
48381 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48382 desret_xmlXPathObjectPtr(ret_val);
48383 call_tests++;
48384 des_xmlNodePtr(n_start, start, 0);
48385 des_xmlXPathObjectPtr(n_end, end, 1);
48386 xmlResetLastError();
48387 if (mem_base != xmlMemBlocks()) {
48388 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048390 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048391 printf(" %d", n_start);
48392 printf(" %d", n_end);
48393 printf("\n");
48394 }
48395 }
48396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048397 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048398#endif
48399
Daniel Veillard42595322004-11-08 10:52:06 +000048400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048401}
48402
48403
48404static int
48405test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048407
William M. Brack21e4ef22005-01-02 09:53:13 +000048408#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048409 int mem_base;
48410 xmlXPathObjectPtr ret_val;
48411 xmlNodePtr start; /* the starting node */
48412 int n_start;
48413 xmlNodePtr end; /* the ending node */
48414 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048415
Daniel Veillard3d97e662004-11-04 10:49:00 +000048416 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48417 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48418 mem_base = xmlMemBlocks();
48419 start = gen_xmlNodePtr(n_start, 0);
48420 end = gen_xmlNodePtr(n_end, 1);
48421
48422 ret_val = xmlXPtrNewRangeNodes(start, end);
48423 desret_xmlXPathObjectPtr(ret_val);
48424 call_tests++;
48425 des_xmlNodePtr(n_start, start, 0);
48426 des_xmlNodePtr(n_end, end, 1);
48427 xmlResetLastError();
48428 if (mem_base != xmlMemBlocks()) {
48429 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048431 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048432 printf(" %d", n_start);
48433 printf(" %d", n_end);
48434 printf("\n");
48435 }
48436 }
48437 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048438 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048439#endif
48440
Daniel Veillard42595322004-11-08 10:52:06 +000048441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048442}
48443
48444
48445static int
48446test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048448
William M. Brack21e4ef22005-01-02 09:53:13 +000048449#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048450 int mem_base;
48451 xmlXPathObjectPtr ret_val;
48452 xmlXPathObjectPtr start; /* the starting point */
48453 int n_start;
48454 xmlNodePtr end; /* the ending node */
48455 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048456
Daniel Veillard3d97e662004-11-04 10:49:00 +000048457 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48458 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48459 mem_base = xmlMemBlocks();
48460 start = gen_xmlXPathObjectPtr(n_start, 0);
48461 end = gen_xmlNodePtr(n_end, 1);
48462
48463 ret_val = xmlXPtrNewRangePointNode(start, end);
48464 desret_xmlXPathObjectPtr(ret_val);
48465 call_tests++;
48466 des_xmlXPathObjectPtr(n_start, start, 0);
48467 des_xmlNodePtr(n_end, end, 1);
48468 xmlResetLastError();
48469 if (mem_base != xmlMemBlocks()) {
48470 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048472 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048473 printf(" %d", n_start);
48474 printf(" %d", n_end);
48475 printf("\n");
48476 }
48477 }
48478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048479 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048480#endif
48481
Daniel Veillard42595322004-11-08 10:52:06 +000048482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048483}
48484
48485
48486static int
48487test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048489
William M. Brack21e4ef22005-01-02 09:53:13 +000048490#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048491 int mem_base;
48492 xmlXPathObjectPtr ret_val;
48493 xmlXPathObjectPtr start; /* the starting point */
48494 int n_start;
48495 xmlXPathObjectPtr end; /* the ending point */
48496 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048497
Daniel Veillard3d97e662004-11-04 10:49:00 +000048498 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48499 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48500 mem_base = xmlMemBlocks();
48501 start = gen_xmlXPathObjectPtr(n_start, 0);
48502 end = gen_xmlXPathObjectPtr(n_end, 1);
48503
48504 ret_val = xmlXPtrNewRangePoints(start, end);
48505 desret_xmlXPathObjectPtr(ret_val);
48506 call_tests++;
48507 des_xmlXPathObjectPtr(n_start, start, 0);
48508 des_xmlXPathObjectPtr(n_end, end, 1);
48509 xmlResetLastError();
48510 if (mem_base != xmlMemBlocks()) {
48511 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048513 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048514 printf(" %d", n_start);
48515 printf(" %d", n_end);
48516 printf("\n");
48517 }
48518 }
48519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048520 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048521#endif
48522
Daniel Veillard42595322004-11-08 10:52:06 +000048523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048524}
48525
48526
48527static int
48528test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048530
William M. Brack21e4ef22005-01-02 09:53:13 +000048531#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048532 int mem_base;
48533 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48534 int n_ctxt;
48535 int nargs; /* the number of args */
48536 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048537
Daniel Veillardce682bc2004-11-05 17:22:25 +000048538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48539 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48540 mem_base = xmlMemBlocks();
48541 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48542 nargs = gen_int(n_nargs, 1);
48543
48544 xmlXPtrRangeToFunction(ctxt, nargs);
48545 call_tests++;
48546 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48547 des_int(n_nargs, nargs, 1);
48548 xmlResetLastError();
48549 if (mem_base != xmlMemBlocks()) {
48550 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048552 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048553 printf(" %d", n_ctxt);
48554 printf(" %d", n_nargs);
48555 printf("\n");
48556 }
48557 }
48558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048559 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048560#endif
48561
Daniel Veillard42595322004-11-08 10:52:06 +000048562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048563}
48564
48565
48566static int
48567test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048569
William M. Brack21e4ef22005-01-02 09:53:13 +000048570#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048571 int mem_base;
48572 xmlXPathObjectPtr ret_val;
48573 xmlLocationSetPtr val; /* the LocationSet value */
48574 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048575
Daniel Veillardce682bc2004-11-05 17:22:25 +000048576 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48577 mem_base = xmlMemBlocks();
48578 val = gen_xmlLocationSetPtr(n_val, 0);
48579
48580 ret_val = xmlXPtrWrapLocationSet(val);
48581 desret_xmlXPathObjectPtr(ret_val);
48582 call_tests++;
48583 des_xmlLocationSetPtr(n_val, val, 0);
48584 xmlResetLastError();
48585 if (mem_base != xmlMemBlocks()) {
48586 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048588 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048589 printf(" %d", n_val);
48590 printf("\n");
48591 }
48592 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048593 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048594#endif
48595
Daniel Veillard42595322004-11-08 10:52:06 +000048596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048597}
48598
48599static int
48600test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048602
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048603 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048604 test_ret += test_xmlXPtrBuildNodeList();
48605 test_ret += test_xmlXPtrEval();
48606 test_ret += test_xmlXPtrEvalRangePredicate();
48607 test_ret += test_xmlXPtrLocationSetAdd();
48608 test_ret += test_xmlXPtrLocationSetCreate();
48609 test_ret += test_xmlXPtrLocationSetDel();
48610 test_ret += test_xmlXPtrLocationSetMerge();
48611 test_ret += test_xmlXPtrLocationSetRemove();
48612 test_ret += test_xmlXPtrNewCollapsedRange();
48613 test_ret += test_xmlXPtrNewContext();
48614 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48615 test_ret += test_xmlXPtrNewLocationSetNodes();
48616 test_ret += test_xmlXPtrNewRange();
48617 test_ret += test_xmlXPtrNewRangeNodeObject();
48618 test_ret += test_xmlXPtrNewRangeNodePoint();
48619 test_ret += test_xmlXPtrNewRangeNodes();
48620 test_ret += test_xmlXPtrNewRangePointNode();
48621 test_ret += test_xmlXPtrNewRangePoints();
48622 test_ret += test_xmlXPtrRangeToFunction();
48623 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048624
Daniel Veillard42595322004-11-08 10:52:06 +000048625 if (test_ret != 0)
48626 printf("Module xpointer: %d errors\n", test_ret);
48627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048628}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048629static int
48630test_module(const char *module) {
48631 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48632 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048633 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048634 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048635 if (!strcmp(module, "catalog")) return(test_catalog());
48636 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048637 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048638 if (!strcmp(module, "dict")) return(test_dict());
48639 if (!strcmp(module, "encoding")) return(test_encoding());
48640 if (!strcmp(module, "entities")) return(test_entities());
48641 if (!strcmp(module, "hash")) return(test_hash());
48642 if (!strcmp(module, "list")) return(test_list());
48643 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48644 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48645 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048646 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048647 if (!strcmp(module, "pattern")) return(test_pattern());
48648 if (!strcmp(module, "relaxng")) return(test_relaxng());
48649 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48650 if (!strcmp(module, "tree")) return(test_tree());
48651 if (!strcmp(module, "uri")) return(test_uri());
48652 if (!strcmp(module, "valid")) return(test_valid());
48653 if (!strcmp(module, "xinclude")) return(test_xinclude());
48654 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048655 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048656 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000048657 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048658 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048659 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048660 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48661 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48662 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48663 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048664 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048665 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48666 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048667 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048668 if (!strcmp(module, "xpointer")) return(test_xpointer());
48669 return(0);
48670}