blob: c5e7b02511973096080d122e1807c9e9f6709087 [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}
695static void desret_double(double val ATTRIBUTE_UNUSED) {
696}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000697static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
698}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000699#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000700static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
701}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000702#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000703static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
704}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000705static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
706}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000707static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
708}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000709static void desret_xmlChar_ptr(xmlChar *val) {
710 if (val != NULL)
711 xmlFree(val);
712}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000713static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000714 if (val != api_doc)
715 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000716}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000717static void desret_xmlDictPtr(xmlDictPtr val) {
718 xmlDictFree(val);
719}
Daniel Veillardc8311492004-11-08 16:51:13 +0000720#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000721static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
722 xmlOutputBufferClose(val);
723}
Daniel Veillardc8311492004-11-08 16:51:13 +0000724#endif
725#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000726static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
727 xmlFreeTextReader(val);
728}
Daniel Veillardc8311492004-11-08 16:51:13 +0000729#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000730static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000731 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
732 xmlUnlinkNode(val);
733 xmlFreeNode(val);
734 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000735}
Daniel Veillard57b25162004-11-06 14:50:18 +0000736static void desret_xmlAttrPtr(xmlAttrPtr val) {
737 if (val != NULL) {
738 xmlUnlinkNode((xmlNodePtr) val);
739 xmlFreeNode((xmlNodePtr) val);
740 }
741}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000742static void desret_xmlEntityPtr(xmlEntityPtr val) {
743 if (val != NULL) {
744 xmlUnlinkNode((xmlNodePtr) val);
745 xmlFreeNode((xmlNodePtr) val);
746 }
747}
Daniel Veillard42595322004-11-08 10:52:06 +0000748static void desret_xmlElementPtr(xmlElementPtr val) {
749 if (val != NULL) {
750 xmlUnlinkNode((xmlNodePtr) val);
751 }
752}
753static void desret_xmlAttributePtr(xmlAttributePtr val) {
754 if (val != NULL) {
755 xmlUnlinkNode((xmlNodePtr) val);
756 }
757}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000758static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
759}
Daniel Veillard34099b42004-11-04 17:34:35 +0000760static void desret_xmlDtdPtr(xmlDtdPtr val) {
761 desret_xmlNodePtr((xmlNodePtr)val);
762}
Daniel Veillardc8311492004-11-08 16:51:13 +0000763#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000764static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000765 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000766}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000767static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
768 xmlXPathFreeNodeSet(val);
769}
Daniel Veillardc8311492004-11-08 16:51:13 +0000770#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000771static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
772 xmlFreeParserCtxt(val);
773}
774
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000775static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
776 xmlFreeParserInputBuffer(val);
777}
Daniel Veillard42595322004-11-08 10:52:06 +0000778static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
779 xmlFreeInputStream(val);
780}
Daniel Veillardc8311492004-11-08 16:51:13 +0000781#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000782static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
783 xmlFreeTextWriter(val);
784}
Daniel Veillardc8311492004-11-08 16:51:13 +0000785#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000786static void desret_xmlBufferPtr(xmlBufferPtr val) {
787 xmlBufferFree(val);
788}
Daniel Veillardc8311492004-11-08 16:51:13 +0000789#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000790static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
791 xmlSchemaFreeParserCtxt(val);
792}
793static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
794}
795static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
796 xmlRelaxNGFreeParserCtxt(val);
797}
Daniel Veillardc8311492004-11-08 16:51:13 +0000798#endif
799#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000800static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000801}
Daniel Veillardc8311492004-11-08 16:51:13 +0000802#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000803
Daniel Veillarda521d282004-11-09 14:59:59 +0000804/* cut and pasted from autogenerated to avoid troubles */
805#define gen_nb_const_xmlChar_ptr_ptr 1
806static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
807 return(NULL);
808}
809static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
810}
811
812#define gen_nb_unsigned_char_ptr 1
813static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
814 return(NULL);
815}
816static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
817}
818
819#define gen_nb_const_unsigned_char_ptr 1
820static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
821 return(NULL);
822}
823static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
824}
825
826#ifdef LIBXML_HTML_ENABLED
827#define gen_nb_const_htmlNodePtr 1
828static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
829 return(NULL);
830}
831static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
832}
833#endif
834
835#ifdef LIBXML_HTML_ENABLED
836#define gen_nb_htmlDocPtr 3
837static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
838 if (no == 0) return(htmlNewDoc(NULL, NULL));
839 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
840 return(NULL);
841}
842static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
843 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
844 xmlFreeDoc(val);
845}
846static void desret_htmlDocPtr(htmlDocPtr val) {
847 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
848 xmlFreeDoc(val);
849}
850#define gen_nb_htmlParserCtxtPtr 3
851static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
852 if (no == 0) return(xmlNewParserCtxt());
853 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
854 return(NULL);
855}
856static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
857 if (val != NULL)
858 htmlFreeParserCtxt(val);
859}
860static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
861 if (val != NULL)
862 htmlFreeParserCtxt(val);
863}
864#endif
865
866#ifdef LIBXML_XPATH_ENABLED
867#define gen_nb_xmlNodeSetPtr 1
868static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
869 return(NULL);
870}
871static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
872}
873#endif
874
875#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000876#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000877#define gen_nb_xmlShellCtxtPtr 1
878static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
879 return(NULL);
880}
881static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
882}
883#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000884#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000885
886#ifdef LIBXML_PATTERN_ENABLED
887#define gen_nb_xmlPatternPtr 1
888static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
889 return(NULL);
890}
891static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
892}
893#endif
894
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000895/************************************************************************
896 * *
897 * WARNING: end of the manually maintained part of the test code *
898 * do not remove or alter the CUT HERE line *
899 * *
900 ************************************************************************/
901
Daniel Veillard34099b42004-11-04 17:34:35 +0000902/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000903#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000904#define gen_nb_htmlParserOption 4
905static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
906 if (no == 1) return(HTML_PARSE_NOBLANKS);
907 if (no == 2) return(HTML_PARSE_NOERROR);
908 if (no == 3) return(HTML_PARSE_NONET);
909 if (no == 4) return(HTML_PARSE_NOWARNING);
910 return(0);
911}
912static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
913}
914static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) {
915}
916
Daniel Veillarda521d282004-11-09 14:59:59 +0000917#endif
918
919#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000920#define gen_nb_htmlStatus 4
921static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) {
922 if (no == 1) return(HTML_DEPRECATED);
923 if (no == 2) return(HTML_INVALID);
924 if (no == 3) return(HTML_NA);
925 if (no == 4) return(HTML_REQUIRED);
926 return(0);
927}
928static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
929}
930static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
931}
932
Daniel Veillarda521d282004-11-09 14:59:59 +0000933#endif
934
Daniel Veillard57b25162004-11-06 14:50:18 +0000935#define gen_nb_xlinkActuate 3
936static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) {
937 if (no == 1) return(XLINK_ACTUATE_AUTO);
938 if (no == 2) return(XLINK_ACTUATE_NONE);
939 if (no == 3) return(XLINK_ACTUATE_ONREQUEST);
940 return(0);
941}
942static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
943}
944static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) {
945}
946
947#define gen_nb_xlinkShow 4
948static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) {
949 if (no == 1) return(XLINK_SHOW_EMBED);
950 if (no == 2) return(XLINK_SHOW_NEW);
951 if (no == 3) return(XLINK_SHOW_NONE);
952 if (no == 4) return(XLINK_SHOW_REPLACE);
953 return(0);
954}
955static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
956}
957static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) {
958}
959
960#define gen_nb_xlinkType 4
961static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) {
962 if (no == 1) return(XLINK_TYPE_EXTENDED);
963 if (no == 2) return(XLINK_TYPE_EXTENDED_SET);
964 if (no == 3) return(XLINK_TYPE_NONE);
965 if (no == 4) return(XLINK_TYPE_SIMPLE);
966 return(0);
967}
968static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
969}
970static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) {
971}
972
973#define gen_nb_xmlAttributeDefault 4
974static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
975 if (no == 1) return(XML_ATTRIBUTE_FIXED);
976 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
977 if (no == 3) return(XML_ATTRIBUTE_NONE);
978 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
979 return(0);
980}
981static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
982}
983static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) {
984}
985
986#define gen_nb_xmlAttributeType 4
987static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
988 if (no == 1) return(XML_ATTRIBUTE_CDATA);
989 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
990 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
991 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
992 return(0);
993}
994static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
995}
996static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) {
997}
998
999#define gen_nb_xmlBufferAllocationScheme 3
1000static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
1001 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
1002 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
1003 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
1004 return(0);
1005}
1006static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1007}
1008static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
1009}
1010
Daniel Veillarda521d282004-11-09 14:59:59 +00001011#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001012#define gen_nb_xmlCatalogAllow 4
1013static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
1014 if (no == 1) return(XML_CATA_ALLOW_ALL);
1015 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
1016 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
1017 if (no == 4) return(XML_CATA_ALLOW_NONE);
1018 return(0);
1019}
1020static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1021}
1022static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1023}
1024
Daniel Veillarda521d282004-11-09 14:59:59 +00001025#endif
1026
1027#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001028#define gen_nb_xmlCatalogPrefer 3
1029static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1030 if (no == 1) return(XML_CATA_PREFER_NONE);
1031 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1032 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1033 return(0);
1034}
1035static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1036}
1037static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1038}
1039
Daniel Veillarda521d282004-11-09 14:59:59 +00001040#endif
1041
Daniel Veillard57b25162004-11-06 14:50:18 +00001042#define gen_nb_xmlElementContentOccur 4
1043static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) {
1044 if (no == 1) return(XML_ELEMENT_CONTENT_MULT);
1045 if (no == 2) return(XML_ELEMENT_CONTENT_ONCE);
1046 if (no == 3) return(XML_ELEMENT_CONTENT_OPT);
1047 if (no == 4) return(XML_ELEMENT_CONTENT_PLUS);
1048 return(0);
1049}
1050static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1051}
1052static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) {
1053}
1054
1055#define gen_nb_xmlElementContentType 4
1056static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1057 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1058 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1059 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1060 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1061 return(0);
1062}
1063static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1064}
1065static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) {
1066}
1067
1068#define gen_nb_xmlElementType 4
1069static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) {
1070 if (no == 1) return(XML_ATTRIBUTE_DECL);
1071 if (no == 2) return(XML_ATTRIBUTE_NODE);
1072 if (no == 3) return(XML_CDATA_SECTION_NODE);
1073 if (no == 4) return(XML_COMMENT_NODE);
1074 return(0);
1075}
1076static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1077}
1078static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) {
1079}
1080
1081#define gen_nb_xmlElementTypeVal 4
1082static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1083 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1084 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1085 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1086 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1087 return(0);
1088}
1089static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1090}
1091static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) {
1092}
1093
1094#define gen_nb_xmlEntityType 4
1095static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) {
1096 if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY);
1097 if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY);
1098 if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY);
1099 if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY);
1100 return(0);
1101}
1102static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1103}
1104static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) {
1105}
1106
1107#define gen_nb_xmlErrorDomain 4
1108static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) {
1109 if (no == 1) return(XML_FROM_C14N);
1110 if (no == 2) return(XML_FROM_CATALOG);
1111 if (no == 3) return(XML_FROM_CHECK);
1112 if (no == 4) return(XML_FROM_DATATYPE);
1113 return(0);
1114}
1115static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1116}
1117static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) {
1118}
1119
1120#define gen_nb_xmlErrorLevel 4
1121static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) {
1122 if (no == 1) return(XML_ERR_ERROR);
1123 if (no == 2) return(XML_ERR_FATAL);
1124 if (no == 3) return(XML_ERR_NONE);
1125 if (no == 4) return(XML_ERR_WARNING);
1126 return(0);
1127}
1128static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1129}
1130static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) {
1131}
1132
1133#define gen_nb_xmlParserErrors 4
1134static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) {
1135 if (no == 1) return(XML_C14N_CREATE_CTXT);
1136 if (no == 2) return(XML_C14N_CREATE_STACK);
1137 if (no == 3) return(XML_C14N_INVALID_NODE);
1138 if (no == 4) return(XML_C14N_REQUIRES_UTF8);
1139 return(0);
1140}
1141static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1142}
1143static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1144}
1145
1146#define gen_nb_xmlParserInputState 4
1147static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) {
1148 if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE);
1149 if (no == 2) return(XML_PARSER_CDATA_SECTION);
1150 if (no == 3) return(XML_PARSER_COMMENT);
1151 if (no == 4) return(XML_PARSER_CONTENT);
1152 return(0);
1153}
1154static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1155}
1156static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) {
1157}
1158
1159#define gen_nb_xmlParserMode 4
1160static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) {
1161 if (no == 1) return(XML_PARSE_DOM);
1162 if (no == 2) return(XML_PARSE_PUSH_DOM);
1163 if (no == 3) return(XML_PARSE_PUSH_SAX);
1164 if (no == 4) return(XML_PARSE_READER);
1165 return(0);
1166}
1167static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1168}
1169static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) {
1170}
1171
1172#define gen_nb_xmlParserOption 4
1173static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
1174 if (no == 1) return(XML_PARSE_DTDATTR);
1175 if (no == 2) return(XML_PARSE_DTDLOAD);
1176 if (no == 3) return(XML_PARSE_DTDVALID);
1177 if (no == 4) return(XML_PARSE_NOBLANKS);
1178 return(0);
1179}
1180static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1181}
1182static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) {
1183}
1184
Daniel Veillarda521d282004-11-09 14:59:59 +00001185#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001186#define gen_nb_xmlParserProperties 4
1187static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) {
1188 if (no == 1) return(XML_PARSER_DEFAULTATTRS);
1189 if (no == 2) return(XML_PARSER_LOADDTD);
1190 if (no == 3) return(XML_PARSER_SUBST_ENTITIES);
1191 if (no == 4) return(XML_PARSER_VALIDATE);
1192 return(0);
1193}
1194static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1195}
1196static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) {
1197}
1198
Daniel Veillarda521d282004-11-09 14:59:59 +00001199#endif
1200
1201#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001202#define gen_nb_xmlParserSeverities 4
1203static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) {
1204 if (no == 1) return(XML_PARSER_SEVERITY_ERROR);
1205 if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR);
1206 if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING);
1207 if (no == 4) return(XML_PARSER_SEVERITY_WARNING);
1208 return(0);
1209}
1210static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1211}
1212static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) {
1213}
1214
Daniel Veillarda521d282004-11-09 14:59:59 +00001215#endif
1216
1217#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001218#define gen_nb_xmlReaderTypes 4
1219static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) {
1220 if (no == 1) return(XML_READER_TYPE_ATTRIBUTE);
1221 if (no == 2) return(XML_READER_TYPE_CDATA);
1222 if (no == 3) return(XML_READER_TYPE_COMMENT);
1223 if (no == 4) return(XML_READER_TYPE_DOCUMENT);
1224 return(0);
1225}
1226static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1227}
1228static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) {
1229}
1230
Daniel Veillarda521d282004-11-09 14:59:59 +00001231#endif
1232
1233#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001234#define gen_nb_xmlRelaxNGParserFlag 3
1235static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) {
1236 if (no == 1) return(XML_RELAXNGP_CRNG);
1237 if (no == 2) return(XML_RELAXNGP_FREE_DOC);
1238 if (no == 3) return(XML_RELAXNGP_NONE);
1239 return(0);
1240}
1241static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1242}
1243static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) {
1244}
1245
Daniel Veillarda521d282004-11-09 14:59:59 +00001246#endif
1247
1248#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001249#define gen_nb_xmlRelaxNGValidErr 4
1250static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) {
1251 if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS);
1252 if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME);
1253 if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS);
1254 if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID);
1255 return(0);
1256}
1257static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1258}
1259static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) {
1260}
1261
Daniel Veillarda521d282004-11-09 14:59:59 +00001262#endif
1263
1264#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001265#define gen_nb_xmlSchemaContentType 4
1266static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) {
1267 if (no == 1) return(XML_SCHEMA_CONTENT_ANY);
1268 if (no == 2) return(XML_SCHEMA_CONTENT_BASIC);
1269 if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS);
1270 if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY);
1271 return(0);
1272}
1273static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1274}
1275static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) {
1276}
1277
Daniel Veillarda521d282004-11-09 14:59:59 +00001278#endif
1279
1280#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001281#define gen_nb_xmlSchemaTypeType 4
1282static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) {
1283 if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION);
1284 if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS);
1285 if (no == 3) return(XML_SCHEMA_FACET_LENGTH);
1286 if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE);
1287 return(0);
1288}
1289static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1290}
1291static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) {
1292}
1293
Daniel Veillarda521d282004-11-09 14:59:59 +00001294#endif
1295
1296#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001297#define gen_nb_xmlSchemaValType 4
1298static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1299 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1300 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1301 if (no == 3) return(XML_SCHEMAS_ANYURI);
1302 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1303 return(0);
1304}
1305static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1306}
1307static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1308}
1309
Daniel Veillarda521d282004-11-09 14:59:59 +00001310#endif
1311
1312#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001313#define gen_nb_xmlSchemaValidError 4
1314static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) {
1315 if (no == 1) return(XML_SCHEMAS_ERR_);
1316 if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID);
1317 if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN);
1318 if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT);
1319 return(0);
1320}
1321static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1322}
1323static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) {
1324}
1325
Daniel Veillarda521d282004-11-09 14:59:59 +00001326#endif
1327
1328#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001329#define gen_nb_xmlSchemaValidOption 1
1330static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) {
1331 if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE);
1332 return(0);
1333}
1334static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1335}
1336static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) {
1337}
1338
Daniel Veillarda521d282004-11-09 14:59:59 +00001339#endif
1340
1341#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001342#define gen_nb_xmlTextReaderMode 4
1343static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) {
1344 if (no == 1) return(XML_TEXTREADER_MODE_CLOSED);
1345 if (no == 2) return(XML_TEXTREADER_MODE_EOF);
1346 if (no == 3) return(XML_TEXTREADER_MODE_ERROR);
1347 if (no == 4) return(XML_TEXTREADER_MODE_INITIAL);
1348 return(0);
1349}
1350static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1351}
1352static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) {
1353}
1354
Daniel Veillarda521d282004-11-09 14:59:59 +00001355#endif
1356
1357#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001358#define gen_nb_xmlXPathError 4
1359static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) {
1360 if (no == 1) return(XPATH_ENCODING_ERROR);
1361 if (no == 2) return(XPATH_EXPRESSION_OK);
1362 if (no == 3) return(XPATH_EXPR_ERROR);
1363 if (no == 4) return(XPATH_INVALID_ARITY);
1364 return(0);
1365}
1366static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1367}
1368static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) {
1369}
1370
Daniel Veillarda521d282004-11-09 14:59:59 +00001371#endif
1372
1373#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001374#define gen_nb_xmlXPathObjectType 4
1375static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) {
1376 if (no == 1) return(XPATH_BOOLEAN);
1377 if (no == 2) return(XPATH_LOCATIONSET);
1378 if (no == 3) return(XPATH_NODESET);
1379 if (no == 4) return(XPATH_NUMBER);
1380 return(0);
1381}
1382static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1383}
1384static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) {
1385}
1386
Daniel Veillarda521d282004-11-09 14:59:59 +00001387#endif
1388
Daniel Veillard34099b42004-11-04 17:34:35 +00001389#include <libxml/HTMLparser.h>
1390#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001391#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001392#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001393#include <libxml/catalog.h>
1394#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001395#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001396#include <libxml/dict.h>
1397#include <libxml/encoding.h>
1398#include <libxml/entities.h>
1399#include <libxml/hash.h>
1400#include <libxml/list.h>
1401#include <libxml/nanoftp.h>
1402#include <libxml/nanohttp.h>
1403#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001404#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001405#include <libxml/pattern.h>
1406#include <libxml/relaxng.h>
1407#include <libxml/schemasInternals.h>
1408#include <libxml/tree.h>
1409#include <libxml/uri.h>
1410#include <libxml/valid.h>
1411#include <libxml/xinclude.h>
1412#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001413#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001414#include <libxml/xmlerror.h>
1415#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001416#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001417#include <libxml/xmlsave.h>
1418#include <libxml/xmlschemas.h>
1419#include <libxml/xmlschemastypes.h>
1420#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001421#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001422#include <libxml/xmlwriter.h>
1423#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001424#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001425#include <libxml/xpointer.h>
1426static int test_HTMLparser(void);
1427static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001428static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001429static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001430static int test_catalog(void);
1431static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001432static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001433static int test_dict(void);
1434static int test_encoding(void);
1435static int test_entities(void);
1436static int test_hash(void);
1437static int test_list(void);
1438static int test_nanoftp(void);
1439static int test_nanohttp(void);
1440static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001441static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001442static int test_pattern(void);
1443static int test_relaxng(void);
1444static int test_schemasInternals(void);
1445static int test_tree(void);
1446static int test_uri(void);
1447static int test_valid(void);
1448static int test_xinclude(void);
1449static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001450static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001451static int test_xmlerror(void);
1452static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001453static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001454static int test_xmlsave(void);
1455static int test_xmlschemas(void);
1456static int test_xmlschemastypes(void);
1457static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001458static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001459static int test_xmlwriter(void);
1460static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001461static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001462static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001463
1464/**
1465 * testlibxml2:
1466 *
1467 * Main entry point of the tester for the full libxml2 module,
1468 * it calls all the tester entry point for each module.
1469 *
1470 * Returns the number of error found
1471 */
1472static int
1473testlibxml2(void)
1474{
Daniel Veillard42595322004-11-08 10:52:06 +00001475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001476
Daniel Veillard42595322004-11-08 10:52:06 +00001477 test_ret += test_HTMLparser();
1478 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001479 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001480 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001481 test_ret += test_catalog();
1482 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001483 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001484 test_ret += test_dict();
1485 test_ret += test_encoding();
1486 test_ret += test_entities();
1487 test_ret += test_hash();
1488 test_ret += test_list();
1489 test_ret += test_nanoftp();
1490 test_ret += test_nanohttp();
1491 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001492 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001493 test_ret += test_pattern();
1494 test_ret += test_relaxng();
1495 test_ret += test_schemasInternals();
1496 test_ret += test_tree();
1497 test_ret += test_uri();
1498 test_ret += test_valid();
1499 test_ret += test_xinclude();
1500 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001501 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001502 test_ret += test_xmlerror();
1503 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001504 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001505 test_ret += test_xmlsave();
1506 test_ret += test_xmlschemas();
1507 test_ret += test_xmlschemastypes();
1508 test_ret += test_xmlstring();
1509 test_ret += test_xmlunicode();
1510 test_ret += test_xmlwriter();
1511 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001512 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001513 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001514
Daniel Veillard3d97e662004-11-04 10:49:00 +00001515 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001516 function_tests, call_tests, test_ret);
1517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001518}
1519
1520
1521static int
1522test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001524
Daniel Veillardce682bc2004-11-05 17:22:25 +00001525#ifdef LIBXML_HTML_ENABLED
1526 int mem_base;
1527 int ret_val;
1528 unsigned char * out; /* a pointer to an array of bytes to store the result */
1529 int n_out;
1530 int * outlen; /* the length of @out */
1531 int n_outlen;
1532 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1533 int n_in;
1534 int * inlen; /* the length of @in */
1535 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001536
Daniel Veillardce682bc2004-11-05 17:22:25 +00001537 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1538 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1539 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1540 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1541 mem_base = xmlMemBlocks();
1542 out = gen_unsigned_char_ptr(n_out, 0);
1543 outlen = gen_int_ptr(n_outlen, 1);
1544 in = gen_const_unsigned_char_ptr(n_in, 2);
1545 inlen = gen_int_ptr(n_inlen, 3);
1546
William M. Brackf13f77f2004-11-12 16:03:48 +00001547 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001548 desret_int(ret_val);
1549 call_tests++;
1550 des_unsigned_char_ptr(n_out, out, 0);
1551 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001552 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001553 des_int_ptr(n_inlen, inlen, 3);
1554 xmlResetLastError();
1555 if (mem_base != xmlMemBlocks()) {
1556 printf("Leak of %d blocks found in UTF8ToHtml",
1557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001558 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001559 printf(" %d", n_out);
1560 printf(" %d", n_outlen);
1561 printf(" %d", n_in);
1562 printf(" %d", n_inlen);
1563 printf("\n");
1564 }
1565 }
1566 }
1567 }
1568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001569 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001570#endif
1571
Daniel Veillard42595322004-11-08 10:52:06 +00001572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001573}
1574
Daniel Veillarda521d282004-11-09 14:59:59 +00001575#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001576
Daniel Veillardce682bc2004-11-05 17:22:25 +00001577#define gen_nb_const_htmlElemDesc_ptr 1
1578static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1579 return(NULL);
1580}
1581static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1582}
Daniel Veillarda521d282004-11-09 14:59:59 +00001583#endif
1584
Daniel Veillardce682bc2004-11-05 17:22:25 +00001585
Daniel Veillardd93f6252004-11-02 15:53:51 +00001586static int
1587test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001589
Daniel Veillard57b25162004-11-06 14:50:18 +00001590#ifdef LIBXML_HTML_ENABLED
1591 int mem_base;
1592 htmlStatus ret_val;
1593 htmlElemDesc * elt; /* HTML element */
1594 int n_elt;
1595 xmlChar * attr; /* HTML attribute */
1596 int n_attr;
1597 int legacy; /* whether to allow deprecated attributes */
1598 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001599
Daniel Veillard57b25162004-11-06 14:50:18 +00001600 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1601 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1602 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1603 mem_base = xmlMemBlocks();
1604 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1605 attr = gen_const_xmlChar_ptr(n_attr, 1);
1606 legacy = gen_int(n_legacy, 2);
1607
William M. Brackf13f77f2004-11-12 16:03:48 +00001608 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001609 desret_htmlStatus(ret_val);
1610 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001611 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1612 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001613 des_int(n_legacy, legacy, 2);
1614 xmlResetLastError();
1615 if (mem_base != xmlMemBlocks()) {
1616 printf("Leak of %d blocks found in htmlAttrAllowed",
1617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001618 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001619 printf(" %d", n_elt);
1620 printf(" %d", n_attr);
1621 printf(" %d", n_legacy);
1622 printf("\n");
1623 }
1624 }
1625 }
1626 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001627 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001628#endif
1629
Daniel Veillard42595322004-11-08 10:52:06 +00001630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001631}
1632
Daniel Veillarda521d282004-11-09 14:59:59 +00001633#ifdef LIBXML_HTML_ENABLED
1634
1635#define gen_nb_htmlNodePtr 1
1636static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1637 return(NULL);
1638}
1639static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1640}
1641#endif
1642
Daniel Veillardd93f6252004-11-02 15:53:51 +00001643
1644static int
1645test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001647
Daniel Veillarda03e3652004-11-02 18:45:30 +00001648#ifdef LIBXML_HTML_ENABLED
1649 int mem_base;
1650 int ret_val;
1651 htmlDocPtr doc; /* the HTML document */
1652 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001653 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001654 int n_name;
1655 htmlNodePtr elem; /* the HTML element */
1656 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001657
Daniel Veillarda521d282004-11-09 14:59:59 +00001658 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001659 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001660 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001661 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001662 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001663 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001664 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001665
William M. Brackf13f77f2004-11-12 16:03:48 +00001666 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001667 desret_int(ret_val);
1668 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001669 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001670 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001671 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001672 xmlResetLastError();
1673 if (mem_base != xmlMemBlocks()) {
1674 printf("Leak of %d blocks found in htmlAutoCloseTag",
1675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001676 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001677 printf(" %d", n_doc);
1678 printf(" %d", n_name);
1679 printf(" %d", n_elem);
1680 printf("\n");
1681 }
1682 }
1683 }
1684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001685 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001686#endif
1687
Daniel Veillard42595322004-11-08 10:52:06 +00001688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001689}
1690
1691
1692static int
1693test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001695
Daniel Veillard34099b42004-11-04 17:34:35 +00001696#ifdef LIBXML_HTML_ENABLED
1697 int mem_base;
1698 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001699 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001700 int n_buffer;
1701 int size; /* the size of the array */
1702 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001703
Daniel Veillard34099b42004-11-04 17:34:35 +00001704 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1705 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1706 mem_base = xmlMemBlocks();
1707 buffer = gen_const_char_ptr(n_buffer, 0);
1708 size = gen_int(n_size, 1);
1709
William M. Brackf13f77f2004-11-12 16:03:48 +00001710 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001711 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001712 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001713 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001714 des_int(n_size, size, 1);
1715 xmlResetLastError();
1716 if (mem_base != xmlMemBlocks()) {
1717 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001719 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001720 printf(" %d", n_buffer);
1721 printf(" %d", n_size);
1722 printf("\n");
1723 }
1724 }
1725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001726 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001727#endif
1728
Daniel Veillard42595322004-11-08 10:52:06 +00001729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001730}
1731
Daniel Veillarda521d282004-11-09 14:59:59 +00001732#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001733
Daniel Veillardce682bc2004-11-05 17:22:25 +00001734#define gen_nb_htmlSAXHandlerPtr 1
1735static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1736 return(NULL);
1737}
1738static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1739}
Daniel Veillarda521d282004-11-09 14:59:59 +00001740#endif
1741
Daniel Veillardce682bc2004-11-05 17:22:25 +00001742
Daniel Veillardd93f6252004-11-02 15:53:51 +00001743static int
1744test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001746
Daniel Veillardce682bc2004-11-05 17:22:25 +00001747#ifdef LIBXML_HTML_ENABLED
1748#ifdef LIBXML_PUSH_ENABLED
1749 int mem_base;
1750 htmlParserCtxtPtr ret_val;
1751 htmlSAXHandlerPtr sax; /* a SAX handler */
1752 int n_sax;
1753 void * user_data; /* The user data returned on SAX callbacks */
1754 int n_user_data;
1755 char * chunk; /* a pointer to an array of chars */
1756 int n_chunk;
1757 int size; /* number of chars in the array */
1758 int n_size;
1759 const char * filename; /* an optional file name or URI */
1760 int n_filename;
1761 xmlCharEncoding enc; /* an optional encoding */
1762 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001763
Daniel Veillardce682bc2004-11-05 17:22:25 +00001764 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1765 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1766 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1767 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001768 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001769 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1770 mem_base = xmlMemBlocks();
1771 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1772 user_data = gen_userdata(n_user_data, 1);
1773 chunk = gen_const_char_ptr(n_chunk, 2);
1774 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001775 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001776 enc = gen_xmlCharEncoding(n_enc, 5);
1777
William M. Brackf13f77f2004-11-12 16:03:48 +00001778 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001779 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001780 call_tests++;
1781 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1782 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001783 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001784 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001785 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001786 des_xmlCharEncoding(n_enc, enc, 5);
1787 xmlResetLastError();
1788 if (mem_base != xmlMemBlocks()) {
1789 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001791 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001792 printf(" %d", n_sax);
1793 printf(" %d", n_user_data);
1794 printf(" %d", n_chunk);
1795 printf(" %d", n_size);
1796 printf(" %d", n_filename);
1797 printf(" %d", n_enc);
1798 printf("\n");
1799 }
1800 }
1801 }
1802 }
1803 }
1804 }
1805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001806 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001807#endif
1808#endif
1809
Daniel Veillard42595322004-11-08 10:52:06 +00001810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001811}
1812
1813
1814static int
1815test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001817
Daniel Veillarda03e3652004-11-02 18:45:30 +00001818#ifdef LIBXML_HTML_ENABLED
1819 int mem_base;
1820 htmlDocPtr ret_val;
1821 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1822 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001823 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001824 int n_cur;
1825 const char * URL; /* the base URL to use for the document */
1826 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001827 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001828 int n_encoding;
1829 int options; /* a combination of htmlParserOption(s) */
1830 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001831
Daniel Veillarda521d282004-11-09 14:59:59 +00001832 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001833 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1834 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1835 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1836 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1837 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001838 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001839 cur = gen_const_xmlChar_ptr(n_cur, 1);
1840 URL = gen_filepath(n_URL, 2);
1841 encoding = gen_const_char_ptr(n_encoding, 3);
1842 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001843
William M. Brackf13f77f2004-11-12 16:03:48 +00001844 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001845 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001846 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001847 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001848 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001849 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001850 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001851 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001852 xmlResetLastError();
1853 if (mem_base != xmlMemBlocks()) {
1854 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001856 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001857 printf(" %d", n_ctxt);
1858 printf(" %d", n_cur);
1859 printf(" %d", n_URL);
1860 printf(" %d", n_encoding);
1861 printf(" %d", n_options);
1862 printf("\n");
1863 }
1864 }
1865 }
1866 }
1867 }
1868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001869 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001870#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001871
Daniel Veillard42595322004-11-08 10:52:06 +00001872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001873}
1874
1875
1876static int
1877test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001879
Daniel Veillarda03e3652004-11-02 18:45:30 +00001880#ifdef LIBXML_HTML_ENABLED
1881 int mem_base;
1882 htmlDocPtr ret_val;
1883 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1884 int n_ctxt;
1885 const char * filename; /* a file or URL */
1886 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001887 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001888 int n_encoding;
1889 int options; /* a combination of htmlParserOption(s) */
1890 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001891
Daniel Veillarda521d282004-11-09 14:59:59 +00001892 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001893 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1894 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1895 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1896 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001897 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001898 filename = gen_filepath(n_filename, 1);
1899 encoding = gen_const_char_ptr(n_encoding, 2);
1900 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001901
William M. Brackf13f77f2004-11-12 16:03:48 +00001902 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001903 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001904 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001905 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001906 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001907 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001908 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001909 xmlResetLastError();
1910 if (mem_base != xmlMemBlocks()) {
1911 printf("Leak of %d blocks found in htmlCtxtReadFile",
1912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001913 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001914 printf(" %d", n_ctxt);
1915 printf(" %d", n_filename);
1916 printf(" %d", n_encoding);
1917 printf(" %d", n_options);
1918 printf("\n");
1919 }
1920 }
1921 }
1922 }
1923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001924 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001925#endif
1926
Daniel Veillard42595322004-11-08 10:52:06 +00001927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001928}
1929
1930
1931static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001932test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001934
Daniel Veillarda03e3652004-11-02 18:45:30 +00001935#ifdef LIBXML_HTML_ENABLED
1936 int mem_base;
1937 htmlDocPtr ret_val;
1938 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1939 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001940 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001941 int n_buffer;
1942 int size; /* the size of the array */
1943 int n_size;
1944 const char * URL; /* the base URL to use for the document */
1945 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001946 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001947 int n_encoding;
1948 int options; /* a combination of htmlParserOption(s) */
1949 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001950
Daniel Veillarda521d282004-11-09 14:59:59 +00001951 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001952 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1953 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1954 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1955 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1956 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1957 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001958 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001959 buffer = gen_const_char_ptr(n_buffer, 1);
1960 size = gen_int(n_size, 2);
1961 URL = gen_filepath(n_URL, 3);
1962 encoding = gen_const_char_ptr(n_encoding, 4);
1963 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001964
William M. Brackf13f77f2004-11-12 16:03:48 +00001965 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001966 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001967 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001968 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001969 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001970 des_int(n_size, size, 2);
1971 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001972 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001973 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001974 xmlResetLastError();
1975 if (mem_base != xmlMemBlocks()) {
1976 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001978 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001979 printf(" %d", n_ctxt);
1980 printf(" %d", n_buffer);
1981 printf(" %d", n_size);
1982 printf(" %d", n_URL);
1983 printf(" %d", n_encoding);
1984 printf(" %d", n_options);
1985 printf("\n");
1986 }
1987 }
1988 }
1989 }
1990 }
1991 }
1992 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001993 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001994#endif
1995
Daniel Veillard42595322004-11-08 10:52:06 +00001996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001997}
1998
1999
2000static int
2001test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002003
Daniel Veillarda03e3652004-11-02 18:45:30 +00002004#ifdef LIBXML_HTML_ENABLED
2005 int mem_base;
2006 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2007 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002008
Daniel Veillarda521d282004-11-09 14:59:59 +00002009 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002010 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002011 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002012
2013 htmlCtxtReset(ctxt);
2014 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002015 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002016 xmlResetLastError();
2017 if (mem_base != xmlMemBlocks()) {
2018 printf("Leak of %d blocks found in htmlCtxtReset",
2019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002020 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002021 printf(" %d", n_ctxt);
2022 printf("\n");
2023 }
2024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002025 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002026#endif
2027
Daniel Veillard42595322004-11-08 10:52:06 +00002028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002029}
2030
2031
2032static int
2033test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002035
Daniel Veillarda03e3652004-11-02 18:45:30 +00002036#ifdef LIBXML_HTML_ENABLED
2037 int mem_base;
2038 int ret_val;
2039 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2040 int n_ctxt;
2041 int options; /* a combination of htmlParserOption(s) */
2042 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002043
Daniel Veillarda521d282004-11-09 14:59:59 +00002044 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002045 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2046 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002047 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002048 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002049
2050 ret_val = htmlCtxtUseOptions(ctxt, options);
2051 desret_int(ret_val);
2052 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002053 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002054 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002055 xmlResetLastError();
2056 if (mem_base != xmlMemBlocks()) {
2057 printf("Leak of %d blocks found in htmlCtxtUseOptions",
2058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002059 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002060 printf(" %d", n_ctxt);
2061 printf(" %d", n_options);
2062 printf("\n");
2063 }
2064 }
2065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002066 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002067#endif
2068
Daniel Veillard42595322004-11-08 10:52:06 +00002069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002070}
2071
2072
2073static int
2074test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002076
Daniel Veillardce682bc2004-11-05 17:22:25 +00002077#ifdef LIBXML_HTML_ENABLED
2078 int mem_base;
2079 int ret_val;
2080 htmlElemDesc * parent; /* HTML parent element */
2081 int n_parent;
2082 xmlChar * elt; /* HTML element */
2083 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002084
Daniel Veillardce682bc2004-11-05 17:22:25 +00002085 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
2086 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
2087 mem_base = xmlMemBlocks();
2088 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
2089 elt = gen_const_xmlChar_ptr(n_elt, 1);
2090
William M. Brackf13f77f2004-11-12 16:03:48 +00002091 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002092 desret_int(ret_val);
2093 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002094 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
2095 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002096 xmlResetLastError();
2097 if (mem_base != xmlMemBlocks()) {
2098 printf("Leak of %d blocks found in htmlElementAllowedHere",
2099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002100 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002101 printf(" %d", n_parent);
2102 printf(" %d", n_elt);
2103 printf("\n");
2104 }
2105 }
2106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002107 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002108#endif
2109
Daniel Veillard42595322004-11-08 10:52:06 +00002110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002111}
2112
2113
2114static int
2115test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002117
Daniel Veillard57b25162004-11-06 14:50:18 +00002118#ifdef LIBXML_HTML_ENABLED
2119 int mem_base;
2120 htmlStatus ret_val;
2121 htmlElemDesc * parent; /* HTML parent element */
2122 int n_parent;
2123 htmlElemDesc * elt; /* HTML element */
2124 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002125
Daniel Veillard57b25162004-11-06 14:50:18 +00002126 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
2127 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
2128 mem_base = xmlMemBlocks();
2129 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
2130 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
2131
William M. Brackf13f77f2004-11-12 16:03:48 +00002132 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00002133 desret_htmlStatus(ret_val);
2134 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002135 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
2136 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00002137 xmlResetLastError();
2138 if (mem_base != xmlMemBlocks()) {
2139 printf("Leak of %d blocks found in htmlElementStatusHere",
2140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002141 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002142 printf(" %d", n_parent);
2143 printf(" %d", n_elt);
2144 printf("\n");
2145 }
2146 }
2147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002148 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002149#endif
2150
Daniel Veillard42595322004-11-08 10:52:06 +00002151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002152}
2153
2154
2155static int
2156test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002158
Daniel Veillardce682bc2004-11-05 17:22:25 +00002159#ifdef LIBXML_HTML_ENABLED
2160 int mem_base;
2161 int ret_val;
2162 unsigned char * out; /* a pointer to an array of bytes to store the result */
2163 int n_out;
2164 int * outlen; /* the length of @out */
2165 int n_outlen;
2166 unsigned char * in; /* a pointer to an array of UTF-8 chars */
2167 int n_in;
2168 int * inlen; /* the length of @in */
2169 int n_inlen;
2170 int quoteChar; /* the quote character to escape (' or ") or zero. */
2171 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002172
Daniel Veillardce682bc2004-11-05 17:22:25 +00002173 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
2174 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
2175 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
2176 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
2177 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
2178 mem_base = xmlMemBlocks();
2179 out = gen_unsigned_char_ptr(n_out, 0);
2180 outlen = gen_int_ptr(n_outlen, 1);
2181 in = gen_const_unsigned_char_ptr(n_in, 2);
2182 inlen = gen_int_ptr(n_inlen, 3);
2183 quoteChar = gen_int(n_quoteChar, 4);
2184
William M. Brackf13f77f2004-11-12 16:03:48 +00002185 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002186 desret_int(ret_val);
2187 call_tests++;
2188 des_unsigned_char_ptr(n_out, out, 0);
2189 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002190 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002191 des_int_ptr(n_inlen, inlen, 3);
2192 des_int(n_quoteChar, quoteChar, 4);
2193 xmlResetLastError();
2194 if (mem_base != xmlMemBlocks()) {
2195 printf("Leak of %d blocks found in htmlEncodeEntities",
2196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002197 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002198 printf(" %d", n_out);
2199 printf(" %d", n_outlen);
2200 printf(" %d", n_in);
2201 printf(" %d", n_inlen);
2202 printf(" %d", n_quoteChar);
2203 printf("\n");
2204 }
2205 }
2206 }
2207 }
2208 }
2209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002210 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002211#endif
2212
Daniel Veillard42595322004-11-08 10:52:06 +00002213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002214}
2215
2216
2217static int
2218test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002220
Daniel Veillard42595322004-11-08 10:52:06 +00002221#ifdef LIBXML_HTML_ENABLED
2222 int mem_base;
2223 const htmlEntityDesc * ret_val;
2224 xmlChar * name; /* the entity name */
2225 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002226
Daniel Veillard42595322004-11-08 10:52:06 +00002227 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2228 mem_base = xmlMemBlocks();
2229 name = gen_const_xmlChar_ptr(n_name, 0);
2230
William M. Brackf13f77f2004-11-12 16:03:48 +00002231 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00002232 desret_const_htmlEntityDesc_ptr(ret_val);
2233 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002234 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002235 xmlResetLastError();
2236 if (mem_base != xmlMemBlocks()) {
2237 printf("Leak of %d blocks found in htmlEntityLookup",
2238 xmlMemBlocks() - mem_base);
2239 test_ret++;
2240 printf(" %d", n_name);
2241 printf("\n");
2242 }
2243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002244 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002245#endif
2246
Daniel Veillard42595322004-11-08 10:52:06 +00002247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002248}
2249
2250
2251static int
2252test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002254
Daniel Veillard42595322004-11-08 10:52:06 +00002255#ifdef LIBXML_HTML_ENABLED
2256 int mem_base;
2257 const htmlEntityDesc * ret_val;
2258 unsigned int value; /* the entity's unicode value */
2259 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002260
Daniel Veillard42595322004-11-08 10:52:06 +00002261 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
2262 mem_base = xmlMemBlocks();
2263 value = gen_unsigned_int(n_value, 0);
2264
2265 ret_val = htmlEntityValueLookup(value);
2266 desret_const_htmlEntityDesc_ptr(ret_val);
2267 call_tests++;
2268 des_unsigned_int(n_value, value, 0);
2269 xmlResetLastError();
2270 if (mem_base != xmlMemBlocks()) {
2271 printf("Leak of %d blocks found in htmlEntityValueLookup",
2272 xmlMemBlocks() - mem_base);
2273 test_ret++;
2274 printf(" %d", n_value);
2275 printf("\n");
2276 }
2277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002278 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002279#endif
2280
Daniel Veillard42595322004-11-08 10:52:06 +00002281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002282}
2283
2284
2285static int
2286test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002288
2289#ifdef LIBXML_HTML_ENABLED
2290 int mem_base;
2291 int ret_val;
2292 int val; /* int 0 or 1 */
2293 int n_val;
2294
2295 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2296 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002297 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002298
2299 ret_val = htmlHandleOmittedElem(val);
2300 desret_int(ret_val);
2301 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002302 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002303 xmlResetLastError();
2304 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002305 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002307 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002308 printf(" %d", n_val);
2309 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002310 }
2311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002312 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002313#endif
2314
Daniel Veillard42595322004-11-08 10:52:06 +00002315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002316}
2317
2318
2319static int
2320test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002322
Daniel Veillarda03e3652004-11-02 18:45:30 +00002323#ifdef LIBXML_HTML_ENABLED
2324 int mem_base;
2325 int ret_val;
2326 htmlDocPtr doc; /* the HTML document */
2327 int n_doc;
2328 htmlNodePtr elem; /* the HTML element */
2329 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002330
Daniel Veillarda521d282004-11-09 14:59:59 +00002331 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2332 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002333 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002334 doc = gen_htmlDocPtr(n_doc, 0);
2335 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002336
2337 ret_val = htmlIsAutoClosed(doc, elem);
2338 desret_int(ret_val);
2339 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002340 des_htmlDocPtr(n_doc, doc, 0);
2341 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002342 xmlResetLastError();
2343 if (mem_base != xmlMemBlocks()) {
2344 printf("Leak of %d blocks found in htmlIsAutoClosed",
2345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002346 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002347 printf(" %d", n_doc);
2348 printf(" %d", n_elem);
2349 printf("\n");
2350 }
2351 }
2352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002353 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002354#endif
2355
Daniel Veillard42595322004-11-08 10:52:06 +00002356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002357}
2358
2359
2360static int
2361test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002363
2364#ifdef LIBXML_HTML_ENABLED
2365 int mem_base;
2366 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002367 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368 int n_name;
2369
2370 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002372 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002373
William M. Brackf13f77f2004-11-12 16:03:48 +00002374 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002375 desret_int(ret_val);
2376 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002377 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002378 xmlResetLastError();
2379 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002380 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002382 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002383 printf(" %d", n_name);
2384 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002385 }
2386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002387 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002388#endif
2389
Daniel Veillard42595322004-11-08 10:52:06 +00002390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002391}
2392
2393
2394static int
2395test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002397
Daniel Veillard57b25162004-11-06 14:50:18 +00002398#ifdef LIBXML_HTML_ENABLED
2399 int mem_base;
2400 htmlStatus ret_val;
2401 htmlNodePtr node; /* an htmlNodePtr in a tree */
2402 int n_node;
2403 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2404 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002405
Daniel Veillarda521d282004-11-09 14:59:59 +00002406 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002407 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2408 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002409 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002410 legacy = gen_int(n_legacy, 1);
2411
William M. Brackf13f77f2004-11-12 16:03:48 +00002412 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002413 desret_htmlStatus(ret_val);
2414 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002415 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002416 des_int(n_legacy, legacy, 1);
2417 xmlResetLastError();
2418 if (mem_base != xmlMemBlocks()) {
2419 printf("Leak of %d blocks found in htmlNodeStatus",
2420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002421 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002422 printf(" %d", n_node);
2423 printf(" %d", n_legacy);
2424 printf("\n");
2425 }
2426 }
2427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002428 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002429#endif
2430
Daniel Veillard42595322004-11-08 10:52:06 +00002431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002432}
2433
2434
2435static int
2436test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002438
Daniel Veillarda03e3652004-11-02 18:45:30 +00002439#ifdef LIBXML_HTML_ENABLED
2440 int mem_base;
2441 int ret_val;
2442 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2443 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002444
Daniel Veillarda521d282004-11-09 14:59:59 +00002445 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002446 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002447 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002448
2449 ret_val = htmlParseCharRef(ctxt);
2450 desret_int(ret_val);
2451 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002452 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002453 xmlResetLastError();
2454 if (mem_base != xmlMemBlocks()) {
2455 printf("Leak of %d blocks found in htmlParseCharRef",
2456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002457 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002458 printf(" %d", n_ctxt);
2459 printf("\n");
2460 }
2461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002462 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002463#endif
2464
Daniel Veillard42595322004-11-08 10:52:06 +00002465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002466}
2467
2468
2469static int
2470test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002472
Daniel Veillarda03e3652004-11-02 18:45:30 +00002473#ifdef LIBXML_HTML_ENABLED
2474#ifdef LIBXML_PUSH_ENABLED
2475 int mem_base;
2476 int ret_val;
2477 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2478 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002479 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002480 int n_chunk;
2481 int size; /* the size in byte of the chunk */
2482 int n_size;
2483 int terminate; /* last chunk indicator */
2484 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002485
Daniel Veillarda521d282004-11-09 14:59:59 +00002486 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002487 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2488 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2489 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2490 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002491 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002492 chunk = gen_const_char_ptr(n_chunk, 1);
2493 size = gen_int(n_size, 2);
2494 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002495
William M. Brackf13f77f2004-11-12 16:03:48 +00002496 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002497 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002498 desret_int(ret_val);
2499 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002500 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002501 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002502 des_int(n_size, size, 2);
2503 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002504 xmlResetLastError();
2505 if (mem_base != xmlMemBlocks()) {
2506 printf("Leak of %d blocks found in htmlParseChunk",
2507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002508 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002509 printf(" %d", n_ctxt);
2510 printf(" %d", n_chunk);
2511 printf(" %d", n_size);
2512 printf(" %d", n_terminate);
2513 printf("\n");
2514 }
2515 }
2516 }
2517 }
2518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002519 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002520#endif
2521#endif
2522
Daniel Veillard42595322004-11-08 10:52:06 +00002523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002524}
2525
2526
2527static int
2528test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002530
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002531#ifdef LIBXML_HTML_ENABLED
2532 int mem_base;
2533 htmlDocPtr ret_val;
2534 xmlChar * cur; /* a pointer to an array of xmlChar */
2535 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002536 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002537 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002538
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002539 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2540 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2541 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002542 cur = gen_xmlChar_ptr(n_cur, 0);
2543 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002544
William M. Brackf13f77f2004-11-12 16:03:48 +00002545 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002546 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002548 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002549 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002550 xmlResetLastError();
2551 if (mem_base != xmlMemBlocks()) {
2552 printf("Leak of %d blocks found in htmlParseDoc",
2553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002554 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002555 printf(" %d", n_cur);
2556 printf(" %d", n_encoding);
2557 printf("\n");
2558 }
2559 }
2560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002561 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002562#endif
2563
Daniel Veillard42595322004-11-08 10:52:06 +00002564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002565}
2566
2567
2568static int
2569test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002571
Daniel Veillarda03e3652004-11-02 18:45:30 +00002572#ifdef LIBXML_HTML_ENABLED
2573 int mem_base;
2574 int ret_val;
2575 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2576 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002577
Daniel Veillarda521d282004-11-09 14:59:59 +00002578 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002579 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002580 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002581
2582 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002583 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002584 desret_int(ret_val);
2585 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002586 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002587 xmlResetLastError();
2588 if (mem_base != xmlMemBlocks()) {
2589 printf("Leak of %d blocks found in htmlParseDocument",
2590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002591 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002592 printf(" %d", n_ctxt);
2593 printf("\n");
2594 }
2595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002596 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002597#endif
2598
Daniel Veillard42595322004-11-08 10:52:06 +00002599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002600}
2601
2602
2603static int
2604test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002606
Daniel Veillarda03e3652004-11-02 18:45:30 +00002607#ifdef LIBXML_HTML_ENABLED
2608 int mem_base;
2609 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2610 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002611
Daniel Veillarda521d282004-11-09 14:59:59 +00002612 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002613 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002614 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002615
2616 htmlParseElement(ctxt);
2617 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002618 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002619 xmlResetLastError();
2620 if (mem_base != xmlMemBlocks()) {
2621 printf("Leak of %d blocks found in htmlParseElement",
2622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002623 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002624 printf(" %d", n_ctxt);
2625 printf("\n");
2626 }
2627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002628 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002629#endif
2630
Daniel Veillard42595322004-11-08 10:52:06 +00002631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002632}
2633
2634
2635static int
2636test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002638
Daniel Veillard42595322004-11-08 10:52:06 +00002639#ifdef LIBXML_HTML_ENABLED
2640 int mem_base;
2641 const htmlEntityDesc * ret_val;
2642 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2643 int n_ctxt;
2644 xmlChar ** str; /* location to store the entity name */
2645 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002646
Daniel Veillarda521d282004-11-09 14:59:59 +00002647 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002648 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2649 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002650 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002651 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2652
William M. Brackf13f77f2004-11-12 16:03:48 +00002653 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002654 desret_const_htmlEntityDesc_ptr(ret_val);
2655 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002656 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002657 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002658 xmlResetLastError();
2659 if (mem_base != xmlMemBlocks()) {
2660 printf("Leak of %d blocks found in htmlParseEntityRef",
2661 xmlMemBlocks() - mem_base);
2662 test_ret++;
2663 printf(" %d", n_ctxt);
2664 printf(" %d", n_str);
2665 printf("\n");
2666 }
2667 }
2668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002669 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002670#endif
2671
Daniel Veillard42595322004-11-08 10:52:06 +00002672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002673}
2674
2675
2676static int
2677test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002679
Daniel Veillarda03e3652004-11-02 18:45:30 +00002680#ifdef LIBXML_HTML_ENABLED
2681 htmlDocPtr ret_val;
2682 const char * filename; /* the filename */
2683 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002684 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002685 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002686
Daniel Veillarda03e3652004-11-02 18:45:30 +00002687 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2688 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002689 filename = gen_filepath(n_filename, 0);
2690 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002691
William M. Brackf13f77f2004-11-12 16:03:48 +00002692 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002693 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002694 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002695 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002696 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002697 xmlResetLastError();
2698 }
2699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002700 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002701#endif
2702
Daniel Veillard42595322004-11-08 10:52:06 +00002703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002704}
2705
2706
2707static int
2708test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002710
Daniel Veillarda03e3652004-11-02 18:45:30 +00002711#ifdef LIBXML_HTML_ENABLED
2712 int mem_base;
2713 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002714 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002715 int n_cur;
2716 const char * URL; /* the base URL to use for the document */
2717 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002718 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002719 int n_encoding;
2720 int options; /* a combination of htmlParserOption(s) */
2721 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002722
Daniel Veillarda03e3652004-11-02 18:45:30 +00002723 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2724 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2725 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2726 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2727 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002728 cur = gen_const_xmlChar_ptr(n_cur, 0);
2729 URL = gen_filepath(n_URL, 1);
2730 encoding = gen_const_char_ptr(n_encoding, 2);
2731 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002732
William M. Brackf13f77f2004-11-12 16:03:48 +00002733 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002734 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002735 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002736 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002737 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002738 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002739 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002740 xmlResetLastError();
2741 if (mem_base != xmlMemBlocks()) {
2742 printf("Leak of %d blocks found in htmlReadDoc",
2743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002744 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002745 printf(" %d", n_cur);
2746 printf(" %d", n_URL);
2747 printf(" %d", n_encoding);
2748 printf(" %d", n_options);
2749 printf("\n");
2750 }
2751 }
2752 }
2753 }
2754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002755 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002756#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002757
Daniel Veillard42595322004-11-08 10:52:06 +00002758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002759}
2760
2761
2762static int
2763test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002765
Daniel Veillarda03e3652004-11-02 18:45:30 +00002766#ifdef LIBXML_HTML_ENABLED
2767 int mem_base;
2768 htmlDocPtr ret_val;
2769 const char * filename; /* a file or URL */
2770 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002771 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002772 int n_encoding;
2773 int options; /* a combination of htmlParserOption(s) */
2774 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002775
Daniel Veillarda03e3652004-11-02 18:45:30 +00002776 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2777 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2778 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2779 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002780 filename = gen_filepath(n_filename, 0);
2781 encoding = gen_const_char_ptr(n_encoding, 1);
2782 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002783
William M. Brackf13f77f2004-11-12 16:03:48 +00002784 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002785 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002787 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002788 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002789 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002790 xmlResetLastError();
2791 if (mem_base != xmlMemBlocks()) {
2792 printf("Leak of %d blocks found in htmlReadFile",
2793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002794 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002795 printf(" %d", n_filename);
2796 printf(" %d", n_encoding);
2797 printf(" %d", n_options);
2798 printf("\n");
2799 }
2800 }
2801 }
2802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002803 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002804#endif
2805
Daniel Veillard42595322004-11-08 10:52:06 +00002806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002807}
2808
2809
2810static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002811test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002813
Daniel Veillarda03e3652004-11-02 18:45:30 +00002814#ifdef LIBXML_HTML_ENABLED
2815 int mem_base;
2816 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002817 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002818 int n_buffer;
2819 int size; /* the size of the array */
2820 int n_size;
2821 const char * URL; /* the base URL to use for the document */
2822 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002823 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002824 int n_encoding;
2825 int options; /* a combination of htmlParserOption(s) */
2826 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002827
Daniel Veillarda03e3652004-11-02 18:45:30 +00002828 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2829 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2830 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2831 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2832 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2833 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002834 buffer = gen_const_char_ptr(n_buffer, 0);
2835 size = gen_int(n_size, 1);
2836 URL = gen_filepath(n_URL, 2);
2837 encoding = gen_const_char_ptr(n_encoding, 3);
2838 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002839
William M. Brackf13f77f2004-11-12 16:03:48 +00002840 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002841 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002842 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002843 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002844 des_int(n_size, size, 1);
2845 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002846 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002847 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002848 xmlResetLastError();
2849 if (mem_base != xmlMemBlocks()) {
2850 printf("Leak of %d blocks found in htmlReadMemory",
2851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002852 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002853 printf(" %d", n_buffer);
2854 printf(" %d", n_size);
2855 printf(" %d", n_URL);
2856 printf(" %d", n_encoding);
2857 printf(" %d", n_options);
2858 printf("\n");
2859 }
2860 }
2861 }
2862 }
2863 }
2864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002865 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002866#endif
2867
Daniel Veillard42595322004-11-08 10:52:06 +00002868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002869}
2870
2871
2872static int
2873test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002875
Daniel Veillardce682bc2004-11-05 17:22:25 +00002876#ifdef LIBXML_HTML_ENABLED
2877 int mem_base;
2878 htmlDocPtr ret_val;
2879 xmlChar * cur; /* a pointer to an array of xmlChar */
2880 int n_cur;
2881 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2882 int n_encoding;
2883 htmlSAXHandlerPtr sax; /* the SAX handler block */
2884 int n_sax;
2885 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2886 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002887
Daniel Veillardce682bc2004-11-05 17:22:25 +00002888 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2889 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2890 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2891 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2892 mem_base = xmlMemBlocks();
2893 cur = gen_xmlChar_ptr(n_cur, 0);
2894 encoding = gen_const_char_ptr(n_encoding, 1);
2895 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2896 userData = gen_userdata(n_userData, 3);
2897
William M. Brackf13f77f2004-11-12 16:03:48 +00002898 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002899 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002900 call_tests++;
2901 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002902 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002903 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2904 des_userdata(n_userData, userData, 3);
2905 xmlResetLastError();
2906 if (mem_base != xmlMemBlocks()) {
2907 printf("Leak of %d blocks found in htmlSAXParseDoc",
2908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002910 printf(" %d", n_cur);
2911 printf(" %d", n_encoding);
2912 printf(" %d", n_sax);
2913 printf(" %d", n_userData);
2914 printf("\n");
2915 }
2916 }
2917 }
2918 }
2919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002920 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002921#endif
2922
Daniel Veillard42595322004-11-08 10:52:06 +00002923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002924}
2925
2926
2927static int
2928test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002930
Daniel Veillardce682bc2004-11-05 17:22:25 +00002931#ifdef LIBXML_HTML_ENABLED
2932 int mem_base;
2933 htmlDocPtr ret_val;
2934 const char * filename; /* the filename */
2935 int n_filename;
2936 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2937 int n_encoding;
2938 htmlSAXHandlerPtr sax; /* the SAX handler block */
2939 int n_sax;
2940 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2941 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002942
Daniel Veillardce682bc2004-11-05 17:22:25 +00002943 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2944 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2945 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2946 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2947 mem_base = xmlMemBlocks();
2948 filename = gen_filepath(n_filename, 0);
2949 encoding = gen_const_char_ptr(n_encoding, 1);
2950 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2951 userData = gen_userdata(n_userData, 3);
2952
William M. Brackf13f77f2004-11-12 16:03:48 +00002953 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002954 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002955 call_tests++;
2956 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002957 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002958 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2959 des_userdata(n_userData, userData, 3);
2960 xmlResetLastError();
2961 if (mem_base != xmlMemBlocks()) {
2962 printf("Leak of %d blocks found in htmlSAXParseFile",
2963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002964 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002965 printf(" %d", n_filename);
2966 printf(" %d", n_encoding);
2967 printf(" %d", n_sax);
2968 printf(" %d", n_userData);
2969 printf("\n");
2970 }
2971 }
2972 }
2973 }
2974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002975 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +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_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002985
2986
2987 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002989}
2990
2991static int
2992test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002994
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002995 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002996 test_ret += test_UTF8ToHtml();
2997 test_ret += test_htmlAttrAllowed();
2998 test_ret += test_htmlAutoCloseTag();
2999 test_ret += test_htmlCreateMemoryParserCtxt();
3000 test_ret += test_htmlCreatePushParserCtxt();
3001 test_ret += test_htmlCtxtReadDoc();
3002 test_ret += test_htmlCtxtReadFile();
3003 test_ret += test_htmlCtxtReadMemory();
3004 test_ret += test_htmlCtxtReset();
3005 test_ret += test_htmlCtxtUseOptions();
3006 test_ret += test_htmlElementAllowedHere();
3007 test_ret += test_htmlElementStatusHere();
3008 test_ret += test_htmlEncodeEntities();
3009 test_ret += test_htmlEntityLookup();
3010 test_ret += test_htmlEntityValueLookup();
3011 test_ret += test_htmlHandleOmittedElem();
3012 test_ret += test_htmlIsAutoClosed();
3013 test_ret += test_htmlIsScriptAttribute();
3014 test_ret += test_htmlNodeStatus();
3015 test_ret += test_htmlParseCharRef();
3016 test_ret += test_htmlParseChunk();
3017 test_ret += test_htmlParseDoc();
3018 test_ret += test_htmlParseDocument();
3019 test_ret += test_htmlParseElement();
3020 test_ret += test_htmlParseEntityRef();
3021 test_ret += test_htmlParseFile();
3022 test_ret += test_htmlReadDoc();
3023 test_ret += test_htmlReadFile();
3024 test_ret += test_htmlReadMemory();
3025 test_ret += test_htmlSAXParseDoc();
3026 test_ret += test_htmlSAXParseFile();
3027 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003028
Daniel Veillard42595322004-11-08 10:52:06 +00003029 if (test_ret != 0)
3030 printf("Module HTMLparser: %d errors\n", test_ret);
3031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003032}
3033
3034static int
3035test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003037
Daniel Veillard3d97e662004-11-04 10:49:00 +00003038#ifdef LIBXML_HTML_ENABLED
3039#ifdef LIBXML_OUTPUT_ENABLED
3040 int mem_base;
3041 xmlOutputBufferPtr buf; /* the HTML buffer output */
3042 int n_buf;
3043 xmlDocPtr cur; /* the document */
3044 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003045 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003046 int n_encoding;
3047 int format; /* should formatting spaces been added */
3048 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003049
Daniel Veillard3d97e662004-11-04 10:49:00 +00003050 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3051 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3052 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3053 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3054 mem_base = xmlMemBlocks();
3055 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3056 cur = gen_xmlDocPtr(n_cur, 1);
3057 encoding = gen_const_char_ptr(n_encoding, 2);
3058 format = gen_int(n_format, 3);
3059
William M. Brackf13f77f2004-11-12 16:03:48 +00003060 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003061 call_tests++;
3062 des_xmlOutputBufferPtr(n_buf, buf, 0);
3063 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003064 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003065 des_int(n_format, format, 3);
3066 xmlResetLastError();
3067 if (mem_base != xmlMemBlocks()) {
3068 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
3069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003070 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003071 printf(" %d", n_buf);
3072 printf(" %d", n_cur);
3073 printf(" %d", n_encoding);
3074 printf(" %d", n_format);
3075 printf("\n");
3076 }
3077 }
3078 }
3079 }
3080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003081 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003082#endif
3083#endif
3084
Daniel Veillard42595322004-11-08 10:52:06 +00003085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003086}
3087
3088
3089static int
3090test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003092
Daniel Veillard3d97e662004-11-04 10:49:00 +00003093#ifdef LIBXML_HTML_ENABLED
3094#ifdef LIBXML_OUTPUT_ENABLED
3095 int mem_base;
3096 xmlOutputBufferPtr buf; /* the HTML buffer output */
3097 int n_buf;
3098 xmlDocPtr cur; /* the document */
3099 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003100 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003101 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003102
Daniel Veillard3d97e662004-11-04 10:49:00 +00003103 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3104 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3105 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3106 mem_base = xmlMemBlocks();
3107 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3108 cur = gen_xmlDocPtr(n_cur, 1);
3109 encoding = gen_const_char_ptr(n_encoding, 2);
3110
William M. Brackf13f77f2004-11-12 16:03:48 +00003111 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003112 call_tests++;
3113 des_xmlOutputBufferPtr(n_buf, buf, 0);
3114 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003115 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003116 xmlResetLastError();
3117 if (mem_base != xmlMemBlocks()) {
3118 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
3119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003120 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003121 printf(" %d", n_buf);
3122 printf(" %d", n_cur);
3123 printf(" %d", n_encoding);
3124 printf("\n");
3125 }
3126 }
3127 }
3128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003129 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003130#endif
3131#endif
3132
Daniel Veillard42595322004-11-08 10:52:06 +00003133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003134}
3135
3136
3137static int
3138test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003140
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003141#ifdef LIBXML_HTML_ENABLED
3142#ifdef LIBXML_OUTPUT_ENABLED
3143 int mem_base;
3144 int ret_val;
3145 FILE * f; /* the FILE* */
3146 int n_f;
3147 xmlDocPtr cur; /* the document */
3148 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003149
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003150 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
3151 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3152 mem_base = xmlMemBlocks();
3153 f = gen_FILE_ptr(n_f, 0);
3154 cur = gen_xmlDocPtr(n_cur, 1);
3155
3156 ret_val = htmlDocDump(f, cur);
3157 desret_int(ret_val);
3158 call_tests++;
3159 des_FILE_ptr(n_f, f, 0);
3160 des_xmlDocPtr(n_cur, cur, 1);
3161 xmlResetLastError();
3162 if (mem_base != xmlMemBlocks()) {
3163 printf("Leak of %d blocks found in htmlDocDump",
3164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003165 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003166 printf(" %d", n_f);
3167 printf(" %d", n_cur);
3168 printf("\n");
3169 }
3170 }
3171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003172 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003173#endif
3174#endif
3175
Daniel Veillard42595322004-11-08 10:52:06 +00003176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003177}
3178
3179
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003180#define gen_nb_xmlChar_ptr_ptr 1
3181static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3182 return(NULL);
3183}
3184static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3185}
3186
Daniel Veillardd93f6252004-11-02 15:53:51 +00003187static int
3188test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003190
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003191#ifdef LIBXML_HTML_ENABLED
3192#ifdef LIBXML_OUTPUT_ENABLED
3193 int mem_base;
3194 xmlDocPtr cur; /* the document */
3195 int n_cur;
3196 xmlChar ** mem; /* OUT: the memory pointer */
3197 int n_mem;
3198 int * size; /* OUT: the memory length */
3199 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003200
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003201 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3202 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
3203 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
3204 mem_base = xmlMemBlocks();
3205 cur = gen_xmlDocPtr(n_cur, 0);
3206 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3207 size = gen_int_ptr(n_size, 2);
3208
3209 htmlDocDumpMemory(cur, mem, size);
3210 call_tests++;
3211 des_xmlDocPtr(n_cur, cur, 0);
3212 des_xmlChar_ptr_ptr(n_mem, mem, 1);
3213 des_int_ptr(n_size, size, 2);
3214 xmlResetLastError();
3215 if (mem_base != xmlMemBlocks()) {
3216 printf("Leak of %d blocks found in htmlDocDumpMemory",
3217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003218 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003219 printf(" %d", n_cur);
3220 printf(" %d", n_mem);
3221 printf(" %d", n_size);
3222 printf("\n");
3223 }
3224 }
3225 }
3226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003227 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003228#endif
3229#endif
3230
Daniel Veillard42595322004-11-08 10:52:06 +00003231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003232}
3233
3234
3235static int
3236test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003238
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003239#ifdef LIBXML_HTML_ENABLED
3240 int mem_base;
3241 const xmlChar * ret_val;
3242 htmlDocPtr doc; /* the document */
3243 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003244
Daniel Veillarda521d282004-11-09 14:59:59 +00003245 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003246 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003247 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003248
3249 ret_val = htmlGetMetaEncoding(doc);
3250 desret_const_xmlChar_ptr(ret_val);
3251 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003252 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003253 xmlResetLastError();
3254 if (mem_base != xmlMemBlocks()) {
3255 printf("Leak of %d blocks found in htmlGetMetaEncoding",
3256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003257 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003258 printf(" %d", n_doc);
3259 printf("\n");
3260 }
3261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003262 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003263#endif
3264
Daniel Veillard42595322004-11-08 10:52:06 +00003265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003266}
3267
3268
3269static int
3270test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003272
3273#ifdef LIBXML_HTML_ENABLED
3274 int mem_base;
3275 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003276 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003277 int n_name;
3278
3279 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003281 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003282
William M. Brackf13f77f2004-11-12 16:03:48 +00003283 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003284 desret_int(ret_val);
3285 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003286 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003287 xmlResetLastError();
3288 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003289 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003291 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003292 printf(" %d", n_name);
3293 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003294 }
3295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003296 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003297#endif
3298
Daniel Veillard42595322004-11-08 10:52:06 +00003299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003300}
3301
3302
3303static int
3304test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003306
Daniel Veillarda03e3652004-11-02 18:45:30 +00003307#ifdef LIBXML_HTML_ENABLED
3308 int mem_base;
3309 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003310 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003311 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003312 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003313 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003314
Daniel Veillarda03e3652004-11-02 18:45:30 +00003315 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3316 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3317 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003318 URI = gen_const_xmlChar_ptr(n_URI, 0);
3319 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003320
William M. Brackf13f77f2004-11-12 16:03:48 +00003321 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003322 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003323 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003324 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3325 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003326 xmlResetLastError();
3327 if (mem_base != xmlMemBlocks()) {
3328 printf("Leak of %d blocks found in htmlNewDoc",
3329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003330 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003331 printf(" %d", n_URI);
3332 printf(" %d", n_ExternalID);
3333 printf("\n");
3334 }
3335 }
3336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003337 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003338#endif
3339
Daniel Veillard42595322004-11-08 10:52:06 +00003340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003341}
3342
3343
3344static int
3345test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003347
Daniel Veillarda03e3652004-11-02 18:45:30 +00003348#ifdef LIBXML_HTML_ENABLED
3349 int mem_base;
3350 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003351 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003352 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003353 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003354 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003355
Daniel Veillarda03e3652004-11-02 18:45:30 +00003356 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3357 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3358 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003359 URI = gen_const_xmlChar_ptr(n_URI, 0);
3360 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003361
William M. Brackf13f77f2004-11-12 16:03:48 +00003362 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003363 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003364 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003365 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3366 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003367 xmlResetLastError();
3368 if (mem_base != xmlMemBlocks()) {
3369 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003371 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003372 printf(" %d", n_URI);
3373 printf(" %d", n_ExternalID);
3374 printf("\n");
3375 }
3376 }
3377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003378 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003379#endif
3380
Daniel Veillard42595322004-11-08 10:52:06 +00003381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003382}
3383
3384
3385static int
3386test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003388
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003389#ifdef LIBXML_HTML_ENABLED
3390#ifdef LIBXML_OUTPUT_ENABLED
3391 int mem_base;
3392 int ret_val;
3393 xmlBufferPtr buf; /* the HTML buffer output */
3394 int n_buf;
3395 xmlDocPtr doc; /* the document */
3396 int n_doc;
3397 xmlNodePtr cur; /* the current node */
3398 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003399
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003400 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3401 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3402 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3403 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003404 buf = gen_xmlBufferPtr(n_buf, 0);
3405 doc = gen_xmlDocPtr(n_doc, 1);
3406 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003407
3408 ret_val = htmlNodeDump(buf, doc, cur);
3409 desret_int(ret_val);
3410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003411 des_xmlBufferPtr(n_buf, buf, 0);
3412 des_xmlDocPtr(n_doc, doc, 1);
3413 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003414 xmlResetLastError();
3415 if (mem_base != xmlMemBlocks()) {
3416 printf("Leak of %d blocks found in htmlNodeDump",
3417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003418 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003419 printf(" %d", n_buf);
3420 printf(" %d", n_doc);
3421 printf(" %d", n_cur);
3422 printf("\n");
3423 }
3424 }
3425 }
3426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003427 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003428#endif
3429#endif
3430
Daniel Veillard42595322004-11-08 10:52:06 +00003431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003432}
3433
3434
3435static int
3436test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003438
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003439#ifdef LIBXML_HTML_ENABLED
3440#ifdef LIBXML_OUTPUT_ENABLED
3441 int mem_base;
3442 FILE * out; /* the FILE pointer */
3443 int n_out;
3444 xmlDocPtr doc; /* the document */
3445 int n_doc;
3446 xmlNodePtr cur; /* the current node */
3447 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003448
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003449 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3450 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3451 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3452 mem_base = xmlMemBlocks();
3453 out = gen_FILE_ptr(n_out, 0);
3454 doc = gen_xmlDocPtr(n_doc, 1);
3455 cur = gen_xmlNodePtr(n_cur, 2);
3456
3457 htmlNodeDumpFile(out, doc, cur);
3458 call_tests++;
3459 des_FILE_ptr(n_out, out, 0);
3460 des_xmlDocPtr(n_doc, doc, 1);
3461 des_xmlNodePtr(n_cur, cur, 2);
3462 xmlResetLastError();
3463 if (mem_base != xmlMemBlocks()) {
3464 printf("Leak of %d blocks found in htmlNodeDumpFile",
3465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003466 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003467 printf(" %d", n_out);
3468 printf(" %d", n_doc);
3469 printf(" %d", n_cur);
3470 printf("\n");
3471 }
3472 }
3473 }
3474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003475 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003476#endif
3477#endif
3478
Daniel Veillard42595322004-11-08 10:52:06 +00003479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003480}
3481
3482
3483static int
3484test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003486
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003487#ifdef LIBXML_HTML_ENABLED
3488#ifdef LIBXML_OUTPUT_ENABLED
3489 int mem_base;
3490 int ret_val;
3491 FILE * out; /* the FILE pointer */
3492 int n_out;
3493 xmlDocPtr doc; /* the document */
3494 int n_doc;
3495 xmlNodePtr cur; /* the current node */
3496 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003497 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003498 int n_encoding;
3499 int format; /* should formatting spaces been added */
3500 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003501
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003502 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3503 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3504 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3505 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3506 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3507 mem_base = xmlMemBlocks();
3508 out = gen_FILE_ptr(n_out, 0);
3509 doc = gen_xmlDocPtr(n_doc, 1);
3510 cur = gen_xmlNodePtr(n_cur, 2);
3511 encoding = gen_const_char_ptr(n_encoding, 3);
3512 format = gen_int(n_format, 4);
3513
William M. Brackf13f77f2004-11-12 16:03:48 +00003514 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003515 desret_int(ret_val);
3516 call_tests++;
3517 des_FILE_ptr(n_out, out, 0);
3518 des_xmlDocPtr(n_doc, doc, 1);
3519 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003520 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003521 des_int(n_format, format, 4);
3522 xmlResetLastError();
3523 if (mem_base != xmlMemBlocks()) {
3524 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003526 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003527 printf(" %d", n_out);
3528 printf(" %d", n_doc);
3529 printf(" %d", n_cur);
3530 printf(" %d", n_encoding);
3531 printf(" %d", n_format);
3532 printf("\n");
3533 }
3534 }
3535 }
3536 }
3537 }
3538 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003539 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003540#endif
3541#endif
3542
Daniel Veillard42595322004-11-08 10:52:06 +00003543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003544}
3545
3546
3547static int
3548test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003550
Daniel Veillard3d97e662004-11-04 10:49:00 +00003551#ifdef LIBXML_HTML_ENABLED
3552#ifdef LIBXML_OUTPUT_ENABLED
3553 int mem_base;
3554 xmlOutputBufferPtr buf; /* the HTML buffer output */
3555 int n_buf;
3556 xmlDocPtr doc; /* the document */
3557 int n_doc;
3558 xmlNodePtr cur; /* the current node */
3559 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003560 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003561 int n_encoding;
3562 int format; /* should formatting spaces been added */
3563 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003564
Daniel Veillard3d97e662004-11-04 10:49:00 +00003565 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3566 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3567 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3568 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3569 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3570 mem_base = xmlMemBlocks();
3571 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3572 doc = gen_xmlDocPtr(n_doc, 1);
3573 cur = gen_xmlNodePtr(n_cur, 2);
3574 encoding = gen_const_char_ptr(n_encoding, 3);
3575 format = gen_int(n_format, 4);
3576
William M. Brackf13f77f2004-11-12 16:03:48 +00003577 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003578 call_tests++;
3579 des_xmlOutputBufferPtr(n_buf, buf, 0);
3580 des_xmlDocPtr(n_doc, doc, 1);
3581 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003582 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003583 des_int(n_format, format, 4);
3584 xmlResetLastError();
3585 if (mem_base != xmlMemBlocks()) {
3586 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003588 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003589 printf(" %d", n_buf);
3590 printf(" %d", n_doc);
3591 printf(" %d", n_cur);
3592 printf(" %d", n_encoding);
3593 printf(" %d", n_format);
3594 printf("\n");
3595 }
3596 }
3597 }
3598 }
3599 }
3600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003601 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003602#endif
3603#endif
3604
Daniel Veillard42595322004-11-08 10:52:06 +00003605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003606}
3607
3608
3609static int
3610test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003612
Daniel Veillard3d97e662004-11-04 10:49:00 +00003613#ifdef LIBXML_HTML_ENABLED
3614#ifdef LIBXML_OUTPUT_ENABLED
3615 int mem_base;
3616 xmlOutputBufferPtr buf; /* the HTML buffer output */
3617 int n_buf;
3618 xmlDocPtr doc; /* the document */
3619 int n_doc;
3620 xmlNodePtr cur; /* the current node */
3621 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003622 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003623 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003624
Daniel Veillard3d97e662004-11-04 10:49:00 +00003625 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3626 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3627 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3628 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3629 mem_base = xmlMemBlocks();
3630 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3631 doc = gen_xmlDocPtr(n_doc, 1);
3632 cur = gen_xmlNodePtr(n_cur, 2);
3633 encoding = gen_const_char_ptr(n_encoding, 3);
3634
William M. Brackf13f77f2004-11-12 16:03:48 +00003635 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003636 call_tests++;
3637 des_xmlOutputBufferPtr(n_buf, buf, 0);
3638 des_xmlDocPtr(n_doc, doc, 1);
3639 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003640 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003641 xmlResetLastError();
3642 if (mem_base != xmlMemBlocks()) {
3643 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003645 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003646 printf(" %d", n_buf);
3647 printf(" %d", n_doc);
3648 printf(" %d", n_cur);
3649 printf(" %d", n_encoding);
3650 printf("\n");
3651 }
3652 }
3653 }
3654 }
3655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003656 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003657#endif
3658#endif
3659
Daniel Veillard42595322004-11-08 10:52:06 +00003660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003661}
3662
3663
3664static int
3665test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003667
3668#ifdef LIBXML_HTML_ENABLED
3669#ifdef LIBXML_OUTPUT_ENABLED
3670 int mem_base;
3671 int ret_val;
3672 const char * filename; /* the filename (or URL) */
3673 int n_filename;
3674 xmlDocPtr cur; /* the document */
3675 int n_cur;
3676
3677 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3678 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3679 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003680 filename = gen_fileoutput(n_filename, 0);
3681 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003682
3683 ret_val = htmlSaveFile(filename, cur);
3684 desret_int(ret_val);
3685 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003686 des_fileoutput(n_filename, filename, 0);
3687 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003688 xmlResetLastError();
3689 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003690 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003692 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003693 printf(" %d", n_filename);
3694 printf(" %d", n_cur);
3695 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003696 }
3697 }
3698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003699 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003700#endif
3701#endif
3702
Daniel Veillard42595322004-11-08 10:52:06 +00003703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003704}
3705
3706
3707static int
3708test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003710
3711#ifdef LIBXML_HTML_ENABLED
3712#ifdef LIBXML_OUTPUT_ENABLED
3713 int mem_base;
3714 int ret_val;
3715 const char * filename; /* the filename */
3716 int n_filename;
3717 xmlDocPtr cur; /* the document */
3718 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003719 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003720 int n_encoding;
3721
3722 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3723 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3724 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3725 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003726 filename = gen_fileoutput(n_filename, 0);
3727 cur = gen_xmlDocPtr(n_cur, 1);
3728 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003729
William M. Brackf13f77f2004-11-12 16:03:48 +00003730 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003731 desret_int(ret_val);
3732 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003733 des_fileoutput(n_filename, filename, 0);
3734 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003735 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003736 xmlResetLastError();
3737 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003738 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003740 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003741 printf(" %d", n_filename);
3742 printf(" %d", n_cur);
3743 printf(" %d", n_encoding);
3744 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003745 }
3746 }
3747 }
3748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003749 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003750#endif
3751#endif
3752
Daniel Veillard42595322004-11-08 10:52:06 +00003753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003754}
3755
3756
3757static int
3758test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003760
3761#ifdef LIBXML_HTML_ENABLED
3762#ifdef LIBXML_OUTPUT_ENABLED
3763 int mem_base;
3764 int ret_val;
3765 const char * filename; /* the filename */
3766 int n_filename;
3767 xmlDocPtr cur; /* the document */
3768 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003769 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003770 int n_encoding;
3771 int format; /* should formatting spaces been added */
3772 int n_format;
3773
3774 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3775 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3776 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3777 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3778 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003779 filename = gen_fileoutput(n_filename, 0);
3780 cur = gen_xmlDocPtr(n_cur, 1);
3781 encoding = gen_const_char_ptr(n_encoding, 2);
3782 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003783
William M. Brackf13f77f2004-11-12 16:03:48 +00003784 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003785 desret_int(ret_val);
3786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003787 des_fileoutput(n_filename, filename, 0);
3788 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003789 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003790 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003791 xmlResetLastError();
3792 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003793 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003795 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003796 printf(" %d", n_filename);
3797 printf(" %d", n_cur);
3798 printf(" %d", n_encoding);
3799 printf(" %d", n_format);
3800 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003801 }
3802 }
3803 }
3804 }
3805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003806 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003807#endif
3808#endif
3809
Daniel Veillard42595322004-11-08 10:52:06 +00003810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003811}
3812
3813
3814static int
3815test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003817
Daniel Veillarda03e3652004-11-02 18:45:30 +00003818#ifdef LIBXML_HTML_ENABLED
3819 int mem_base;
3820 int ret_val;
3821 htmlDocPtr doc; /* the document */
3822 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003823 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003824 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003825
Daniel Veillarda521d282004-11-09 14:59:59 +00003826 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003827 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3828 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003829 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003830 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003831
William M. Brackf13f77f2004-11-12 16:03:48 +00003832 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003833 desret_int(ret_val);
3834 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003835 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003836 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003837 xmlResetLastError();
3838 if (mem_base != xmlMemBlocks()) {
3839 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003841 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003842 printf(" %d", n_doc);
3843 printf(" %d", n_encoding);
3844 printf("\n");
3845 }
3846 }
3847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003848 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003849#endif
3850
Daniel Veillard42595322004-11-08 10:52:06 +00003851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003852}
3853
3854static int
3855test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003857
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003858 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003859 test_ret += test_htmlDocContentDumpFormatOutput();
3860 test_ret += test_htmlDocContentDumpOutput();
3861 test_ret += test_htmlDocDump();
3862 test_ret += test_htmlDocDumpMemory();
3863 test_ret += test_htmlGetMetaEncoding();
3864 test_ret += test_htmlIsBooleanAttr();
3865 test_ret += test_htmlNewDoc();
3866 test_ret += test_htmlNewDocNoDtD();
3867 test_ret += test_htmlNodeDump();
3868 test_ret += test_htmlNodeDumpFile();
3869 test_ret += test_htmlNodeDumpFileFormat();
3870 test_ret += test_htmlNodeDumpFormatOutput();
3871 test_ret += test_htmlNodeDumpOutput();
3872 test_ret += test_htmlSaveFile();
3873 test_ret += test_htmlSaveFileEnc();
3874 test_ret += test_htmlSaveFileFormat();
3875 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003876
Daniel Veillard42595322004-11-08 10:52:06 +00003877 if (test_ret != 0)
3878 printf("Module HTMLtree: %d errors\n", test_ret);
3879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003880}
3881
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003882static int
3883test_docbDefaultSAXHandlerInit(void) {
3884 int test_ret = 0;
3885
Daniel Veillarda521d282004-11-09 14:59:59 +00003886#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003887 int mem_base;
3888
3889 mem_base = xmlMemBlocks();
3890
3891 docbDefaultSAXHandlerInit();
3892 call_tests++;
3893 xmlResetLastError();
3894 if (mem_base != xmlMemBlocks()) {
3895 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3896 xmlMemBlocks() - mem_base);
3897 test_ret++;
3898 printf("\n");
3899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003900 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +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_htmlDefaultSAXHandlerInit(void) {
3909 int test_ret = 0;
3910
Daniel Veillarda521d282004-11-09 14:59:59 +00003911#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003912 int mem_base;
3913
3914 mem_base = xmlMemBlocks();
3915
3916 htmlDefaultSAXHandlerInit();
3917 call_tests++;
3918 xmlResetLastError();
3919 if (mem_base != xmlMemBlocks()) {
3920 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3921 xmlMemBlocks() - mem_base);
3922 test_ret++;
3923 printf("\n");
3924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003925 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003926#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003927
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003928 return(test_ret);
3929}
3930
3931
3932static int
3933test_xmlDefaultSAXHandlerInit(void) {
3934 int test_ret = 0;
3935
3936 int mem_base;
3937
3938 mem_base = xmlMemBlocks();
3939
3940 xmlDefaultSAXHandlerInit();
3941 call_tests++;
3942 xmlResetLastError();
3943 if (mem_base != xmlMemBlocks()) {
3944 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3945 xmlMemBlocks() - mem_base);
3946 test_ret++;
3947 printf("\n");
3948 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003950
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003951 return(test_ret);
3952}
3953
3954
3955#define gen_nb_xmlEnumerationPtr 1
3956static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3957 return(NULL);
3958}
3959static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3960}
3961
3962static int
3963test_xmlSAX2AttributeDecl(void) {
3964 int test_ret = 0;
3965
3966 int mem_base;
3967 void * ctx; /* the user data (XML parser context) */
3968 int n_ctx;
3969 xmlChar * elem; /* the name of the element */
3970 int n_elem;
3971 xmlChar * fullname; /* the attribute name */
3972 int n_fullname;
3973 int type; /* the attribute type */
3974 int n_type;
3975 int def; /* the type of default value */
3976 int n_def;
3977 xmlChar * defaultValue; /* the attribute default value */
3978 int n_defaultValue;
3979 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3980 int n_tree;
3981
3982 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3983 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3984 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3985 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3986 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3987 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3988 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3989 mem_base = xmlMemBlocks();
3990 ctx = gen_void_ptr(n_ctx, 0);
3991 elem = gen_const_xmlChar_ptr(n_elem, 1);
3992 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3993 type = gen_int(n_type, 3);
3994 def = gen_int(n_def, 4);
3995 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3996 tree = gen_xmlEnumerationPtr(n_tree, 6);
3997
William M. Brackf13f77f2004-11-12 16:03:48 +00003998 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003999 call_tests++;
4000 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004001 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
4002 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004003 des_int(n_type, type, 3);
4004 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004005 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004006 des_xmlEnumerationPtr(n_tree, tree, 6);
4007 xmlResetLastError();
4008 if (mem_base != xmlMemBlocks()) {
4009 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
4010 xmlMemBlocks() - mem_base);
4011 test_ret++;
4012 printf(" %d", n_ctx);
4013 printf(" %d", n_elem);
4014 printf(" %d", n_fullname);
4015 printf(" %d", n_type);
4016 printf(" %d", n_def);
4017 printf(" %d", n_defaultValue);
4018 printf(" %d", n_tree);
4019 printf("\n");
4020 }
4021 }
4022 }
4023 }
4024 }
4025 }
4026 }
4027 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004029
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004030 return(test_ret);
4031}
4032
4033
4034static int
4035test_xmlSAX2CDataBlock(void) {
4036 int test_ret = 0;
4037
4038 int mem_base;
4039 void * ctx; /* the user data (XML parser context) */
4040 int n_ctx;
4041 xmlChar * value; /* The pcdata content */
4042 int n_value;
4043 int len; /* the block length */
4044 int n_len;
4045
4046 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4047 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
4048 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4049 mem_base = xmlMemBlocks();
4050 ctx = gen_void_ptr(n_ctx, 0);
4051 value = gen_const_xmlChar_ptr(n_value, 1);
4052 len = gen_int(n_len, 2);
4053
William M. Brackf13f77f2004-11-12 16:03:48 +00004054 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004055 call_tests++;
4056 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004057 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004058 des_int(n_len, len, 2);
4059 xmlResetLastError();
4060 if (mem_base != xmlMemBlocks()) {
4061 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
4062 xmlMemBlocks() - mem_base);
4063 test_ret++;
4064 printf(" %d", n_ctx);
4065 printf(" %d", n_value);
4066 printf(" %d", n_len);
4067 printf("\n");
4068 }
4069 }
4070 }
4071 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004072 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004073
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004074 return(test_ret);
4075}
4076
4077
4078static int
4079test_xmlSAX2Characters(void) {
4080 int test_ret = 0;
4081
4082 int mem_base;
4083 void * ctx; /* the user data (XML parser context) */
4084 int n_ctx;
4085 xmlChar * ch; /* a xmlChar string */
4086 int n_ch;
4087 int len; /* the number of xmlChar */
4088 int n_len;
4089
4090 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4091 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4092 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4093 mem_base = xmlMemBlocks();
4094 ctx = gen_void_ptr(n_ctx, 0);
4095 ch = gen_const_xmlChar_ptr(n_ch, 1);
4096 len = gen_int(n_len, 2);
4097
William M. Brackf13f77f2004-11-12 16:03:48 +00004098 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004099 call_tests++;
4100 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004101 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004102 des_int(n_len, len, 2);
4103 xmlResetLastError();
4104 if (mem_base != xmlMemBlocks()) {
4105 printf("Leak of %d blocks found in xmlSAX2Characters",
4106 xmlMemBlocks() - mem_base);
4107 test_ret++;
4108 printf(" %d", n_ctx);
4109 printf(" %d", n_ch);
4110 printf(" %d", n_len);
4111 printf("\n");
4112 }
4113 }
4114 }
4115 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004116 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004117
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004118 return(test_ret);
4119}
4120
4121
4122static int
4123test_xmlSAX2Comment(void) {
4124 int test_ret = 0;
4125
4126 int mem_base;
4127 void * ctx; /* the user data (XML parser context) */
4128 int n_ctx;
4129 xmlChar * value; /* the xmlSAX2Comment content */
4130 int n_value;
4131
4132 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4133 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
4134 mem_base = xmlMemBlocks();
4135 ctx = gen_void_ptr(n_ctx, 0);
4136 value = gen_const_xmlChar_ptr(n_value, 1);
4137
William M. Brackf13f77f2004-11-12 16:03:48 +00004138 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004139 call_tests++;
4140 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004141 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004142 xmlResetLastError();
4143 if (mem_base != xmlMemBlocks()) {
4144 printf("Leak of %d blocks found in xmlSAX2Comment",
4145 xmlMemBlocks() - mem_base);
4146 test_ret++;
4147 printf(" %d", n_ctx);
4148 printf(" %d", n_value);
4149 printf("\n");
4150 }
4151 }
4152 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004153 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004154
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004155 return(test_ret);
4156}
4157
4158
4159#define gen_nb_xmlElementContentPtr 1
4160static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4161 return(NULL);
4162}
4163static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4164}
4165
4166static int
4167test_xmlSAX2ElementDecl(void) {
4168 int test_ret = 0;
4169
4170 int mem_base;
4171 void * ctx; /* the user data (XML parser context) */
4172 int n_ctx;
4173 xmlChar * name; /* the element name */
4174 int n_name;
4175 int type; /* the element type */
4176 int n_type;
4177 xmlElementContentPtr content; /* the element value tree */
4178 int n_content;
4179
4180 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4181 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4182 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4183 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
4184 mem_base = xmlMemBlocks();
4185 ctx = gen_void_ptr(n_ctx, 0);
4186 name = gen_const_xmlChar_ptr(n_name, 1);
4187 type = gen_int(n_type, 2);
4188 content = gen_xmlElementContentPtr(n_content, 3);
4189
William M. Brackf13f77f2004-11-12 16:03:48 +00004190 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004191 call_tests++;
4192 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004193 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004194 des_int(n_type, type, 2);
4195 des_xmlElementContentPtr(n_content, content, 3);
4196 xmlResetLastError();
4197 if (mem_base != xmlMemBlocks()) {
4198 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
4199 xmlMemBlocks() - mem_base);
4200 test_ret++;
4201 printf(" %d", n_ctx);
4202 printf(" %d", n_name);
4203 printf(" %d", n_type);
4204 printf(" %d", n_content);
4205 printf("\n");
4206 }
4207 }
4208 }
4209 }
4210 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004211 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004212
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004213 return(test_ret);
4214}
4215
4216
4217static int
4218test_xmlSAX2EndDocument(void) {
4219 int test_ret = 0;
4220
4221 int mem_base;
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 xmlSAX2EndDocument(ctx);
4230 call_tests++;
4231 des_void_ptr(n_ctx, ctx, 0);
4232 xmlResetLastError();
4233 if (mem_base != xmlMemBlocks()) {
4234 printf("Leak of %d blocks found in xmlSAX2EndDocument",
4235 xmlMemBlocks() - mem_base);
4236 test_ret++;
4237 printf(" %d", n_ctx);
4238 printf("\n");
4239 }
4240 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004241 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004242
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004243 return(test_ret);
4244}
4245
4246
4247static int
4248test_xmlSAX2EndElement(void) {
4249 int test_ret = 0;
4250
Daniel Veillarda521d282004-11-09 14:59:59 +00004251#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004252 int mem_base;
4253 void * ctx; /* the user data (XML parser context) */
4254 int n_ctx;
4255 xmlChar * name; /* The element name */
4256 int n_name;
4257
4258 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4259 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4260 mem_base = xmlMemBlocks();
4261 ctx = gen_void_ptr(n_ctx, 0);
4262 name = gen_const_xmlChar_ptr(n_name, 1);
4263
William M. Brackf13f77f2004-11-12 16:03:48 +00004264 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004265 call_tests++;
4266 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004267 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004268 xmlResetLastError();
4269 if (mem_base != xmlMemBlocks()) {
4270 printf("Leak of %d blocks found in xmlSAX2EndElement",
4271 xmlMemBlocks() - mem_base);
4272 test_ret++;
4273 printf(" %d", n_ctx);
4274 printf(" %d", n_name);
4275 printf("\n");
4276 }
4277 }
4278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004279 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004280#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004281
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004282 return(test_ret);
4283}
4284
4285
4286static int
4287test_xmlSAX2EndElementNs(void) {
4288 int test_ret = 0;
4289
4290 int mem_base;
4291 void * ctx; /* the user data (XML parser context) */
4292 int n_ctx;
4293 xmlChar * localname; /* the local name of the element */
4294 int n_localname;
4295 xmlChar * prefix; /* the element namespace prefix if available */
4296 int n_prefix;
4297 xmlChar * URI; /* the element namespace name if available */
4298 int n_URI;
4299
4300 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4301 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4302 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4303 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4304 mem_base = xmlMemBlocks();
4305 ctx = gen_void_ptr(n_ctx, 0);
4306 localname = gen_const_xmlChar_ptr(n_localname, 1);
4307 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4308 URI = gen_const_xmlChar_ptr(n_URI, 3);
4309
William M. Brackf13f77f2004-11-12 16:03:48 +00004310 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004311 call_tests++;
4312 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004313 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4314 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4315 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004316 xmlResetLastError();
4317 if (mem_base != xmlMemBlocks()) {
4318 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
4319 xmlMemBlocks() - mem_base);
4320 test_ret++;
4321 printf(" %d", n_ctx);
4322 printf(" %d", n_localname);
4323 printf(" %d", n_prefix);
4324 printf(" %d", n_URI);
4325 printf("\n");
4326 }
4327 }
4328 }
4329 }
4330 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004331 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004332
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004333 return(test_ret);
4334}
4335
4336
4337static int
4338test_xmlSAX2EntityDecl(void) {
4339 int test_ret = 0;
4340
4341 int mem_base;
4342 void * ctx; /* the user data (XML parser context) */
4343 int n_ctx;
4344 xmlChar * name; /* the entity name */
4345 int n_name;
4346 int type; /* the entity type */
4347 int n_type;
4348 xmlChar * publicId; /* The public ID of the entity */
4349 int n_publicId;
4350 xmlChar * systemId; /* The system ID of the entity */
4351 int n_systemId;
4352 xmlChar * content; /* the entity value (without processing). */
4353 int n_content;
4354
4355 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4356 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4357 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4358 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4359 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4360 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4361 mem_base = xmlMemBlocks();
4362 ctx = gen_void_ptr(n_ctx, 0);
4363 name = gen_const_xmlChar_ptr(n_name, 1);
4364 type = gen_int(n_type, 2);
4365 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4366 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4367 content = gen_xmlChar_ptr(n_content, 5);
4368
William M. Brackf13f77f2004-11-12 16:03:48 +00004369 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004370 call_tests++;
4371 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004372 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004373 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004374 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4375 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004376 des_xmlChar_ptr(n_content, content, 5);
4377 xmlResetLastError();
4378 if (mem_base != xmlMemBlocks()) {
4379 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4380 xmlMemBlocks() - mem_base);
4381 test_ret++;
4382 printf(" %d", n_ctx);
4383 printf(" %d", n_name);
4384 printf(" %d", n_type);
4385 printf(" %d", n_publicId);
4386 printf(" %d", n_systemId);
4387 printf(" %d", n_content);
4388 printf("\n");
4389 }
4390 }
4391 }
4392 }
4393 }
4394 }
4395 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004396 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004397
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004398 return(test_ret);
4399}
4400
4401
4402static int
4403test_xmlSAX2ExternalSubset(void) {
4404 int test_ret = 0;
4405
4406 int mem_base;
4407 void * ctx; /* the user data (XML parser context) */
4408 int n_ctx;
4409 xmlChar * name; /* the root element name */
4410 int n_name;
4411 xmlChar * ExternalID; /* the external ID */
4412 int n_ExternalID;
4413 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4414 int n_SystemID;
4415
4416 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4417 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4418 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4419 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4420 mem_base = xmlMemBlocks();
4421 ctx = gen_void_ptr(n_ctx, 0);
4422 name = gen_const_xmlChar_ptr(n_name, 1);
4423 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4424 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4425
William M. Brackf13f77f2004-11-12 16:03:48 +00004426 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004427 call_tests++;
4428 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004429 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4430 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4431 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004432 xmlResetLastError();
4433 if (mem_base != xmlMemBlocks()) {
4434 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4435 xmlMemBlocks() - mem_base);
4436 test_ret++;
4437 printf(" %d", n_ctx);
4438 printf(" %d", n_name);
4439 printf(" %d", n_ExternalID);
4440 printf(" %d", n_SystemID);
4441 printf("\n");
4442 }
4443 }
4444 }
4445 }
4446 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004448
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004449 return(test_ret);
4450}
4451
4452
4453static int
4454test_xmlSAX2GetColumnNumber(void) {
4455 int test_ret = 0;
4456
4457 int mem_base;
4458 int ret_val;
4459 void * ctx; /* the user data (XML parser context) */
4460 int n_ctx;
4461
4462 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4463 mem_base = xmlMemBlocks();
4464 ctx = gen_void_ptr(n_ctx, 0);
4465
4466 ret_val = xmlSAX2GetColumnNumber(ctx);
4467 desret_int(ret_val);
4468 call_tests++;
4469 des_void_ptr(n_ctx, ctx, 0);
4470 xmlResetLastError();
4471 if (mem_base != xmlMemBlocks()) {
4472 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4473 xmlMemBlocks() - mem_base);
4474 test_ret++;
4475 printf(" %d", n_ctx);
4476 printf("\n");
4477 }
4478 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004479 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004480
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004481 return(test_ret);
4482}
4483
4484
4485static int
4486test_xmlSAX2GetEntity(void) {
4487 int test_ret = 0;
4488
4489 int mem_base;
4490 xmlEntityPtr ret_val;
4491 void * ctx; /* the user data (XML parser context) */
4492 int n_ctx;
4493 xmlChar * name; /* The entity name */
4494 int n_name;
4495
4496 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4497 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4498 mem_base = xmlMemBlocks();
4499 ctx = gen_void_ptr(n_ctx, 0);
4500 name = gen_const_xmlChar_ptr(n_name, 1);
4501
William M. Brackf13f77f2004-11-12 16:03:48 +00004502 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004503 desret_xmlEntityPtr(ret_val);
4504 call_tests++;
4505 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004506 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004507 xmlResetLastError();
4508 if (mem_base != xmlMemBlocks()) {
4509 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4510 xmlMemBlocks() - mem_base);
4511 test_ret++;
4512 printf(" %d", n_ctx);
4513 printf(" %d", n_name);
4514 printf("\n");
4515 }
4516 }
4517 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004518 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004519
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004520 return(test_ret);
4521}
4522
4523
4524static int
4525test_xmlSAX2GetLineNumber(void) {
4526 int test_ret = 0;
4527
4528 int mem_base;
4529 int ret_val;
4530 void * ctx; /* the user data (XML parser context) */
4531 int n_ctx;
4532
4533 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4534 mem_base = xmlMemBlocks();
4535 ctx = gen_void_ptr(n_ctx, 0);
4536
4537 ret_val = xmlSAX2GetLineNumber(ctx);
4538 desret_int(ret_val);
4539 call_tests++;
4540 des_void_ptr(n_ctx, ctx, 0);
4541 xmlResetLastError();
4542 if (mem_base != xmlMemBlocks()) {
4543 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4544 xmlMemBlocks() - mem_base);
4545 test_ret++;
4546 printf(" %d", n_ctx);
4547 printf("\n");
4548 }
4549 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004550 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004551
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004552 return(test_ret);
4553}
4554
4555
4556static int
4557test_xmlSAX2GetParameterEntity(void) {
4558 int test_ret = 0;
4559
4560 int mem_base;
4561 xmlEntityPtr ret_val;
4562 void * ctx; /* the user data (XML parser context) */
4563 int n_ctx;
4564 xmlChar * name; /* The entity name */
4565 int n_name;
4566
4567 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4568 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4569 mem_base = xmlMemBlocks();
4570 ctx = gen_void_ptr(n_ctx, 0);
4571 name = gen_const_xmlChar_ptr(n_name, 1);
4572
William M. Brackf13f77f2004-11-12 16:03:48 +00004573 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004574 desret_xmlEntityPtr(ret_val);
4575 call_tests++;
4576 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004577 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004578 xmlResetLastError();
4579 if (mem_base != xmlMemBlocks()) {
4580 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4581 xmlMemBlocks() - mem_base);
4582 test_ret++;
4583 printf(" %d", n_ctx);
4584 printf(" %d", n_name);
4585 printf("\n");
4586 }
4587 }
4588 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004589 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004590
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004591 return(test_ret);
4592}
4593
4594
4595static int
4596test_xmlSAX2GetPublicId(void) {
4597 int test_ret = 0;
4598
4599 int mem_base;
4600 const xmlChar * ret_val;
4601 void * ctx; /* the user data (XML parser context) */
4602 int n_ctx;
4603
4604 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4605 mem_base = xmlMemBlocks();
4606 ctx = gen_void_ptr(n_ctx, 0);
4607
4608 ret_val = xmlSAX2GetPublicId(ctx);
4609 desret_const_xmlChar_ptr(ret_val);
4610 call_tests++;
4611 des_void_ptr(n_ctx, ctx, 0);
4612 xmlResetLastError();
4613 if (mem_base != xmlMemBlocks()) {
4614 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4615 xmlMemBlocks() - mem_base);
4616 test_ret++;
4617 printf(" %d", n_ctx);
4618 printf("\n");
4619 }
4620 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004621 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004622
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004623 return(test_ret);
4624}
4625
4626
4627static int
4628test_xmlSAX2GetSystemId(void) {
4629 int test_ret = 0;
4630
4631 int mem_base;
4632 const xmlChar * ret_val;
4633 void * ctx; /* the user data (XML parser context) */
4634 int n_ctx;
4635
4636 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4637 mem_base = xmlMemBlocks();
4638 ctx = gen_void_ptr(n_ctx, 0);
4639
4640 ret_val = xmlSAX2GetSystemId(ctx);
4641 desret_const_xmlChar_ptr(ret_val);
4642 call_tests++;
4643 des_void_ptr(n_ctx, ctx, 0);
4644 xmlResetLastError();
4645 if (mem_base != xmlMemBlocks()) {
4646 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4647 xmlMemBlocks() - mem_base);
4648 test_ret++;
4649 printf(" %d", n_ctx);
4650 printf("\n");
4651 }
4652 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004653 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004654
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004655 return(test_ret);
4656}
4657
4658
4659static int
4660test_xmlSAX2HasExternalSubset(void) {
4661 int test_ret = 0;
4662
4663 int mem_base;
4664 int ret_val;
4665 void * ctx; /* the user data (XML parser context) */
4666 int n_ctx;
4667
4668 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4669 mem_base = xmlMemBlocks();
4670 ctx = gen_void_ptr(n_ctx, 0);
4671
4672 ret_val = xmlSAX2HasExternalSubset(ctx);
4673 desret_int(ret_val);
4674 call_tests++;
4675 des_void_ptr(n_ctx, ctx, 0);
4676 xmlResetLastError();
4677 if (mem_base != xmlMemBlocks()) {
4678 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4679 xmlMemBlocks() - mem_base);
4680 test_ret++;
4681 printf(" %d", n_ctx);
4682 printf("\n");
4683 }
4684 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004685 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004686
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004687 return(test_ret);
4688}
4689
4690
4691static int
4692test_xmlSAX2HasInternalSubset(void) {
4693 int test_ret = 0;
4694
4695 int mem_base;
4696 int ret_val;
4697 void * ctx; /* the user data (XML parser context) */
4698 int n_ctx;
4699
4700 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4701 mem_base = xmlMemBlocks();
4702 ctx = gen_void_ptr(n_ctx, 0);
4703
4704 ret_val = xmlSAX2HasInternalSubset(ctx);
4705 desret_int(ret_val);
4706 call_tests++;
4707 des_void_ptr(n_ctx, ctx, 0);
4708 xmlResetLastError();
4709 if (mem_base != xmlMemBlocks()) {
4710 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4711 xmlMemBlocks() - mem_base);
4712 test_ret++;
4713 printf(" %d", n_ctx);
4714 printf("\n");
4715 }
4716 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004717 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004718
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004719 return(test_ret);
4720}
4721
4722
4723static int
4724test_xmlSAX2IgnorableWhitespace(void) {
4725 int test_ret = 0;
4726
4727 int mem_base;
4728 void * ctx; /* the user data (XML parser context) */
4729 int n_ctx;
4730 xmlChar * ch; /* a xmlChar string */
4731 int n_ch;
4732 int len; /* the number of xmlChar */
4733 int n_len;
4734
4735 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4736 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4737 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4738 mem_base = xmlMemBlocks();
4739 ctx = gen_void_ptr(n_ctx, 0);
4740 ch = gen_const_xmlChar_ptr(n_ch, 1);
4741 len = gen_int(n_len, 2);
4742
William M. Brackf13f77f2004-11-12 16:03:48 +00004743 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004744 call_tests++;
4745 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004746 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004747 des_int(n_len, len, 2);
4748 xmlResetLastError();
4749 if (mem_base != xmlMemBlocks()) {
4750 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4751 xmlMemBlocks() - mem_base);
4752 test_ret++;
4753 printf(" %d", n_ctx);
4754 printf(" %d", n_ch);
4755 printf(" %d", n_len);
4756 printf("\n");
4757 }
4758 }
4759 }
4760 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004761 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004762
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004763 return(test_ret);
4764}
4765
4766
4767#define gen_nb_xmlSAXHandler_ptr 1
4768static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4769 return(NULL);
4770}
4771static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4772}
4773
4774static int
4775test_xmlSAX2InitDefaultSAXHandler(void) {
4776 int test_ret = 0;
4777
4778 int mem_base;
4779 xmlSAXHandler * hdlr; /* the SAX handler */
4780 int n_hdlr;
4781 int warning; /* flag if non-zero sets the handler warning procedure */
4782 int n_warning;
4783
4784 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4785 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4786 mem_base = xmlMemBlocks();
4787 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4788 warning = gen_int(n_warning, 1);
4789
4790 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4791 call_tests++;
4792 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4793 des_int(n_warning, warning, 1);
4794 xmlResetLastError();
4795 if (mem_base != xmlMemBlocks()) {
4796 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4797 xmlMemBlocks() - mem_base);
4798 test_ret++;
4799 printf(" %d", n_hdlr);
4800 printf(" %d", n_warning);
4801 printf("\n");
4802 }
4803 }
4804 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004805 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004806
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004807 return(test_ret);
4808}
4809
4810
4811static int
4812test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4813 int test_ret = 0;
4814
4815#ifdef LIBXML_DOCB_ENABLED
4816 int mem_base;
4817 xmlSAXHandler * hdlr; /* the SAX handler */
4818 int n_hdlr;
4819
4820 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4821 mem_base = xmlMemBlocks();
4822 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4823
4824 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4825 call_tests++;
4826 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4827 xmlResetLastError();
4828 if (mem_base != xmlMemBlocks()) {
4829 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4830 xmlMemBlocks() - mem_base);
4831 test_ret++;
4832 printf(" %d", n_hdlr);
4833 printf("\n");
4834 }
4835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004836 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004837#endif
4838
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004839 return(test_ret);
4840}
4841
4842
4843static int
4844test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4845 int test_ret = 0;
4846
4847#ifdef LIBXML_HTML_ENABLED
4848 int mem_base;
4849 xmlSAXHandler * hdlr; /* the SAX handler */
4850 int n_hdlr;
4851
4852 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4853 mem_base = xmlMemBlocks();
4854 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4855
4856 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4857 call_tests++;
4858 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4859 xmlResetLastError();
4860 if (mem_base != xmlMemBlocks()) {
4861 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4862 xmlMemBlocks() - mem_base);
4863 test_ret++;
4864 printf(" %d", n_hdlr);
4865 printf("\n");
4866 }
4867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004868 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004869#endif
4870
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004871 return(test_ret);
4872}
4873
4874
4875static int
4876test_xmlSAX2InternalSubset(void) {
4877 int test_ret = 0;
4878
4879 int mem_base;
4880 void * ctx; /* the user data (XML parser context) */
4881 int n_ctx;
4882 xmlChar * name; /* the root element name */
4883 int n_name;
4884 xmlChar * ExternalID; /* the external ID */
4885 int n_ExternalID;
4886 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4887 int n_SystemID;
4888
4889 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4890 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4891 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4892 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4893 mem_base = xmlMemBlocks();
4894 ctx = gen_void_ptr(n_ctx, 0);
4895 name = gen_const_xmlChar_ptr(n_name, 1);
4896 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4897 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4898
William M. Brackf13f77f2004-11-12 16:03:48 +00004899 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004900 call_tests++;
4901 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004902 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4903 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4904 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004905 xmlResetLastError();
4906 if (mem_base != xmlMemBlocks()) {
4907 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4908 xmlMemBlocks() - mem_base);
4909 test_ret++;
4910 printf(" %d", n_ctx);
4911 printf(" %d", n_name);
4912 printf(" %d", n_ExternalID);
4913 printf(" %d", n_SystemID);
4914 printf("\n");
4915 }
4916 }
4917 }
4918 }
4919 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004920 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004921
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004922 return(test_ret);
4923}
4924
4925
4926static int
4927test_xmlSAX2IsStandalone(void) {
4928 int test_ret = 0;
4929
4930 int mem_base;
4931 int ret_val;
4932 void * ctx; /* the user data (XML parser context) */
4933 int n_ctx;
4934
4935 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4936 mem_base = xmlMemBlocks();
4937 ctx = gen_void_ptr(n_ctx, 0);
4938
4939 ret_val = xmlSAX2IsStandalone(ctx);
4940 desret_int(ret_val);
4941 call_tests++;
4942 des_void_ptr(n_ctx, ctx, 0);
4943 xmlResetLastError();
4944 if (mem_base != xmlMemBlocks()) {
4945 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4946 xmlMemBlocks() - mem_base);
4947 test_ret++;
4948 printf(" %d", n_ctx);
4949 printf("\n");
4950 }
4951 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004952 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004953
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004954 return(test_ret);
4955}
4956
4957
4958static int
4959test_xmlSAX2NotationDecl(void) {
4960 int test_ret = 0;
4961
4962 int mem_base;
4963 void * ctx; /* the user data (XML parser context) */
4964 int n_ctx;
4965 xmlChar * name; /* The name of the notation */
4966 int n_name;
4967 xmlChar * publicId; /* The public ID of the entity */
4968 int n_publicId;
4969 xmlChar * systemId; /* The system ID of the entity */
4970 int n_systemId;
4971
4972 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4973 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4974 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4975 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4976 mem_base = xmlMemBlocks();
4977 ctx = gen_void_ptr(n_ctx, 0);
4978 name = gen_const_xmlChar_ptr(n_name, 1);
4979 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4980 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4981
William M. Brackf13f77f2004-11-12 16:03:48 +00004982 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004983 call_tests++;
4984 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004985 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4986 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4987 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004988 xmlResetLastError();
4989 if (mem_base != xmlMemBlocks()) {
4990 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4991 xmlMemBlocks() - mem_base);
4992 test_ret++;
4993 printf(" %d", n_ctx);
4994 printf(" %d", n_name);
4995 printf(" %d", n_publicId);
4996 printf(" %d", n_systemId);
4997 printf("\n");
4998 }
4999 }
5000 }
5001 }
5002 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005003 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005004
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005005 return(test_ret);
5006}
5007
5008
5009static int
5010test_xmlSAX2ProcessingInstruction(void) {
5011 int test_ret = 0;
5012
5013 int mem_base;
5014 void * ctx; /* the user data (XML parser context) */
5015 int n_ctx;
5016 xmlChar * target; /* the target name */
5017 int n_target;
5018 xmlChar * data; /* the PI data's */
5019 int n_data;
5020
5021 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5022 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
5023 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
5024 mem_base = xmlMemBlocks();
5025 ctx = gen_void_ptr(n_ctx, 0);
5026 target = gen_const_xmlChar_ptr(n_target, 1);
5027 data = gen_const_xmlChar_ptr(n_data, 2);
5028
William M. Brackf13f77f2004-11-12 16:03:48 +00005029 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005030 call_tests++;
5031 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005032 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
5033 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005034 xmlResetLastError();
5035 if (mem_base != xmlMemBlocks()) {
5036 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
5037 xmlMemBlocks() - mem_base);
5038 test_ret++;
5039 printf(" %d", n_ctx);
5040 printf(" %d", n_target);
5041 printf(" %d", n_data);
5042 printf("\n");
5043 }
5044 }
5045 }
5046 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005047 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005048
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005049 return(test_ret);
5050}
5051
5052
5053static int
5054test_xmlSAX2Reference(void) {
5055 int test_ret = 0;
5056
5057 int mem_base;
5058 void * ctx; /* the user data (XML parser context) */
5059 int n_ctx;
5060 xmlChar * name; /* The entity name */
5061 int n_name;
5062
5063 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5064 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5065 mem_base = xmlMemBlocks();
5066 ctx = gen_void_ptr(n_ctx, 0);
5067 name = gen_const_xmlChar_ptr(n_name, 1);
5068
William M. Brackf13f77f2004-11-12 16:03:48 +00005069 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005070 call_tests++;
5071 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005072 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005073 xmlResetLastError();
5074 if (mem_base != xmlMemBlocks()) {
5075 printf("Leak of %d blocks found in xmlSAX2Reference",
5076 xmlMemBlocks() - mem_base);
5077 test_ret++;
5078 printf(" %d", n_ctx);
5079 printf(" %d", n_name);
5080 printf("\n");
5081 }
5082 }
5083 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005084 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005085
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005086 return(test_ret);
5087}
5088
5089
5090static int
5091test_xmlSAX2ResolveEntity(void) {
5092 int test_ret = 0;
5093
5094 int mem_base;
5095 xmlParserInputPtr ret_val;
5096 void * ctx; /* the user data (XML parser context) */
5097 int n_ctx;
5098 xmlChar * publicId; /* The public ID of the entity */
5099 int n_publicId;
5100 xmlChar * systemId; /* The system ID of the entity */
5101 int n_systemId;
5102
5103 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5104 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5105 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5106 mem_base = xmlMemBlocks();
5107 ctx = gen_void_ptr(n_ctx, 0);
5108 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
5109 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
5110
William M. Brackf13f77f2004-11-12 16:03:48 +00005111 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005112 desret_xmlParserInputPtr(ret_val);
5113 call_tests++;
5114 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005115 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
5116 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005117 xmlResetLastError();
5118 if (mem_base != xmlMemBlocks()) {
5119 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
5120 xmlMemBlocks() - mem_base);
5121 test_ret++;
5122 printf(" %d", n_ctx);
5123 printf(" %d", n_publicId);
5124 printf(" %d", n_systemId);
5125 printf("\n");
5126 }
5127 }
5128 }
5129 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005130 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005131
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005132 return(test_ret);
5133}
5134
5135
5136#define gen_nb_xmlSAXLocatorPtr 1
5137static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5138 return(NULL);
5139}
5140static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5141}
5142
5143static int
5144test_xmlSAX2SetDocumentLocator(void) {
5145 int test_ret = 0;
5146
5147 int mem_base;
5148 void * ctx; /* the user data (XML parser context) */
5149 int n_ctx;
5150 xmlSAXLocatorPtr loc; /* A SAX Locator */
5151 int n_loc;
5152
5153 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5154 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
5155 mem_base = xmlMemBlocks();
5156 ctx = gen_void_ptr(n_ctx, 0);
5157 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
5158
5159 xmlSAX2SetDocumentLocator(ctx, loc);
5160 call_tests++;
5161 des_void_ptr(n_ctx, ctx, 0);
5162 des_xmlSAXLocatorPtr(n_loc, loc, 1);
5163 xmlResetLastError();
5164 if (mem_base != xmlMemBlocks()) {
5165 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
5166 xmlMemBlocks() - mem_base);
5167 test_ret++;
5168 printf(" %d", n_ctx);
5169 printf(" %d", n_loc);
5170 printf("\n");
5171 }
5172 }
5173 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005174 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005175
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005176 return(test_ret);
5177}
5178
5179
5180static int
5181test_xmlSAX2StartDocument(void) {
5182 int test_ret = 0;
5183
5184 int mem_base;
5185 void * ctx; /* the user data (XML parser context) */
5186 int n_ctx;
5187
5188 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5189 mem_base = xmlMemBlocks();
5190 ctx = gen_void_ptr(n_ctx, 0);
5191
5192 xmlSAX2StartDocument(ctx);
5193 call_tests++;
5194 des_void_ptr(n_ctx, ctx, 0);
5195 xmlResetLastError();
5196 if (mem_base != xmlMemBlocks()) {
5197 printf("Leak of %d blocks found in xmlSAX2StartDocument",
5198 xmlMemBlocks() - mem_base);
5199 test_ret++;
5200 printf(" %d", n_ctx);
5201 printf("\n");
5202 }
5203 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005204 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005205
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005206 return(test_ret);
5207}
5208
5209
5210static int
5211test_xmlSAX2StartElement(void) {
5212 int test_ret = 0;
5213
Daniel Veillarda521d282004-11-09 14:59:59 +00005214#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005215 int mem_base;
5216 void * ctx; /* the user data (XML parser context) */
5217 int n_ctx;
5218 xmlChar * fullname; /* The element name, including namespace prefix */
5219 int n_fullname;
5220 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
5221 int n_atts;
5222
5223 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5224 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
5225 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
5226 mem_base = xmlMemBlocks();
5227 ctx = gen_void_ptr(n_ctx, 0);
5228 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
5229 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
5230
William M. Brackf13f77f2004-11-12 16:03:48 +00005231 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005232 call_tests++;
5233 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005234 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
5235 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005236 xmlResetLastError();
5237 if (mem_base != xmlMemBlocks()) {
5238 printf("Leak of %d blocks found in xmlSAX2StartElement",
5239 xmlMemBlocks() - mem_base);
5240 test_ret++;
5241 printf(" %d", n_ctx);
5242 printf(" %d", n_fullname);
5243 printf(" %d", n_atts);
5244 printf("\n");
5245 }
5246 }
5247 }
5248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005249 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005250#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005251
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005252 return(test_ret);
5253}
5254
5255
5256static int
5257test_xmlSAX2StartElementNs(void) {
5258 int test_ret = 0;
5259
5260 int mem_base;
5261 void * ctx; /* the user data (XML parser context) */
5262 int n_ctx;
5263 xmlChar * localname; /* the local name of the element */
5264 int n_localname;
5265 xmlChar * prefix; /* the element namespace prefix if available */
5266 int n_prefix;
5267 xmlChar * URI; /* the element namespace name if available */
5268 int n_URI;
5269 int nb_namespaces; /* number of namespace definitions on that node */
5270 int n_nb_namespaces;
5271 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
5272 int n_namespaces;
5273 int nb_attributes; /* the number of attributes on that node */
5274 int n_nb_attributes;
5275 int nb_defaulted; /* the number of defaulted attributes. */
5276 int n_nb_defaulted;
5277 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
5278 int n_attributes;
5279
5280 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5281 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
5282 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
5283 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5284 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
5285 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
5286 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
5287 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
5288 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
5289 mem_base = xmlMemBlocks();
5290 ctx = gen_void_ptr(n_ctx, 0);
5291 localname = gen_const_xmlChar_ptr(n_localname, 1);
5292 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
5293 URI = gen_const_xmlChar_ptr(n_URI, 3);
5294 nb_namespaces = gen_int(n_nb_namespaces, 4);
5295 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
5296 nb_attributes = gen_int(n_nb_attributes, 6);
5297 nb_defaulted = gen_int(n_nb_defaulted, 7);
5298 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
5299
William M. Brackf13f77f2004-11-12 16:03:48 +00005300 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 +00005301 call_tests++;
5302 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005303 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
5304 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
5305 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005306 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00005307 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005308 des_int(n_nb_attributes, nb_attributes, 6);
5309 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00005310 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005311 xmlResetLastError();
5312 if (mem_base != xmlMemBlocks()) {
5313 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
5314 xmlMemBlocks() - mem_base);
5315 test_ret++;
5316 printf(" %d", n_ctx);
5317 printf(" %d", n_localname);
5318 printf(" %d", n_prefix);
5319 printf(" %d", n_URI);
5320 printf(" %d", n_nb_namespaces);
5321 printf(" %d", n_namespaces);
5322 printf(" %d", n_nb_attributes);
5323 printf(" %d", n_nb_defaulted);
5324 printf(" %d", n_attributes);
5325 printf("\n");
5326 }
5327 }
5328 }
5329 }
5330 }
5331 }
5332 }
5333 }
5334 }
5335 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005336 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005337
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005338 return(test_ret);
5339}
5340
5341
5342static int
5343test_xmlSAX2UnparsedEntityDecl(void) {
5344 int test_ret = 0;
5345
5346 int mem_base;
5347 void * ctx; /* the user data (XML parser context) */
5348 int n_ctx;
5349 xmlChar * name; /* The name of the entity */
5350 int n_name;
5351 xmlChar * publicId; /* The public ID of the entity */
5352 int n_publicId;
5353 xmlChar * systemId; /* The system ID of the entity */
5354 int n_systemId;
5355 xmlChar * notationName; /* the name of the notation */
5356 int n_notationName;
5357
5358 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5359 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5360 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5361 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5362 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5363 mem_base = xmlMemBlocks();
5364 ctx = gen_void_ptr(n_ctx, 0);
5365 name = gen_const_xmlChar_ptr(n_name, 1);
5366 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5367 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5368 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5369
William M. Brackf13f77f2004-11-12 16:03:48 +00005370 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005371 call_tests++;
5372 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005373 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5374 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5375 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5376 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005377 xmlResetLastError();
5378 if (mem_base != xmlMemBlocks()) {
5379 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5380 xmlMemBlocks() - mem_base);
5381 test_ret++;
5382 printf(" %d", n_ctx);
5383 printf(" %d", n_name);
5384 printf(" %d", n_publicId);
5385 printf(" %d", n_systemId);
5386 printf(" %d", n_notationName);
5387 printf("\n");
5388 }
5389 }
5390 }
5391 }
5392 }
5393 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005395
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005396 return(test_ret);
5397}
5398
5399
5400static int
5401test_xmlSAXDefaultVersion(void) {
5402 int test_ret = 0;
5403
Daniel Veillarda521d282004-11-09 14:59:59 +00005404#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005405 int mem_base;
5406 int ret_val;
5407 int version; /* the version, 1 or 2 */
5408 int n_version;
5409
5410 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5411 mem_base = xmlMemBlocks();
5412 version = gen_int(n_version, 0);
5413
5414 ret_val = xmlSAXDefaultVersion(version);
5415 desret_int(ret_val);
5416 call_tests++;
5417 des_int(n_version, version, 0);
5418 xmlResetLastError();
5419 if (mem_base != xmlMemBlocks()) {
5420 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5421 xmlMemBlocks() - mem_base);
5422 test_ret++;
5423 printf(" %d", n_version);
5424 printf("\n");
5425 }
5426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005427 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005428#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005429
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005430 return(test_ret);
5431}
5432
5433
5434static int
5435test_xmlSAXVersion(void) {
5436 int test_ret = 0;
5437
5438 int mem_base;
5439 int ret_val;
5440 xmlSAXHandler * hdlr; /* the SAX handler */
5441 int n_hdlr;
5442 int version; /* the version, 1 or 2 */
5443 int n_version;
5444
5445 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5446 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5447 mem_base = xmlMemBlocks();
5448 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5449 version = gen_int(n_version, 1);
5450
5451 ret_val = xmlSAXVersion(hdlr, version);
5452 desret_int(ret_val);
5453 call_tests++;
5454 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5455 des_int(n_version, version, 1);
5456 xmlResetLastError();
5457 if (mem_base != xmlMemBlocks()) {
5458 printf("Leak of %d blocks found in xmlSAXVersion",
5459 xmlMemBlocks() - mem_base);
5460 test_ret++;
5461 printf(" %d", n_hdlr);
5462 printf(" %d", n_version);
5463 printf("\n");
5464 }
5465 }
5466 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005467 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005468
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005469 return(test_ret);
5470}
5471
5472static int
5473test_SAX2(void) {
5474 int test_ret = 0;
5475
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005476 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005477 test_ret += test_docbDefaultSAXHandlerInit();
5478 test_ret += test_htmlDefaultSAXHandlerInit();
5479 test_ret += test_xmlDefaultSAXHandlerInit();
5480 test_ret += test_xmlSAX2AttributeDecl();
5481 test_ret += test_xmlSAX2CDataBlock();
5482 test_ret += test_xmlSAX2Characters();
5483 test_ret += test_xmlSAX2Comment();
5484 test_ret += test_xmlSAX2ElementDecl();
5485 test_ret += test_xmlSAX2EndDocument();
5486 test_ret += test_xmlSAX2EndElement();
5487 test_ret += test_xmlSAX2EndElementNs();
5488 test_ret += test_xmlSAX2EntityDecl();
5489 test_ret += test_xmlSAX2ExternalSubset();
5490 test_ret += test_xmlSAX2GetColumnNumber();
5491 test_ret += test_xmlSAX2GetEntity();
5492 test_ret += test_xmlSAX2GetLineNumber();
5493 test_ret += test_xmlSAX2GetParameterEntity();
5494 test_ret += test_xmlSAX2GetPublicId();
5495 test_ret += test_xmlSAX2GetSystemId();
5496 test_ret += test_xmlSAX2HasExternalSubset();
5497 test_ret += test_xmlSAX2HasInternalSubset();
5498 test_ret += test_xmlSAX2IgnorableWhitespace();
5499 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5500 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5501 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5502 test_ret += test_xmlSAX2InternalSubset();
5503 test_ret += test_xmlSAX2IsStandalone();
5504 test_ret += test_xmlSAX2NotationDecl();
5505 test_ret += test_xmlSAX2ProcessingInstruction();
5506 test_ret += test_xmlSAX2Reference();
5507 test_ret += test_xmlSAX2ResolveEntity();
5508 test_ret += test_xmlSAX2SetDocumentLocator();
5509 test_ret += test_xmlSAX2StartDocument();
5510 test_ret += test_xmlSAX2StartElement();
5511 test_ret += test_xmlSAX2StartElementNs();
5512 test_ret += test_xmlSAX2UnparsedEntityDecl();
5513 test_ret += test_xmlSAXDefaultVersion();
5514 test_ret += test_xmlSAXVersion();
5515
5516 if (test_ret != 0)
5517 printf("Module SAX2: %d errors\n", test_ret);
5518 return(test_ret);
5519}
5520
Daniel Veillarda82b1822004-11-08 16:24:57 +00005521static int
5522test_xmlC14NDocDumpMemory(void) {
5523 int test_ret = 0;
5524
5525#ifdef LIBXML_C14N_ENABLED
5526#ifdef LIBXML_OUTPUT_ENABLED
5527 int mem_base;
5528 int ret_val;
5529 xmlDocPtr doc; /* the XML document for canonization */
5530 int n_doc;
5531 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5532 int n_nodes;
5533 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5534 int n_exclusive;
5535 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) */
5536 int n_inclusive_ns_prefixes;
5537 int with_comments; /* include comments in the result (!=0) or not (==0) */
5538 int n_with_comments;
5539 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 */
5540 int n_doc_txt_ptr;
5541
5542 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5543 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5544 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5545 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5546 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5547 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5548 mem_base = xmlMemBlocks();
5549 doc = gen_xmlDocPtr(n_doc, 0);
5550 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5551 exclusive = gen_int(n_exclusive, 2);
5552 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5553 with_comments = gen_int(n_with_comments, 4);
5554 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5555
5556 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5557 desret_int(ret_val);
5558 call_tests++;
5559 des_xmlDocPtr(n_doc, doc, 0);
5560 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5561 des_int(n_exclusive, exclusive, 2);
5562 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5563 des_int(n_with_comments, with_comments, 4);
5564 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5565 xmlResetLastError();
5566 if (mem_base != xmlMemBlocks()) {
5567 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5568 xmlMemBlocks() - mem_base);
5569 test_ret++;
5570 printf(" %d", n_doc);
5571 printf(" %d", n_nodes);
5572 printf(" %d", n_exclusive);
5573 printf(" %d", n_inclusive_ns_prefixes);
5574 printf(" %d", n_with_comments);
5575 printf(" %d", n_doc_txt_ptr);
5576 printf("\n");
5577 }
5578 }
5579 }
5580 }
5581 }
5582 }
5583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005584 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005585#endif
5586#endif
5587
Daniel Veillarda82b1822004-11-08 16:24:57 +00005588 return(test_ret);
5589}
5590
5591
5592static int
5593test_xmlC14NDocSave(void) {
5594 int test_ret = 0;
5595
5596#ifdef LIBXML_C14N_ENABLED
5597#ifdef LIBXML_OUTPUT_ENABLED
5598 int mem_base;
5599 int ret_val;
5600 xmlDocPtr doc; /* the XML document for canonization */
5601 int n_doc;
5602 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5603 int n_nodes;
5604 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5605 int n_exclusive;
5606 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) */
5607 int n_inclusive_ns_prefixes;
5608 int with_comments; /* include comments in the result (!=0) or not (==0) */
5609 int n_with_comments;
5610 const char * filename; /* the filename to store canonical XML image */
5611 int n_filename;
5612 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5613 int n_compression;
5614
5615 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5616 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5617 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5618 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5619 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5620 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5621 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5622 mem_base = xmlMemBlocks();
5623 doc = gen_xmlDocPtr(n_doc, 0);
5624 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5625 exclusive = gen_int(n_exclusive, 2);
5626 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5627 with_comments = gen_int(n_with_comments, 4);
5628 filename = gen_fileoutput(n_filename, 5);
5629 compression = gen_int(n_compression, 6);
5630
5631 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5632 desret_int(ret_val);
5633 call_tests++;
5634 des_xmlDocPtr(n_doc, doc, 0);
5635 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5636 des_int(n_exclusive, exclusive, 2);
5637 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5638 des_int(n_with_comments, with_comments, 4);
5639 des_fileoutput(n_filename, filename, 5);
5640 des_int(n_compression, compression, 6);
5641 xmlResetLastError();
5642 if (mem_base != xmlMemBlocks()) {
5643 printf("Leak of %d blocks found in xmlC14NDocSave",
5644 xmlMemBlocks() - mem_base);
5645 test_ret++;
5646 printf(" %d", n_doc);
5647 printf(" %d", n_nodes);
5648 printf(" %d", n_exclusive);
5649 printf(" %d", n_inclusive_ns_prefixes);
5650 printf(" %d", n_with_comments);
5651 printf(" %d", n_filename);
5652 printf(" %d", n_compression);
5653 printf("\n");
5654 }
5655 }
5656 }
5657 }
5658 }
5659 }
5660 }
5661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005662 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005663#endif
5664#endif
5665
Daniel Veillarda82b1822004-11-08 16:24:57 +00005666 return(test_ret);
5667}
5668
5669
5670static int
5671test_xmlC14NDocSaveTo(void) {
5672 int test_ret = 0;
5673
5674#ifdef LIBXML_C14N_ENABLED
5675#ifdef LIBXML_OUTPUT_ENABLED
5676 int mem_base;
5677 int ret_val;
5678 xmlDocPtr doc; /* the XML document for canonization */
5679 int n_doc;
5680 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5681 int n_nodes;
5682 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5683 int n_exclusive;
5684 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) */
5685 int n_inclusive_ns_prefixes;
5686 int with_comments; /* include comments in the result (!=0) or not (==0) */
5687 int n_with_comments;
5688 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5689 int n_buf;
5690
5691 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5692 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5693 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5694 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5695 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5696 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5697 mem_base = xmlMemBlocks();
5698 doc = gen_xmlDocPtr(n_doc, 0);
5699 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5700 exclusive = gen_int(n_exclusive, 2);
5701 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5702 with_comments = gen_int(n_with_comments, 4);
5703 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5704
5705 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5706 desret_int(ret_val);
5707 call_tests++;
5708 des_xmlDocPtr(n_doc, doc, 0);
5709 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5710 des_int(n_exclusive, exclusive, 2);
5711 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5712 des_int(n_with_comments, with_comments, 4);
5713 des_xmlOutputBufferPtr(n_buf, buf, 5);
5714 xmlResetLastError();
5715 if (mem_base != xmlMemBlocks()) {
5716 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5717 xmlMemBlocks() - mem_base);
5718 test_ret++;
5719 printf(" %d", n_doc);
5720 printf(" %d", n_nodes);
5721 printf(" %d", n_exclusive);
5722 printf(" %d", n_inclusive_ns_prefixes);
5723 printf(" %d", n_with_comments);
5724 printf(" %d", n_buf);
5725 printf("\n");
5726 }
5727 }
5728 }
5729 }
5730 }
5731 }
5732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005733 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005734#endif
5735#endif
5736
Daniel Veillarda82b1822004-11-08 16:24:57 +00005737 return(test_ret);
5738}
5739
5740
5741static int
5742test_xmlC14NExecute(void) {
5743 int test_ret = 0;
5744
5745
5746 /* missing type support */
5747 return(test_ret);
5748}
5749
5750static int
5751test_c14n(void) {
5752 int test_ret = 0;
5753
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005754 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005755 test_ret += test_xmlC14NDocDumpMemory();
5756 test_ret += test_xmlC14NDocSave();
5757 test_ret += test_xmlC14NDocSaveTo();
5758 test_ret += test_xmlC14NExecute();
5759
5760 if (test_ret != 0)
5761 printf("Module c14n: %d errors\n", test_ret);
5762 return(test_ret);
5763}
Daniel Veillarda521d282004-11-09 14:59:59 +00005764#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005765
Daniel Veillardce682bc2004-11-05 17:22:25 +00005766#define gen_nb_xmlCatalogPtr 1
5767static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5768 return(NULL);
5769}
5770static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5771}
Daniel Veillarda521d282004-11-09 14:59:59 +00005772#endif
5773
Daniel Veillardce682bc2004-11-05 17:22:25 +00005774
Daniel Veillardd93f6252004-11-02 15:53:51 +00005775static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005776test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778
Daniel Veillardce682bc2004-11-05 17:22:25 +00005779#ifdef LIBXML_CATALOG_ENABLED
5780 int mem_base;
5781 int ret_val;
5782 xmlCatalogPtr catal; /* a Catalog */
5783 int n_catal;
5784 xmlChar * type; /* the type of record to add to the catalog */
5785 int n_type;
5786 xmlChar * orig; /* the system, public or prefix to match */
5787 int n_orig;
5788 xmlChar * replace; /* the replacement value for the match */
5789 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005790
Daniel Veillardce682bc2004-11-05 17:22:25 +00005791 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5792 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5793 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5794 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5795 mem_base = xmlMemBlocks();
5796 catal = gen_xmlCatalogPtr(n_catal, 0);
5797 type = gen_const_xmlChar_ptr(n_type, 1);
5798 orig = gen_const_xmlChar_ptr(n_orig, 2);
5799 replace = gen_const_xmlChar_ptr(n_replace, 3);
5800
William M. Brackf13f77f2004-11-12 16:03:48 +00005801 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005802 desret_int(ret_val);
5803 call_tests++;
5804 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005805 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5806 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5807 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005808 xmlResetLastError();
5809 if (mem_base != xmlMemBlocks()) {
5810 printf("Leak of %d blocks found in xmlACatalogAdd",
5811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005812 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005813 printf(" %d", n_catal);
5814 printf(" %d", n_type);
5815 printf(" %d", n_orig);
5816 printf(" %d", n_replace);
5817 printf("\n");
5818 }
5819 }
5820 }
5821 }
5822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005823 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005824#endif
5825
Daniel Veillard42595322004-11-08 10:52:06 +00005826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005827}
5828
5829
5830static int
5831test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005833
Daniel Veillardce682bc2004-11-05 17:22:25 +00005834#ifdef LIBXML_CATALOG_ENABLED
5835#ifdef LIBXML_OUTPUT_ENABLED
5836 int mem_base;
5837 xmlCatalogPtr catal; /* a Catalog */
5838 int n_catal;
5839 FILE * out; /* the file. */
5840 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005841
Daniel Veillardce682bc2004-11-05 17:22:25 +00005842 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5843 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5844 mem_base = xmlMemBlocks();
5845 catal = gen_xmlCatalogPtr(n_catal, 0);
5846 out = gen_FILE_ptr(n_out, 1);
5847
5848 xmlACatalogDump(catal, out);
5849 call_tests++;
5850 des_xmlCatalogPtr(n_catal, catal, 0);
5851 des_FILE_ptr(n_out, out, 1);
5852 xmlResetLastError();
5853 if (mem_base != xmlMemBlocks()) {
5854 printf("Leak of %d blocks found in xmlACatalogDump",
5855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005856 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005857 printf(" %d", n_catal);
5858 printf(" %d", n_out);
5859 printf("\n");
5860 }
5861 }
5862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005863 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005864#endif
5865#endif
5866
Daniel Veillard42595322004-11-08 10:52:06 +00005867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005868}
5869
5870
5871static int
5872test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005874
Daniel Veillardce682bc2004-11-05 17:22:25 +00005875#ifdef LIBXML_CATALOG_ENABLED
5876 int mem_base;
5877 int ret_val;
5878 xmlCatalogPtr catal; /* a Catalog */
5879 int n_catal;
5880 xmlChar * value; /* the value to remove */
5881 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005882
Daniel Veillardce682bc2004-11-05 17:22:25 +00005883 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5884 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5885 mem_base = xmlMemBlocks();
5886 catal = gen_xmlCatalogPtr(n_catal, 0);
5887 value = gen_const_xmlChar_ptr(n_value, 1);
5888
William M. Brackf13f77f2004-11-12 16:03:48 +00005889 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005890 desret_int(ret_val);
5891 call_tests++;
5892 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005893 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005894 xmlResetLastError();
5895 if (mem_base != xmlMemBlocks()) {
5896 printf("Leak of %d blocks found in xmlACatalogRemove",
5897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005898 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005899 printf(" %d", n_catal);
5900 printf(" %d", n_value);
5901 printf("\n");
5902 }
5903 }
5904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005905 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005906#endif
5907
Daniel Veillard42595322004-11-08 10:52:06 +00005908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005909}
5910
5911
5912static int
5913test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005915
Daniel Veillardce682bc2004-11-05 17:22:25 +00005916#ifdef LIBXML_CATALOG_ENABLED
5917 int mem_base;
5918 xmlChar * ret_val;
5919 xmlCatalogPtr catal; /* a Catalog */
5920 int n_catal;
5921 xmlChar * pubID; /* the public ID string */
5922 int n_pubID;
5923 xmlChar * sysID; /* the system ID string */
5924 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005925
Daniel Veillardce682bc2004-11-05 17:22:25 +00005926 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5927 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5928 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5929 mem_base = xmlMemBlocks();
5930 catal = gen_xmlCatalogPtr(n_catal, 0);
5931 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5932 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5933
William M. Brackf13f77f2004-11-12 16:03:48 +00005934 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005935 desret_xmlChar_ptr(ret_val);
5936 call_tests++;
5937 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005938 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5939 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005940 xmlResetLastError();
5941 if (mem_base != xmlMemBlocks()) {
5942 printf("Leak of %d blocks found in xmlACatalogResolve",
5943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005944 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005945 printf(" %d", n_catal);
5946 printf(" %d", n_pubID);
5947 printf(" %d", n_sysID);
5948 printf("\n");
5949 }
5950 }
5951 }
5952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005953 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005954#endif
5955
Daniel Veillard42595322004-11-08 10:52:06 +00005956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005957}
5958
5959
5960static int
5961test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005963
Daniel Veillardce682bc2004-11-05 17:22:25 +00005964#ifdef LIBXML_CATALOG_ENABLED
5965 int mem_base;
5966 xmlChar * ret_val;
5967 xmlCatalogPtr catal; /* a Catalog */
5968 int n_catal;
5969 xmlChar * pubID; /* the public ID string */
5970 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005971
Daniel Veillardce682bc2004-11-05 17:22:25 +00005972 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5973 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5974 mem_base = xmlMemBlocks();
5975 catal = gen_xmlCatalogPtr(n_catal, 0);
5976 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5977
William M. Brackf13f77f2004-11-12 16:03:48 +00005978 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005979 desret_xmlChar_ptr(ret_val);
5980 call_tests++;
5981 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005982 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005983 xmlResetLastError();
5984 if (mem_base != xmlMemBlocks()) {
5985 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005987 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005988 printf(" %d", n_catal);
5989 printf(" %d", n_pubID);
5990 printf("\n");
5991 }
5992 }
5993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005994 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005995#endif
5996
Daniel Veillard42595322004-11-08 10:52:06 +00005997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005998}
5999
6000
6001static int
6002test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006004
Daniel Veillardce682bc2004-11-05 17:22:25 +00006005#ifdef LIBXML_CATALOG_ENABLED
6006 int mem_base;
6007 xmlChar * ret_val;
6008 xmlCatalogPtr catal; /* a Catalog */
6009 int n_catal;
6010 xmlChar * sysID; /* the system ID string */
6011 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006012
Daniel Veillardce682bc2004-11-05 17:22:25 +00006013 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6014 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6015 mem_base = xmlMemBlocks();
6016 catal = gen_xmlCatalogPtr(n_catal, 0);
6017 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
6018
William M. Brackf13f77f2004-11-12 16:03:48 +00006019 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006020 desret_xmlChar_ptr(ret_val);
6021 call_tests++;
6022 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006023 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006024 xmlResetLastError();
6025 if (mem_base != xmlMemBlocks()) {
6026 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
6027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006028 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006029 printf(" %d", n_catal);
6030 printf(" %d", n_sysID);
6031 printf("\n");
6032 }
6033 }
6034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006035 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006036#endif
6037
Daniel Veillard42595322004-11-08 10:52:06 +00006038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006039}
6040
6041
6042static int
6043test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006045
Daniel Veillardce682bc2004-11-05 17:22:25 +00006046#ifdef LIBXML_CATALOG_ENABLED
6047 int mem_base;
6048 xmlChar * ret_val;
6049 xmlCatalogPtr catal; /* a Catalog */
6050 int n_catal;
6051 xmlChar * URI; /* the URI */
6052 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006053
Daniel Veillardce682bc2004-11-05 17:22:25 +00006054 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6055 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6056 mem_base = xmlMemBlocks();
6057 catal = gen_xmlCatalogPtr(n_catal, 0);
6058 URI = gen_const_xmlChar_ptr(n_URI, 1);
6059
William M. Brackf13f77f2004-11-12 16:03:48 +00006060 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006061 desret_xmlChar_ptr(ret_val);
6062 call_tests++;
6063 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006064 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006065 xmlResetLastError();
6066 if (mem_base != xmlMemBlocks()) {
6067 printf("Leak of %d blocks found in xmlACatalogResolveURI",
6068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006069 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006070 printf(" %d", n_catal);
6071 printf(" %d", n_URI);
6072 printf("\n");
6073 }
6074 }
6075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006076 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006077#endif
6078
Daniel Veillard42595322004-11-08 10:52:06 +00006079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006080}
6081
6082
6083static int
6084test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006086
6087#ifdef LIBXML_CATALOG_ENABLED
6088 int mem_base;
6089 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006090 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006091 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006092 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006093 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006094 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006095 int n_replace;
6096
6097 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
6098 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
6099 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
6100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006101 type = gen_const_xmlChar_ptr(n_type, 0);
6102 orig = gen_const_xmlChar_ptr(n_orig, 1);
6103 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006104
William M. Brackf13f77f2004-11-12 16:03:48 +00006105 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006106 desret_int(ret_val);
6107 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006108 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
6109 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
6110 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006111 xmlResetLastError();
6112 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006113 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006115 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006116 printf(" %d", n_type);
6117 printf(" %d", n_orig);
6118 printf(" %d", n_replace);
6119 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006120 }
6121 }
6122 }
6123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006124 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006125#endif
6126
Daniel Veillard42595322004-11-08 10:52:06 +00006127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006128}
6129
6130
6131static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006132test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006134
6135#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00006136
Daniel Veillardd93f6252004-11-02 15:53:51 +00006137
6138 xmlCatalogCleanup();
6139 call_tests++;
6140 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006141 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006142#endif
6143
Daniel Veillard42595322004-11-08 10:52:06 +00006144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006145}
6146
6147
6148static int
6149test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006151
6152#ifdef LIBXML_CATALOG_ENABLED
6153 int ret_val;
6154
6155
6156 ret_val = xmlCatalogConvert();
6157 desret_int(ret_val);
6158 call_tests++;
6159 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006160 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006161#endif
6162
Daniel Veillard42595322004-11-08 10:52:06 +00006163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006164}
6165
6166
6167static int
6168test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006170
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006171#ifdef LIBXML_CATALOG_ENABLED
6172#ifdef LIBXML_OUTPUT_ENABLED
6173 int mem_base;
6174 FILE * out; /* the file. */
6175 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006176
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006177 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
6178 mem_base = xmlMemBlocks();
6179 out = gen_FILE_ptr(n_out, 0);
6180
6181 xmlCatalogDump(out);
6182 call_tests++;
6183 des_FILE_ptr(n_out, out, 0);
6184 xmlResetLastError();
6185 if (mem_base != xmlMemBlocks()) {
6186 printf("Leak of %d blocks found in xmlCatalogDump",
6187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006188 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006189 printf(" %d", n_out);
6190 printf("\n");
6191 }
6192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006193 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006194#endif
6195#endif
6196
Daniel Veillard42595322004-11-08 10:52:06 +00006197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006198}
6199
6200
6201static int
6202test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006204
Daniel Veillard57b25162004-11-06 14:50:18 +00006205#ifdef LIBXML_CATALOG_ENABLED
6206 int mem_base;
6207 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006208
Daniel Veillard57b25162004-11-06 14:50:18 +00006209 mem_base = xmlMemBlocks();
6210
6211 ret_val = xmlCatalogGetDefaults();
6212 desret_xmlCatalogAllow(ret_val);
6213 call_tests++;
6214 xmlResetLastError();
6215 if (mem_base != xmlMemBlocks()) {
6216 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
6217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006218 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006219 printf("\n");
6220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006221 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006222#endif
6223
Daniel Veillard42595322004-11-08 10:52:06 +00006224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006225}
6226
6227
6228static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006229test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006231
Daniel Veillardce682bc2004-11-05 17:22:25 +00006232#ifdef LIBXML_CATALOG_ENABLED
6233 int mem_base;
6234 int ret_val;
6235 xmlCatalogPtr catal; /* should this create an SGML catalog */
6236 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006237
Daniel Veillardce682bc2004-11-05 17:22:25 +00006238 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6239 mem_base = xmlMemBlocks();
6240 catal = gen_xmlCatalogPtr(n_catal, 0);
6241
6242 ret_val = xmlCatalogIsEmpty(catal);
6243 desret_int(ret_val);
6244 call_tests++;
6245 des_xmlCatalogPtr(n_catal, catal, 0);
6246 xmlResetLastError();
6247 if (mem_base != xmlMemBlocks()) {
6248 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
6249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006250 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006251 printf(" %d", n_catal);
6252 printf("\n");
6253 }
6254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006255 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006256#endif
6257
Daniel Veillard42595322004-11-08 10:52:06 +00006258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006259}
6260
6261
6262static int
6263test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006265
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006266#ifdef LIBXML_CATALOG_ENABLED
6267 int mem_base;
6268 xmlChar * ret_val;
6269 void * catalogs; /* a document's list of catalogs */
6270 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006271 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006272 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006273 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006274 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006275
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006276 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6277 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6278 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6279 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006280 catalogs = gen_void_ptr(n_catalogs, 0);
6281 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
6282 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006283
William M. Brackf13f77f2004-11-12 16:03:48 +00006284 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006285 desret_xmlChar_ptr(ret_val);
6286 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006287 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006288 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
6289 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006290 xmlResetLastError();
6291 if (mem_base != xmlMemBlocks()) {
6292 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
6293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006294 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006295 printf(" %d", n_catalogs);
6296 printf(" %d", n_pubID);
6297 printf(" %d", n_sysID);
6298 printf("\n");
6299 }
6300 }
6301 }
6302 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006303 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006304#endif
6305
Daniel Veillard42595322004-11-08 10:52:06 +00006306 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006307}
6308
6309
6310static int
6311test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006313
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006314#ifdef LIBXML_CATALOG_ENABLED
6315 int mem_base;
6316 xmlChar * ret_val;
6317 void * catalogs; /* a document's list of catalogs */
6318 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006319 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006320 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006321
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006322 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6323 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006325 catalogs = gen_void_ptr(n_catalogs, 0);
6326 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006327
William M. Brackf13f77f2004-11-12 16:03:48 +00006328 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006329 desret_xmlChar_ptr(ret_val);
6330 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006331 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006332 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006333 xmlResetLastError();
6334 if (mem_base != xmlMemBlocks()) {
6335 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006337 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006338 printf(" %d", n_catalogs);
6339 printf(" %d", n_URI);
6340 printf("\n");
6341 }
6342 }
6343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006344 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006345#endif
6346
Daniel Veillard42595322004-11-08 10:52:06 +00006347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006348}
6349
6350
6351static int
6352test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006354
6355#ifdef LIBXML_CATALOG_ENABLED
6356 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006357 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006358 int n_value;
6359
6360 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006361 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006362
William M. Brackf13f77f2004-11-12 16:03:48 +00006363 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006364 desret_int(ret_val);
6365 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006366 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006367 xmlResetLastError();
6368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006369 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006370#endif
6371
Daniel Veillard42595322004-11-08 10:52:06 +00006372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006373}
6374
6375
6376static int
6377test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006379
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006380#ifdef LIBXML_CATALOG_ENABLED
6381 int mem_base;
6382 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006383 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006384 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006385 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006386 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006387
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006388 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6389 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6390 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006391 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6392 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006393
William M. Brackf13f77f2004-11-12 16:03:48 +00006394 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006395 desret_xmlChar_ptr(ret_val);
6396 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006397 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6398 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006399 xmlResetLastError();
6400 if (mem_base != xmlMemBlocks()) {
6401 printf("Leak of %d blocks found in xmlCatalogResolve",
6402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006403 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006404 printf(" %d", n_pubID);
6405 printf(" %d", n_sysID);
6406 printf("\n");
6407 }
6408 }
6409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006410 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006411#endif
6412
Daniel Veillard42595322004-11-08 10:52:06 +00006413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006414}
6415
6416
6417static int
6418test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006420
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006421#ifdef LIBXML_CATALOG_ENABLED
6422 int mem_base;
6423 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006424 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006425 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006426
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006427 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006429 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006430
William M. Brackf13f77f2004-11-12 16:03:48 +00006431 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006432 desret_xmlChar_ptr(ret_val);
6433 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006434 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006435 xmlResetLastError();
6436 if (mem_base != xmlMemBlocks()) {
6437 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006439 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006440 printf(" %d", n_pubID);
6441 printf("\n");
6442 }
6443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006444 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006445#endif
6446
Daniel Veillard42595322004-11-08 10:52:06 +00006447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006448}
6449
6450
6451static int
6452test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006455#ifdef LIBXML_CATALOG_ENABLED
6456 int mem_base;
6457 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006458 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006459 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006460
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006461 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006463 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006464
William M. Brackf13f77f2004-11-12 16:03:48 +00006465 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006466 desret_xmlChar_ptr(ret_val);
6467 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006468 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006469 xmlResetLastError();
6470 if (mem_base != xmlMemBlocks()) {
6471 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006473 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006474 printf(" %d", n_sysID);
6475 printf("\n");
6476 }
6477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006478 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006479#endif
6480
Daniel Veillard42595322004-11-08 10:52:06 +00006481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006482}
6483
6484
6485static int
6486test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006488
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006489#ifdef LIBXML_CATALOG_ENABLED
6490 int mem_base;
6491 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006492 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006493 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006494
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006495 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6496 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006497 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006498
William M. Brackf13f77f2004-11-12 16:03:48 +00006499 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006500 desret_xmlChar_ptr(ret_val);
6501 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006502 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006503 xmlResetLastError();
6504 if (mem_base != xmlMemBlocks()) {
6505 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006507 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006508 printf(" %d", n_URI);
6509 printf("\n");
6510 }
6511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006512 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006513#endif
6514
Daniel Veillard42595322004-11-08 10:52:06 +00006515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006516}
6517
6518
6519static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006520test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006522
Daniel Veillard57b25162004-11-06 14:50:18 +00006523#ifdef LIBXML_CATALOG_ENABLED
6524 int mem_base;
6525 xmlCatalogPrefer ret_val;
6526 xmlCatalogPrefer prefer; /* the default preference for delegation */
6527 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006528
Daniel Veillard57b25162004-11-06 14:50:18 +00006529 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6530 mem_base = xmlMemBlocks();
6531 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6532
6533 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6534 desret_xmlCatalogPrefer(ret_val);
6535 call_tests++;
6536 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6537 xmlResetLastError();
6538 if (mem_base != xmlMemBlocks()) {
6539 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006541 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006542 printf(" %d", n_prefer);
6543 printf("\n");
6544 }
6545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006546 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006547#endif
6548
Daniel Veillard42595322004-11-08 10:52:06 +00006549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006550}
6551
6552
6553static int
6554test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006556
Daniel Veillard57b25162004-11-06 14:50:18 +00006557#ifdef LIBXML_CATALOG_ENABLED
6558 int mem_base;
6559 xmlCatalogAllow allow; /* what catalogs should be accepted */
6560 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006561
Daniel Veillard57b25162004-11-06 14:50:18 +00006562 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6563 mem_base = xmlMemBlocks();
6564 allow = gen_xmlCatalogAllow(n_allow, 0);
6565
6566 xmlCatalogSetDefaults(allow);
6567 call_tests++;
6568 des_xmlCatalogAllow(n_allow, allow, 0);
6569 xmlResetLastError();
6570 if (mem_base != xmlMemBlocks()) {
6571 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006573 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006574 printf(" %d", n_allow);
6575 printf("\n");
6576 }
6577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006578 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006579#endif
6580
Daniel Veillard42595322004-11-08 10:52:06 +00006581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006582}
6583
6584
6585static int
6586test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006588
Daniel Veillardce682bc2004-11-05 17:22:25 +00006589#ifdef LIBXML_CATALOG_ENABLED
6590 int mem_base;
6591 int ret_val;
6592 xmlCatalogPtr catal; /* the catalog */
6593 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006594
Daniel Veillardce682bc2004-11-05 17:22:25 +00006595 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6596 mem_base = xmlMemBlocks();
6597 catal = gen_xmlCatalogPtr(n_catal, 0);
6598
6599 ret_val = xmlConvertSGMLCatalog(catal);
6600 desret_int(ret_val);
6601 call_tests++;
6602 des_xmlCatalogPtr(n_catal, catal, 0);
6603 xmlResetLastError();
6604 if (mem_base != xmlMemBlocks()) {
6605 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006607 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006608 printf(" %d", n_catal);
6609 printf("\n");
6610 }
6611 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006612 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006613#endif
6614
Daniel Veillard42595322004-11-08 10:52:06 +00006615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006616}
6617
6618
6619static int
6620test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006622
6623#ifdef LIBXML_CATALOG_ENABLED
6624 int mem_base;
6625
6626 mem_base = xmlMemBlocks();
6627
6628 xmlInitializeCatalog();
6629 call_tests++;
6630 xmlResetLastError();
6631 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006632 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006634 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006635 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006637 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006638#endif
6639
Daniel Veillard42595322004-11-08 10:52:06 +00006640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006641}
6642
6643
6644static int
6645test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006647
6648
6649 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006651}
6652
6653
6654static int
6655test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006657
6658#ifdef LIBXML_CATALOG_ENABLED
6659 int ret_val;
6660 const char * filename; /* a file path */
6661 int n_filename;
6662
6663 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006664 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006665
6666 ret_val = xmlLoadCatalog(filename);
6667 desret_int(ret_val);
6668 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006669 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006670 xmlResetLastError();
6671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006672 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006673#endif
6674
Daniel Veillard42595322004-11-08 10:52:06 +00006675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006676}
6677
6678
6679static int
6680test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006682
6683#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00006684 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006685 int n_pathss;
6686
6687 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006688 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006689
William M. Brackf13f77f2004-11-12 16:03:48 +00006690 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006691 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006692 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006693 xmlResetLastError();
6694 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006695 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006696#endif
6697
Daniel Veillard42595322004-11-08 10:52:06 +00006698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006699}
6700
6701
6702static int
6703test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006705
6706
6707 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006709}
6710
6711
6712static int
6713test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006715
6716
6717 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006719}
6720
6721
6722static int
6723test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006725
6726#ifdef LIBXML_CATALOG_ENABLED
6727 int mem_base;
6728 xmlDocPtr ret_val;
6729 const char * filename; /* the filename */
6730 int n_filename;
6731
6732 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006734 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006735
6736 ret_val = xmlParseCatalogFile(filename);
6737 desret_xmlDocPtr(ret_val);
6738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006739 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006740 xmlResetLastError();
6741 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006742 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006744 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006745 printf(" %d", n_filename);
6746 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006747 }
6748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006749 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006750#endif
6751
Daniel Veillard42595322004-11-08 10:52:06 +00006752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006753}
6754
6755static int
6756test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006758
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006759 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006760 test_ret += test_xmlACatalogAdd();
6761 test_ret += test_xmlACatalogDump();
6762 test_ret += test_xmlACatalogRemove();
6763 test_ret += test_xmlACatalogResolve();
6764 test_ret += test_xmlACatalogResolvePublic();
6765 test_ret += test_xmlACatalogResolveSystem();
6766 test_ret += test_xmlACatalogResolveURI();
6767 test_ret += test_xmlCatalogAdd();
6768 test_ret += test_xmlCatalogCleanup();
6769 test_ret += test_xmlCatalogConvert();
6770 test_ret += test_xmlCatalogDump();
6771 test_ret += test_xmlCatalogGetDefaults();
6772 test_ret += test_xmlCatalogIsEmpty();
6773 test_ret += test_xmlCatalogLocalResolve();
6774 test_ret += test_xmlCatalogLocalResolveURI();
6775 test_ret += test_xmlCatalogRemove();
6776 test_ret += test_xmlCatalogResolve();
6777 test_ret += test_xmlCatalogResolvePublic();
6778 test_ret += test_xmlCatalogResolveSystem();
6779 test_ret += test_xmlCatalogResolveURI();
6780 test_ret += test_xmlCatalogSetDefaultPrefer();
6781 test_ret += test_xmlCatalogSetDefaults();
6782 test_ret += test_xmlConvertSGMLCatalog();
6783 test_ret += test_xmlInitializeCatalog();
6784 test_ret += test_xmlLoadACatalog();
6785 test_ret += test_xmlLoadCatalog();
6786 test_ret += test_xmlLoadCatalogs();
6787 test_ret += test_xmlLoadSGMLSuperCatalog();
6788 test_ret += test_xmlNewCatalog();
6789 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006790
Daniel Veillard42595322004-11-08 10:52:06 +00006791 if (test_ret != 0)
6792 printf("Module catalog: %d errors\n", test_ret);
6793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006794}
6795
Daniel Veillardce682bc2004-11-05 17:22:25 +00006796#define gen_nb_const_xmlChRangeGroupPtr 1
6797static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6798 return(NULL);
6799}
6800static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6801}
6802
Daniel Veillardd93f6252004-11-02 15:53:51 +00006803static int
6804test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006806
Daniel Veillardce682bc2004-11-05 17:22:25 +00006807 int mem_base;
6808 int ret_val;
6809 unsigned int val; /* character to be validated */
6810 int n_val;
6811 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6812 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006813
Daniel Veillardce682bc2004-11-05 17:22:25 +00006814 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6815 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6816 mem_base = xmlMemBlocks();
6817 val = gen_unsigned_int(n_val, 0);
6818 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6819
William M. Brackf13f77f2004-11-12 16:03:48 +00006820 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006821 desret_int(ret_val);
6822 call_tests++;
6823 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006824 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006825 xmlResetLastError();
6826 if (mem_base != xmlMemBlocks()) {
6827 printf("Leak of %d blocks found in xmlCharInRange",
6828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006829 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006830 printf(" %d", n_val);
6831 printf(" %d", n_rptr);
6832 printf("\n");
6833 }
6834 }
6835 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006836 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006837
Daniel Veillard42595322004-11-08 10:52:06 +00006838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006839}
6840
6841
6842static int
6843test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006845
Daniel Veillard3d97e662004-11-04 10:49:00 +00006846 int mem_base;
6847 int ret_val;
6848 unsigned int ch; /* character to validate */
6849 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006850
Daniel Veillard3d97e662004-11-04 10:49:00 +00006851 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6852 mem_base = xmlMemBlocks();
6853 ch = gen_unsigned_int(n_ch, 0);
6854
6855 ret_val = xmlIsBaseChar(ch);
6856 desret_int(ret_val);
6857 call_tests++;
6858 des_unsigned_int(n_ch, ch, 0);
6859 xmlResetLastError();
6860 if (mem_base != xmlMemBlocks()) {
6861 printf("Leak of %d blocks found in xmlIsBaseChar",
6862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006863 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006864 printf(" %d", n_ch);
6865 printf("\n");
6866 }
6867 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006868 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006869
Daniel Veillard42595322004-11-08 10:52:06 +00006870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006871}
6872
6873
6874static int
6875test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006877
Daniel Veillard3d97e662004-11-04 10:49:00 +00006878 int mem_base;
6879 int ret_val;
6880 unsigned int ch; /* character to validate */
6881 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006882
Daniel Veillard3d97e662004-11-04 10:49:00 +00006883 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6884 mem_base = xmlMemBlocks();
6885 ch = gen_unsigned_int(n_ch, 0);
6886
6887 ret_val = xmlIsBlank(ch);
6888 desret_int(ret_val);
6889 call_tests++;
6890 des_unsigned_int(n_ch, ch, 0);
6891 xmlResetLastError();
6892 if (mem_base != xmlMemBlocks()) {
6893 printf("Leak of %d blocks found in xmlIsBlank",
6894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006895 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006896 printf(" %d", n_ch);
6897 printf("\n");
6898 }
6899 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006900 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006901
Daniel Veillard42595322004-11-08 10:52:06 +00006902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006903}
6904
6905
6906static int
6907test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006909
Daniel Veillard3d97e662004-11-04 10:49:00 +00006910 int mem_base;
6911 int ret_val;
6912 unsigned int ch; /* character to validate */
6913 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006914
Daniel Veillard3d97e662004-11-04 10:49:00 +00006915 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6916 mem_base = xmlMemBlocks();
6917 ch = gen_unsigned_int(n_ch, 0);
6918
6919 ret_val = xmlIsChar(ch);
6920 desret_int(ret_val);
6921 call_tests++;
6922 des_unsigned_int(n_ch, ch, 0);
6923 xmlResetLastError();
6924 if (mem_base != xmlMemBlocks()) {
6925 printf("Leak of %d blocks found in xmlIsChar",
6926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006927 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006928 printf(" %d", n_ch);
6929 printf("\n");
6930 }
6931 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006932 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006933
Daniel Veillard42595322004-11-08 10:52:06 +00006934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006935}
6936
6937
6938static int
6939test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006941
Daniel Veillard3d97e662004-11-04 10:49:00 +00006942 int mem_base;
6943 int ret_val;
6944 unsigned int ch; /* character to validate */
6945 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006946
Daniel Veillard3d97e662004-11-04 10:49:00 +00006947 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6948 mem_base = xmlMemBlocks();
6949 ch = gen_unsigned_int(n_ch, 0);
6950
6951 ret_val = xmlIsCombining(ch);
6952 desret_int(ret_val);
6953 call_tests++;
6954 des_unsigned_int(n_ch, ch, 0);
6955 xmlResetLastError();
6956 if (mem_base != xmlMemBlocks()) {
6957 printf("Leak of %d blocks found in xmlIsCombining",
6958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006959 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006960 printf(" %d", n_ch);
6961 printf("\n");
6962 }
6963 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006964 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006965
Daniel Veillard42595322004-11-08 10:52:06 +00006966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006967}
6968
6969
6970static int
6971test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006973
Daniel Veillard3d97e662004-11-04 10:49:00 +00006974 int mem_base;
6975 int ret_val;
6976 unsigned int ch; /* character to validate */
6977 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006978
Daniel Veillard3d97e662004-11-04 10:49:00 +00006979 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6980 mem_base = xmlMemBlocks();
6981 ch = gen_unsigned_int(n_ch, 0);
6982
6983 ret_val = xmlIsDigit(ch);
6984 desret_int(ret_val);
6985 call_tests++;
6986 des_unsigned_int(n_ch, ch, 0);
6987 xmlResetLastError();
6988 if (mem_base != xmlMemBlocks()) {
6989 printf("Leak of %d blocks found in xmlIsDigit",
6990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006991 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006992 printf(" %d", n_ch);
6993 printf("\n");
6994 }
6995 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006996 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006997
Daniel Veillard42595322004-11-08 10:52:06 +00006998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006999}
7000
7001
7002static int
7003test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007005
Daniel Veillard3d97e662004-11-04 10:49:00 +00007006 int mem_base;
7007 int ret_val;
7008 unsigned int ch; /* character to validate */
7009 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007010
Daniel Veillard3d97e662004-11-04 10:49:00 +00007011 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7012 mem_base = xmlMemBlocks();
7013 ch = gen_unsigned_int(n_ch, 0);
7014
7015 ret_val = xmlIsExtender(ch);
7016 desret_int(ret_val);
7017 call_tests++;
7018 des_unsigned_int(n_ch, ch, 0);
7019 xmlResetLastError();
7020 if (mem_base != xmlMemBlocks()) {
7021 printf("Leak of %d blocks found in xmlIsExtender",
7022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007023 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007024 printf(" %d", n_ch);
7025 printf("\n");
7026 }
7027 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00007028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007029
Daniel Veillard42595322004-11-08 10:52:06 +00007030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007031}
7032
7033
7034static int
7035test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007037
Daniel Veillard3d97e662004-11-04 10:49:00 +00007038 int mem_base;
7039 int ret_val;
7040 unsigned int ch; /* character to validate */
7041 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007042
Daniel Veillard3d97e662004-11-04 10:49:00 +00007043 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7044 mem_base = xmlMemBlocks();
7045 ch = gen_unsigned_int(n_ch, 0);
7046
7047 ret_val = xmlIsIdeographic(ch);
7048 desret_int(ret_val);
7049 call_tests++;
7050 des_unsigned_int(n_ch, ch, 0);
7051 xmlResetLastError();
7052 if (mem_base != xmlMemBlocks()) {
7053 printf("Leak of %d blocks found in xmlIsIdeographic",
7054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007055 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007056 printf(" %d", n_ch);
7057 printf("\n");
7058 }
7059 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00007060 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007061
Daniel Veillard42595322004-11-08 10:52:06 +00007062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007063}
7064
7065
7066static int
7067test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007069
Daniel Veillard3d97e662004-11-04 10:49:00 +00007070 int mem_base;
7071 int ret_val;
7072 unsigned int ch; /* character to validate */
7073 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007074
Daniel Veillard3d97e662004-11-04 10:49:00 +00007075 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7076 mem_base = xmlMemBlocks();
7077 ch = gen_unsigned_int(n_ch, 0);
7078
7079 ret_val = xmlIsPubidChar(ch);
7080 desret_int(ret_val);
7081 call_tests++;
7082 des_unsigned_int(n_ch, ch, 0);
7083 xmlResetLastError();
7084 if (mem_base != xmlMemBlocks()) {
7085 printf("Leak of %d blocks found in xmlIsPubidChar",
7086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007087 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007088 printf(" %d", n_ch);
7089 printf("\n");
7090 }
7091 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00007092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007093
Daniel Veillard42595322004-11-08 10:52:06 +00007094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007095}
7096
7097static int
7098test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007100
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007101 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00007102 test_ret += test_xmlCharInRange();
7103 test_ret += test_xmlIsBaseChar();
7104 test_ret += test_xmlIsBlank();
7105 test_ret += test_xmlIsChar();
7106 test_ret += test_xmlIsCombining();
7107 test_ret += test_xmlIsDigit();
7108 test_ret += test_xmlIsExtender();
7109 test_ret += test_xmlIsIdeographic();
7110 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00007111
Daniel Veillard42595322004-11-08 10:52:06 +00007112 if (test_ret != 0)
7113 printf("Module chvalid: %d errors\n", test_ret);
7114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007115}
7116
7117static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00007118test_xmlBoolToText(void) {
7119 int test_ret = 0;
7120
7121#ifdef LIBXML_DEBUG_ENABLED
7122 int mem_base;
7123 const char * ret_val;
7124 int boolval; /* a bool to turn into text */
7125 int n_boolval;
7126
7127 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
7128 mem_base = xmlMemBlocks();
7129 boolval = gen_int(n_boolval, 0);
7130
7131 ret_val = xmlBoolToText(boolval);
7132 desret_const_char_ptr(ret_val);
7133 call_tests++;
7134 des_int(n_boolval, boolval, 0);
7135 xmlResetLastError();
7136 if (mem_base != xmlMemBlocks()) {
7137 printf("Leak of %d blocks found in xmlBoolToText",
7138 xmlMemBlocks() - mem_base);
7139 test_ret++;
7140 printf(" %d", n_boolval);
7141 printf("\n");
7142 }
7143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007144 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007145#endif
7146
Daniel Veillarda82b1822004-11-08 16:24:57 +00007147 return(test_ret);
7148}
7149
7150
7151static int
7152test_xmlDebugCheckDocument(void) {
7153 int test_ret = 0;
7154
7155#ifdef LIBXML_DEBUG_ENABLED
7156 int mem_base;
7157 int ret_val;
7158 FILE * output; /* the FILE * for the output */
7159 int n_output;
7160 xmlDocPtr doc; /* the document */
7161 int n_doc;
7162
7163 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7164 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7165 mem_base = xmlMemBlocks();
7166 output = gen_debug_FILE_ptr(n_output, 0);
7167 doc = gen_xmlDocPtr(n_doc, 1);
7168
7169 ret_val = xmlDebugCheckDocument(output, doc);
7170 desret_int(ret_val);
7171 call_tests++;
7172 des_debug_FILE_ptr(n_output, output, 0);
7173 des_xmlDocPtr(n_doc, doc, 1);
7174 xmlResetLastError();
7175 if (mem_base != xmlMemBlocks()) {
7176 printf("Leak of %d blocks found in xmlDebugCheckDocument",
7177 xmlMemBlocks() - mem_base);
7178 test_ret++;
7179 printf(" %d", n_output);
7180 printf(" %d", n_doc);
7181 printf("\n");
7182 }
7183 }
7184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007185 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007186#endif
7187
Daniel Veillarda82b1822004-11-08 16:24:57 +00007188 return(test_ret);
7189}
7190
7191
7192static int
7193test_xmlDebugDumpAttr(void) {
7194 int test_ret = 0;
7195
7196#ifdef LIBXML_DEBUG_ENABLED
7197 int mem_base;
7198 FILE * output; /* the FILE * for the output */
7199 int n_output;
7200 xmlAttrPtr attr; /* the attribute */
7201 int n_attr;
7202 int depth; /* the indentation level. */
7203 int n_depth;
7204
7205 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7206 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7207 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7208 mem_base = xmlMemBlocks();
7209 output = gen_debug_FILE_ptr(n_output, 0);
7210 attr = gen_xmlAttrPtr(n_attr, 1);
7211 depth = gen_int(n_depth, 2);
7212
7213 xmlDebugDumpAttr(output, attr, depth);
7214 call_tests++;
7215 des_debug_FILE_ptr(n_output, output, 0);
7216 des_xmlAttrPtr(n_attr, attr, 1);
7217 des_int(n_depth, depth, 2);
7218 xmlResetLastError();
7219 if (mem_base != xmlMemBlocks()) {
7220 printf("Leak of %d blocks found in xmlDebugDumpAttr",
7221 xmlMemBlocks() - mem_base);
7222 test_ret++;
7223 printf(" %d", n_output);
7224 printf(" %d", n_attr);
7225 printf(" %d", n_depth);
7226 printf("\n");
7227 }
7228 }
7229 }
7230 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007231 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007232#endif
7233
Daniel Veillarda82b1822004-11-08 16:24:57 +00007234 return(test_ret);
7235}
7236
7237
7238static int
7239test_xmlDebugDumpAttrList(void) {
7240 int test_ret = 0;
7241
7242#ifdef LIBXML_DEBUG_ENABLED
7243 int mem_base;
7244 FILE * output; /* the FILE * for the output */
7245 int n_output;
7246 xmlAttrPtr attr; /* the attribute list */
7247 int n_attr;
7248 int depth; /* the indentation level. */
7249 int n_depth;
7250
7251 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7252 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7253 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7254 mem_base = xmlMemBlocks();
7255 output = gen_debug_FILE_ptr(n_output, 0);
7256 attr = gen_xmlAttrPtr(n_attr, 1);
7257 depth = gen_int(n_depth, 2);
7258
7259 xmlDebugDumpAttrList(output, attr, depth);
7260 call_tests++;
7261 des_debug_FILE_ptr(n_output, output, 0);
7262 des_xmlAttrPtr(n_attr, attr, 1);
7263 des_int(n_depth, depth, 2);
7264 xmlResetLastError();
7265 if (mem_base != xmlMemBlocks()) {
7266 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
7267 xmlMemBlocks() - mem_base);
7268 test_ret++;
7269 printf(" %d", n_output);
7270 printf(" %d", n_attr);
7271 printf(" %d", n_depth);
7272 printf("\n");
7273 }
7274 }
7275 }
7276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007277 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007278#endif
7279
Daniel Veillarda82b1822004-11-08 16:24:57 +00007280 return(test_ret);
7281}
7282
7283
7284static int
7285test_xmlDebugDumpDTD(void) {
7286 int test_ret = 0;
7287
7288#ifdef LIBXML_DEBUG_ENABLED
7289 int mem_base;
7290 FILE * output; /* the FILE * for the output */
7291 int n_output;
7292 xmlDtdPtr dtd; /* the DTD */
7293 int n_dtd;
7294
7295 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7296 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
7297 mem_base = xmlMemBlocks();
7298 output = gen_debug_FILE_ptr(n_output, 0);
7299 dtd = gen_xmlDtdPtr(n_dtd, 1);
7300
7301 xmlDebugDumpDTD(output, dtd);
7302 call_tests++;
7303 des_debug_FILE_ptr(n_output, output, 0);
7304 des_xmlDtdPtr(n_dtd, dtd, 1);
7305 xmlResetLastError();
7306 if (mem_base != xmlMemBlocks()) {
7307 printf("Leak of %d blocks found in xmlDebugDumpDTD",
7308 xmlMemBlocks() - mem_base);
7309 test_ret++;
7310 printf(" %d", n_output);
7311 printf(" %d", n_dtd);
7312 printf("\n");
7313 }
7314 }
7315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007316 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007317#endif
7318
Daniel Veillarda82b1822004-11-08 16:24:57 +00007319 return(test_ret);
7320}
7321
7322
7323static int
7324test_xmlDebugDumpDocument(void) {
7325 int test_ret = 0;
7326
7327#ifdef LIBXML_DEBUG_ENABLED
7328 int mem_base;
7329 FILE * output; /* the FILE * for the output */
7330 int n_output;
7331 xmlDocPtr doc; /* the document */
7332 int n_doc;
7333
7334 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7335 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7336 mem_base = xmlMemBlocks();
7337 output = gen_debug_FILE_ptr(n_output, 0);
7338 doc = gen_xmlDocPtr(n_doc, 1);
7339
7340 xmlDebugDumpDocument(output, doc);
7341 call_tests++;
7342 des_debug_FILE_ptr(n_output, output, 0);
7343 des_xmlDocPtr(n_doc, doc, 1);
7344 xmlResetLastError();
7345 if (mem_base != xmlMemBlocks()) {
7346 printf("Leak of %d blocks found in xmlDebugDumpDocument",
7347 xmlMemBlocks() - mem_base);
7348 test_ret++;
7349 printf(" %d", n_output);
7350 printf(" %d", n_doc);
7351 printf("\n");
7352 }
7353 }
7354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007355 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007356#endif
7357
Daniel Veillarda82b1822004-11-08 16:24:57 +00007358 return(test_ret);
7359}
7360
7361
7362static int
7363test_xmlDebugDumpDocumentHead(void) {
7364 int test_ret = 0;
7365
7366#ifdef LIBXML_DEBUG_ENABLED
7367 int mem_base;
7368 FILE * output; /* the FILE * for the output */
7369 int n_output;
7370 xmlDocPtr doc; /* the document */
7371 int n_doc;
7372
7373 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7374 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7375 mem_base = xmlMemBlocks();
7376 output = gen_debug_FILE_ptr(n_output, 0);
7377 doc = gen_xmlDocPtr(n_doc, 1);
7378
7379 xmlDebugDumpDocumentHead(output, doc);
7380 call_tests++;
7381 des_debug_FILE_ptr(n_output, output, 0);
7382 des_xmlDocPtr(n_doc, doc, 1);
7383 xmlResetLastError();
7384 if (mem_base != xmlMemBlocks()) {
7385 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7386 xmlMemBlocks() - mem_base);
7387 test_ret++;
7388 printf(" %d", n_output);
7389 printf(" %d", n_doc);
7390 printf("\n");
7391 }
7392 }
7393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007394 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007395#endif
7396
Daniel Veillarda82b1822004-11-08 16:24:57 +00007397 return(test_ret);
7398}
7399
7400
7401static int
7402test_xmlDebugDumpEntities(void) {
7403 int test_ret = 0;
7404
7405#ifdef LIBXML_DEBUG_ENABLED
7406 int mem_base;
7407 FILE * output; /* the FILE * for the output */
7408 int n_output;
7409 xmlDocPtr doc; /* the document */
7410 int n_doc;
7411
7412 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7413 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7414 mem_base = xmlMemBlocks();
7415 output = gen_debug_FILE_ptr(n_output, 0);
7416 doc = gen_xmlDocPtr(n_doc, 1);
7417
7418 xmlDebugDumpEntities(output, doc);
7419 call_tests++;
7420 des_debug_FILE_ptr(n_output, output, 0);
7421 des_xmlDocPtr(n_doc, doc, 1);
7422 xmlResetLastError();
7423 if (mem_base != xmlMemBlocks()) {
7424 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7425 xmlMemBlocks() - mem_base);
7426 test_ret++;
7427 printf(" %d", n_output);
7428 printf(" %d", n_doc);
7429 printf("\n");
7430 }
7431 }
7432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007433 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007434#endif
7435
Daniel Veillarda82b1822004-11-08 16:24:57 +00007436 return(test_ret);
7437}
7438
7439
7440static int
7441test_xmlDebugDumpNode(void) {
7442 int test_ret = 0;
7443
7444#ifdef LIBXML_DEBUG_ENABLED
7445 int mem_base;
7446 FILE * output; /* the FILE * for the output */
7447 int n_output;
7448 xmlNodePtr node; /* the node */
7449 int n_node;
7450 int depth; /* the indentation level. */
7451 int n_depth;
7452
7453 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7454 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7455 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7456 mem_base = xmlMemBlocks();
7457 output = gen_debug_FILE_ptr(n_output, 0);
7458 node = gen_xmlNodePtr(n_node, 1);
7459 depth = gen_int(n_depth, 2);
7460
7461 xmlDebugDumpNode(output, node, depth);
7462 call_tests++;
7463 des_debug_FILE_ptr(n_output, output, 0);
7464 des_xmlNodePtr(n_node, node, 1);
7465 des_int(n_depth, depth, 2);
7466 xmlResetLastError();
7467 if (mem_base != xmlMemBlocks()) {
7468 printf("Leak of %d blocks found in xmlDebugDumpNode",
7469 xmlMemBlocks() - mem_base);
7470 test_ret++;
7471 printf(" %d", n_output);
7472 printf(" %d", n_node);
7473 printf(" %d", n_depth);
7474 printf("\n");
7475 }
7476 }
7477 }
7478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007479 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007480#endif
7481
Daniel Veillarda82b1822004-11-08 16:24:57 +00007482 return(test_ret);
7483}
7484
7485
7486static int
7487test_xmlDebugDumpNodeList(void) {
7488 int test_ret = 0;
7489
7490#ifdef LIBXML_DEBUG_ENABLED
7491 int mem_base;
7492 FILE * output; /* the FILE * for the output */
7493 int n_output;
7494 xmlNodePtr node; /* the node list */
7495 int n_node;
7496 int depth; /* the indentation level. */
7497 int n_depth;
7498
7499 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7500 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7501 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7502 mem_base = xmlMemBlocks();
7503 output = gen_debug_FILE_ptr(n_output, 0);
7504 node = gen_xmlNodePtr(n_node, 1);
7505 depth = gen_int(n_depth, 2);
7506
7507 xmlDebugDumpNodeList(output, node, depth);
7508 call_tests++;
7509 des_debug_FILE_ptr(n_output, output, 0);
7510 des_xmlNodePtr(n_node, node, 1);
7511 des_int(n_depth, depth, 2);
7512 xmlResetLastError();
7513 if (mem_base != xmlMemBlocks()) {
7514 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7515 xmlMemBlocks() - mem_base);
7516 test_ret++;
7517 printf(" %d", n_output);
7518 printf(" %d", n_node);
7519 printf(" %d", n_depth);
7520 printf("\n");
7521 }
7522 }
7523 }
7524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007525 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007526#endif
7527
Daniel Veillarda82b1822004-11-08 16:24:57 +00007528 return(test_ret);
7529}
7530
7531
7532static int
7533test_xmlDebugDumpOneNode(void) {
7534 int test_ret = 0;
7535
7536#ifdef LIBXML_DEBUG_ENABLED
7537 int mem_base;
7538 FILE * output; /* the FILE * for the output */
7539 int n_output;
7540 xmlNodePtr node; /* the node */
7541 int n_node;
7542 int depth; /* the indentation level. */
7543 int n_depth;
7544
7545 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7546 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7547 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7548 mem_base = xmlMemBlocks();
7549 output = gen_debug_FILE_ptr(n_output, 0);
7550 node = gen_xmlNodePtr(n_node, 1);
7551 depth = gen_int(n_depth, 2);
7552
7553 xmlDebugDumpOneNode(output, node, depth);
7554 call_tests++;
7555 des_debug_FILE_ptr(n_output, output, 0);
7556 des_xmlNodePtr(n_node, node, 1);
7557 des_int(n_depth, depth, 2);
7558 xmlResetLastError();
7559 if (mem_base != xmlMemBlocks()) {
7560 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7561 xmlMemBlocks() - mem_base);
7562 test_ret++;
7563 printf(" %d", n_output);
7564 printf(" %d", n_node);
7565 printf(" %d", n_depth);
7566 printf("\n");
7567 }
7568 }
7569 }
7570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007571 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007572#endif
7573
Daniel Veillarda82b1822004-11-08 16:24:57 +00007574 return(test_ret);
7575}
7576
7577
7578static int
7579test_xmlDebugDumpString(void) {
7580 int test_ret = 0;
7581
7582#ifdef LIBXML_DEBUG_ENABLED
7583 int mem_base;
7584 FILE * output; /* the FILE * for the output */
7585 int n_output;
7586 xmlChar * str; /* the string */
7587 int n_str;
7588
7589 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7590 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7591 mem_base = xmlMemBlocks();
7592 output = gen_debug_FILE_ptr(n_output, 0);
7593 str = gen_const_xmlChar_ptr(n_str, 1);
7594
William M. Brackf13f77f2004-11-12 16:03:48 +00007595 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007596 call_tests++;
7597 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007598 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007599 xmlResetLastError();
7600 if (mem_base != xmlMemBlocks()) {
7601 printf("Leak of %d blocks found in xmlDebugDumpString",
7602 xmlMemBlocks() - mem_base);
7603 test_ret++;
7604 printf(" %d", n_output);
7605 printf(" %d", n_str);
7606 printf("\n");
7607 }
7608 }
7609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007610 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007611#endif
7612
Daniel Veillarda82b1822004-11-08 16:24:57 +00007613 return(test_ret);
7614}
7615
7616
7617static int
7618test_xmlLsCountNode(void) {
7619 int test_ret = 0;
7620
7621#ifdef LIBXML_DEBUG_ENABLED
7622 int mem_base;
7623 int ret_val;
7624 xmlNodePtr node; /* the node to count */
7625 int n_node;
7626
7627 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7628 mem_base = xmlMemBlocks();
7629 node = gen_xmlNodePtr(n_node, 0);
7630
7631 ret_val = xmlLsCountNode(node);
7632 desret_int(ret_val);
7633 call_tests++;
7634 des_xmlNodePtr(n_node, node, 0);
7635 xmlResetLastError();
7636 if (mem_base != xmlMemBlocks()) {
7637 printf("Leak of %d blocks found in xmlLsCountNode",
7638 xmlMemBlocks() - mem_base);
7639 test_ret++;
7640 printf(" %d", n_node);
7641 printf("\n");
7642 }
7643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007644 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007645#endif
7646
Daniel Veillarda82b1822004-11-08 16:24:57 +00007647 return(test_ret);
7648}
7649
7650
7651static int
7652test_xmlLsOneNode(void) {
7653 int test_ret = 0;
7654
7655#ifdef LIBXML_DEBUG_ENABLED
7656 int mem_base;
7657 FILE * output; /* the FILE * for the output */
7658 int n_output;
7659 xmlNodePtr node; /* the node to dump */
7660 int n_node;
7661
7662 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7663 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7664 mem_base = xmlMemBlocks();
7665 output = gen_debug_FILE_ptr(n_output, 0);
7666 node = gen_xmlNodePtr(n_node, 1);
7667
7668 xmlLsOneNode(output, node);
7669 call_tests++;
7670 des_debug_FILE_ptr(n_output, output, 0);
7671 des_xmlNodePtr(n_node, node, 1);
7672 xmlResetLastError();
7673 if (mem_base != xmlMemBlocks()) {
7674 printf("Leak of %d blocks found in xmlLsOneNode",
7675 xmlMemBlocks() - mem_base);
7676 test_ret++;
7677 printf(" %d", n_output);
7678 printf(" %d", n_node);
7679 printf("\n");
7680 }
7681 }
7682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007683 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007684#endif
7685
Daniel Veillarda82b1822004-11-08 16:24:57 +00007686 return(test_ret);
7687}
7688
7689
7690#define gen_nb_char_ptr 1
7691static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7692 return(NULL);
7693}
7694static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7695}
7696
7697static int
7698test_xmlShell(void) {
7699 int test_ret = 0;
7700
7701
7702 /* missing type support */
7703 return(test_ret);
7704}
7705
7706
Daniel Veillarda82b1822004-11-08 16:24:57 +00007707static int
7708test_xmlShellBase(void) {
7709 int test_ret = 0;
7710
7711#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007712#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007713 int mem_base;
7714 int ret_val;
7715 xmlShellCtxtPtr ctxt; /* the shell context */
7716 int n_ctxt;
7717 char * arg; /* unused */
7718 int n_arg;
7719 xmlNodePtr node; /* a node */
7720 int n_node;
7721 xmlNodePtr node2; /* unused */
7722 int n_node2;
7723
7724 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7725 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7726 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7727 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7728 mem_base = xmlMemBlocks();
7729 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7730 arg = gen_char_ptr(n_arg, 1);
7731 node = gen_xmlNodePtr(n_node, 2);
7732 node2 = gen_xmlNodePtr(n_node2, 3);
7733
7734 ret_val = xmlShellBase(ctxt, arg, node, node2);
7735 desret_int(ret_val);
7736 call_tests++;
7737 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7738 des_char_ptr(n_arg, arg, 1);
7739 des_xmlNodePtr(n_node, node, 2);
7740 des_xmlNodePtr(n_node2, node2, 3);
7741 xmlResetLastError();
7742 if (mem_base != xmlMemBlocks()) {
7743 printf("Leak of %d blocks found in xmlShellBase",
7744 xmlMemBlocks() - mem_base);
7745 test_ret++;
7746 printf(" %d", n_ctxt);
7747 printf(" %d", n_arg);
7748 printf(" %d", n_node);
7749 printf(" %d", n_node2);
7750 printf("\n");
7751 }
7752 }
7753 }
7754 }
7755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007756 function_tests++;
7757#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007758#endif
7759
Daniel Veillarda82b1822004-11-08 16:24:57 +00007760 return(test_ret);
7761}
7762
7763
7764static int
7765test_xmlShellCat(void) {
7766 int test_ret = 0;
7767
7768#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007769#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007770 int mem_base;
7771 int ret_val;
7772 xmlShellCtxtPtr ctxt; /* the shell context */
7773 int n_ctxt;
7774 char * arg; /* unused */
7775 int n_arg;
7776 xmlNodePtr node; /* a node */
7777 int n_node;
7778 xmlNodePtr node2; /* unused */
7779 int n_node2;
7780
7781 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7782 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7783 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7784 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7785 mem_base = xmlMemBlocks();
7786 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7787 arg = gen_char_ptr(n_arg, 1);
7788 node = gen_xmlNodePtr(n_node, 2);
7789 node2 = gen_xmlNodePtr(n_node2, 3);
7790
7791 ret_val = xmlShellCat(ctxt, arg, node, node2);
7792 desret_int(ret_val);
7793 call_tests++;
7794 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7795 des_char_ptr(n_arg, arg, 1);
7796 des_xmlNodePtr(n_node, node, 2);
7797 des_xmlNodePtr(n_node2, node2, 3);
7798 xmlResetLastError();
7799 if (mem_base != xmlMemBlocks()) {
7800 printf("Leak of %d blocks found in xmlShellCat",
7801 xmlMemBlocks() - mem_base);
7802 test_ret++;
7803 printf(" %d", n_ctxt);
7804 printf(" %d", n_arg);
7805 printf(" %d", n_node);
7806 printf(" %d", n_node2);
7807 printf("\n");
7808 }
7809 }
7810 }
7811 }
7812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007813 function_tests++;
7814#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007815#endif
7816
Daniel Veillarda82b1822004-11-08 16:24:57 +00007817 return(test_ret);
7818}
7819
7820
7821static int
7822test_xmlShellDir(void) {
7823 int test_ret = 0;
7824
7825#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007826#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007827 int mem_base;
7828 int ret_val;
7829 xmlShellCtxtPtr ctxt; /* the shell context */
7830 int n_ctxt;
7831 char * arg; /* unused */
7832 int n_arg;
7833 xmlNodePtr node; /* a node */
7834 int n_node;
7835 xmlNodePtr node2; /* unused */
7836 int n_node2;
7837
7838 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7839 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7840 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7841 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7842 mem_base = xmlMemBlocks();
7843 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7844 arg = gen_char_ptr(n_arg, 1);
7845 node = gen_xmlNodePtr(n_node, 2);
7846 node2 = gen_xmlNodePtr(n_node2, 3);
7847
7848 ret_val = xmlShellDir(ctxt, arg, node, node2);
7849 desret_int(ret_val);
7850 call_tests++;
7851 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7852 des_char_ptr(n_arg, arg, 1);
7853 des_xmlNodePtr(n_node, node, 2);
7854 des_xmlNodePtr(n_node2, node2, 3);
7855 xmlResetLastError();
7856 if (mem_base != xmlMemBlocks()) {
7857 printf("Leak of %d blocks found in xmlShellDir",
7858 xmlMemBlocks() - mem_base);
7859 test_ret++;
7860 printf(" %d", n_ctxt);
7861 printf(" %d", n_arg);
7862 printf(" %d", n_node);
7863 printf(" %d", n_node2);
7864 printf("\n");
7865 }
7866 }
7867 }
7868 }
7869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007870 function_tests++;
7871#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007872#endif
7873
Daniel Veillarda82b1822004-11-08 16:24:57 +00007874 return(test_ret);
7875}
7876
7877
7878static int
7879test_xmlShellDu(void) {
7880 int test_ret = 0;
7881
7882#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007883#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007884 int mem_base;
7885 int ret_val;
7886 xmlShellCtxtPtr ctxt; /* the shell context */
7887 int n_ctxt;
7888 char * arg; /* unused */
7889 int n_arg;
7890 xmlNodePtr tree; /* a node defining a subtree */
7891 int n_tree;
7892 xmlNodePtr node2; /* unused */
7893 int n_node2;
7894
7895 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7896 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7897 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7898 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7899 mem_base = xmlMemBlocks();
7900 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7901 arg = gen_char_ptr(n_arg, 1);
7902 tree = gen_xmlNodePtr(n_tree, 2);
7903 node2 = gen_xmlNodePtr(n_node2, 3);
7904
7905 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7906 desret_int(ret_val);
7907 call_tests++;
7908 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7909 des_char_ptr(n_arg, arg, 1);
7910 des_xmlNodePtr(n_tree, tree, 2);
7911 des_xmlNodePtr(n_node2, node2, 3);
7912 xmlResetLastError();
7913 if (mem_base != xmlMemBlocks()) {
7914 printf("Leak of %d blocks found in xmlShellDu",
7915 xmlMemBlocks() - mem_base);
7916 test_ret++;
7917 printf(" %d", n_ctxt);
7918 printf(" %d", n_arg);
7919 printf(" %d", n_tree);
7920 printf(" %d", n_node2);
7921 printf("\n");
7922 }
7923 }
7924 }
7925 }
7926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007927 function_tests++;
7928#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007929#endif
7930
Daniel Veillarda82b1822004-11-08 16:24:57 +00007931 return(test_ret);
7932}
7933
7934
7935static int
7936test_xmlShellList(void) {
7937 int test_ret = 0;
7938
7939#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007940#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007941 int mem_base;
7942 int ret_val;
7943 xmlShellCtxtPtr ctxt; /* the shell context */
7944 int n_ctxt;
7945 char * arg; /* unused */
7946 int n_arg;
7947 xmlNodePtr node; /* a node */
7948 int n_node;
7949 xmlNodePtr node2; /* unused */
7950 int n_node2;
7951
7952 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7953 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7954 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7955 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7956 mem_base = xmlMemBlocks();
7957 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7958 arg = gen_char_ptr(n_arg, 1);
7959 node = gen_xmlNodePtr(n_node, 2);
7960 node2 = gen_xmlNodePtr(n_node2, 3);
7961
7962 ret_val = xmlShellList(ctxt, arg, node, node2);
7963 desret_int(ret_val);
7964 call_tests++;
7965 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7966 des_char_ptr(n_arg, arg, 1);
7967 des_xmlNodePtr(n_node, node, 2);
7968 des_xmlNodePtr(n_node2, node2, 3);
7969 xmlResetLastError();
7970 if (mem_base != xmlMemBlocks()) {
7971 printf("Leak of %d blocks found in xmlShellList",
7972 xmlMemBlocks() - mem_base);
7973 test_ret++;
7974 printf(" %d", n_ctxt);
7975 printf(" %d", n_arg);
7976 printf(" %d", n_node);
7977 printf(" %d", n_node2);
7978 printf("\n");
7979 }
7980 }
7981 }
7982 }
7983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007984 function_tests++;
7985#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007986#endif
7987
Daniel Veillarda82b1822004-11-08 16:24:57 +00007988 return(test_ret);
7989}
7990
7991
7992static int
7993test_xmlShellLoad(void) {
7994 int test_ret = 0;
7995
7996#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007997#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007998 int mem_base;
7999 int ret_val;
8000 xmlShellCtxtPtr ctxt; /* the shell context */
8001 int n_ctxt;
8002 char * filename; /* the file name */
8003 int n_filename;
8004 xmlNodePtr node; /* unused */
8005 int n_node;
8006 xmlNodePtr node2; /* unused */
8007 int n_node2;
8008
8009 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8010 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8011 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8012 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8013 mem_base = xmlMemBlocks();
8014 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8015 filename = gen_char_ptr(n_filename, 1);
8016 node = gen_xmlNodePtr(n_node, 2);
8017 node2 = gen_xmlNodePtr(n_node2, 3);
8018
8019 ret_val = xmlShellLoad(ctxt, filename, node, node2);
8020 desret_int(ret_val);
8021 call_tests++;
8022 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8023 des_char_ptr(n_filename, filename, 1);
8024 des_xmlNodePtr(n_node, node, 2);
8025 des_xmlNodePtr(n_node2, node2, 3);
8026 xmlResetLastError();
8027 if (mem_base != xmlMemBlocks()) {
8028 printf("Leak of %d blocks found in xmlShellLoad",
8029 xmlMemBlocks() - mem_base);
8030 test_ret++;
8031 printf(" %d", n_ctxt);
8032 printf(" %d", n_filename);
8033 printf(" %d", n_node);
8034 printf(" %d", n_node2);
8035 printf("\n");
8036 }
8037 }
8038 }
8039 }
8040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008041 function_tests++;
8042#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008043#endif
8044
Daniel Veillarda82b1822004-11-08 16:24:57 +00008045 return(test_ret);
8046}
8047
8048
8049static int
8050test_xmlShellPrintXPathResult(void) {
8051 int test_ret = 0;
8052
8053#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008054#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008055 int mem_base;
8056 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
8057 int n_list;
8058
8059 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
8060 mem_base = xmlMemBlocks();
8061 list = gen_xmlXPathObjectPtr(n_list, 0);
8062
8063 xmlShellPrintXPathResult(list);
8064 call_tests++;
8065 des_xmlXPathObjectPtr(n_list, list, 0);
8066 xmlResetLastError();
8067 if (mem_base != xmlMemBlocks()) {
8068 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
8069 xmlMemBlocks() - mem_base);
8070 test_ret++;
8071 printf(" %d", n_list);
8072 printf("\n");
8073 }
8074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008075 function_tests++;
8076#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008077#endif
8078
Daniel Veillarda82b1822004-11-08 16:24:57 +00008079 return(test_ret);
8080}
8081
8082
8083static int
8084test_xmlShellPwd(void) {
8085 int test_ret = 0;
8086
8087#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008088#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008089 int mem_base;
8090 int ret_val;
8091 xmlShellCtxtPtr ctxt; /* the shell context */
8092 int n_ctxt;
8093 char * buffer; /* the output buffer */
8094 int n_buffer;
8095 xmlNodePtr node; /* a node */
8096 int n_node;
8097 xmlNodePtr node2; /* unused */
8098 int n_node2;
8099
8100 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8101 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
8102 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8103 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8104 mem_base = xmlMemBlocks();
8105 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8106 buffer = gen_char_ptr(n_buffer, 1);
8107 node = gen_xmlNodePtr(n_node, 2);
8108 node2 = gen_xmlNodePtr(n_node2, 3);
8109
8110 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
8111 desret_int(ret_val);
8112 call_tests++;
8113 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8114 des_char_ptr(n_buffer, buffer, 1);
8115 des_xmlNodePtr(n_node, node, 2);
8116 des_xmlNodePtr(n_node2, node2, 3);
8117 xmlResetLastError();
8118 if (mem_base != xmlMemBlocks()) {
8119 printf("Leak of %d blocks found in xmlShellPwd",
8120 xmlMemBlocks() - mem_base);
8121 test_ret++;
8122 printf(" %d", n_ctxt);
8123 printf(" %d", n_buffer);
8124 printf(" %d", n_node);
8125 printf(" %d", n_node2);
8126 printf("\n");
8127 }
8128 }
8129 }
8130 }
8131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008132 function_tests++;
8133#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008134#endif
8135
Daniel Veillarda82b1822004-11-08 16:24:57 +00008136 return(test_ret);
8137}
8138
8139
8140static int
8141test_xmlShellSave(void) {
8142 int test_ret = 0;
8143
8144#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008145#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008146#ifdef LIBXML_OUTPUT_ENABLED
8147 int mem_base;
8148 int ret_val;
8149 xmlShellCtxtPtr ctxt; /* the shell context */
8150 int n_ctxt;
8151 char * filename; /* the file name (optional) */
8152 int n_filename;
8153 xmlNodePtr node; /* unused */
8154 int n_node;
8155 xmlNodePtr node2; /* unused */
8156 int n_node2;
8157
8158 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8159 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8160 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8161 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8162 mem_base = xmlMemBlocks();
8163 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8164 filename = gen_char_ptr(n_filename, 1);
8165 node = gen_xmlNodePtr(n_node, 2);
8166 node2 = gen_xmlNodePtr(n_node2, 3);
8167
8168 ret_val = xmlShellSave(ctxt, filename, node, node2);
8169 desret_int(ret_val);
8170 call_tests++;
8171 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8172 des_char_ptr(n_filename, filename, 1);
8173 des_xmlNodePtr(n_node, node, 2);
8174 des_xmlNodePtr(n_node2, node2, 3);
8175 xmlResetLastError();
8176 if (mem_base != xmlMemBlocks()) {
8177 printf("Leak of %d blocks found in xmlShellSave",
8178 xmlMemBlocks() - mem_base);
8179 test_ret++;
8180 printf(" %d", n_ctxt);
8181 printf(" %d", n_filename);
8182 printf(" %d", n_node);
8183 printf(" %d", n_node2);
8184 printf("\n");
8185 }
8186 }
8187 }
8188 }
8189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008190 function_tests++;
8191#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008192#endif
8193#endif
8194
Daniel Veillarda82b1822004-11-08 16:24:57 +00008195 return(test_ret);
8196}
8197
8198
8199static int
8200test_xmlShellValidate(void) {
8201 int test_ret = 0;
8202
8203#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008204#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008205 int mem_base;
8206 int ret_val;
8207 xmlShellCtxtPtr ctxt; /* the shell context */
8208 int n_ctxt;
8209 char * dtd; /* the DTD URI (optional) */
8210 int n_dtd;
8211 xmlNodePtr node; /* unused */
8212 int n_node;
8213 xmlNodePtr node2; /* unused */
8214 int n_node2;
8215
8216 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8217 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
8218 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8219 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8220 mem_base = xmlMemBlocks();
8221 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8222 dtd = gen_char_ptr(n_dtd, 1);
8223 node = gen_xmlNodePtr(n_node, 2);
8224 node2 = gen_xmlNodePtr(n_node2, 3);
8225
8226 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
8227 desret_int(ret_val);
8228 call_tests++;
8229 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8230 des_char_ptr(n_dtd, dtd, 1);
8231 des_xmlNodePtr(n_node, node, 2);
8232 des_xmlNodePtr(n_node2, node2, 3);
8233 xmlResetLastError();
8234 if (mem_base != xmlMemBlocks()) {
8235 printf("Leak of %d blocks found in xmlShellValidate",
8236 xmlMemBlocks() - mem_base);
8237 test_ret++;
8238 printf(" %d", n_ctxt);
8239 printf(" %d", n_dtd);
8240 printf(" %d", n_node);
8241 printf(" %d", n_node2);
8242 printf("\n");
8243 }
8244 }
8245 }
8246 }
8247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008248 function_tests++;
8249#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008250#endif
8251
Daniel Veillarda82b1822004-11-08 16:24:57 +00008252 return(test_ret);
8253}
8254
8255
8256static int
8257test_xmlShellWrite(void) {
8258 int test_ret = 0;
8259
8260#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008261#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008262#ifdef LIBXML_OUTPUT_ENABLED
8263 int mem_base;
8264 int ret_val;
8265 xmlShellCtxtPtr ctxt; /* the shell context */
8266 int n_ctxt;
8267 char * filename; /* the file name */
8268 int n_filename;
8269 xmlNodePtr node; /* a node in the tree */
8270 int n_node;
8271 xmlNodePtr node2; /* unused */
8272 int n_node2;
8273
8274 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8275 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8276 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8277 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8278 mem_base = xmlMemBlocks();
8279 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8280 filename = gen_char_ptr(n_filename, 1);
8281 node = gen_xmlNodePtr(n_node, 2);
8282 node2 = gen_xmlNodePtr(n_node2, 3);
8283
8284 ret_val = xmlShellWrite(ctxt, filename, node, node2);
8285 desret_int(ret_val);
8286 call_tests++;
8287 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8288 des_char_ptr(n_filename, filename, 1);
8289 des_xmlNodePtr(n_node, node, 2);
8290 des_xmlNodePtr(n_node2, node2, 3);
8291 xmlResetLastError();
8292 if (mem_base != xmlMemBlocks()) {
8293 printf("Leak of %d blocks found in xmlShellWrite",
8294 xmlMemBlocks() - mem_base);
8295 test_ret++;
8296 printf(" %d", n_ctxt);
8297 printf(" %d", n_filename);
8298 printf(" %d", n_node);
8299 printf(" %d", n_node2);
8300 printf("\n");
8301 }
8302 }
8303 }
8304 }
8305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008306 function_tests++;
8307#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008308#endif
8309#endif
8310
Daniel Veillarda82b1822004-11-08 16:24:57 +00008311 return(test_ret);
8312}
8313
8314static int
8315test_debugXML(void) {
8316 int test_ret = 0;
8317
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008318 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00008319 test_ret += test_xmlBoolToText();
8320 test_ret += test_xmlDebugCheckDocument();
8321 test_ret += test_xmlDebugDumpAttr();
8322 test_ret += test_xmlDebugDumpAttrList();
8323 test_ret += test_xmlDebugDumpDTD();
8324 test_ret += test_xmlDebugDumpDocument();
8325 test_ret += test_xmlDebugDumpDocumentHead();
8326 test_ret += test_xmlDebugDumpEntities();
8327 test_ret += test_xmlDebugDumpNode();
8328 test_ret += test_xmlDebugDumpNodeList();
8329 test_ret += test_xmlDebugDumpOneNode();
8330 test_ret += test_xmlDebugDumpString();
8331 test_ret += test_xmlLsCountNode();
8332 test_ret += test_xmlLsOneNode();
8333 test_ret += test_xmlShell();
8334 test_ret += test_xmlShellBase();
8335 test_ret += test_xmlShellCat();
8336 test_ret += test_xmlShellDir();
8337 test_ret += test_xmlShellDu();
8338 test_ret += test_xmlShellList();
8339 test_ret += test_xmlShellLoad();
8340 test_ret += test_xmlShellPrintXPathResult();
8341 test_ret += test_xmlShellPwd();
8342 test_ret += test_xmlShellSave();
8343 test_ret += test_xmlShellValidate();
8344 test_ret += test_xmlShellWrite();
8345
8346 if (test_ret != 0)
8347 printf("Module debugXML: %d errors\n", test_ret);
8348 return(test_ret);
8349}
8350
8351static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008352test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008354
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008355 int mem_base;
8356 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008357
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008358 mem_base = xmlMemBlocks();
8359
8360 ret_val = xmlDictCreate();
8361 desret_xmlDictPtr(ret_val);
8362 call_tests++;
8363 xmlResetLastError();
8364 if (mem_base != xmlMemBlocks()) {
8365 printf("Leak of %d blocks found in xmlDictCreate",
8366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008367 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008368 printf("\n");
8369 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008371
Daniel Veillard42595322004-11-08 10:52:06 +00008372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008373}
8374
8375
8376static int
8377test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008379
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008380 int mem_base;
8381 xmlDictPtr ret_val;
8382 xmlDictPtr sub; /* an existing dictionnary */
8383 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008384
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008385 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8386 mem_base = xmlMemBlocks();
8387 sub = gen_xmlDictPtr(n_sub, 0);
8388
8389 ret_val = xmlDictCreateSub(sub);
8390 desret_xmlDictPtr(ret_val);
8391 call_tests++;
8392 des_xmlDictPtr(n_sub, sub, 0);
8393 xmlResetLastError();
8394 if (mem_base != xmlMemBlocks()) {
8395 printf("Leak of %d blocks found in xmlDictCreateSub",
8396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008397 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008398 printf(" %d", n_sub);
8399 printf("\n");
8400 }
8401 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008403
Daniel Veillard42595322004-11-08 10:52:06 +00008404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008405}
8406
8407
8408static int
8409test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008411
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008412 int mem_base;
8413 const xmlChar * ret_val;
8414 xmlDictPtr dict; /* the dictionnary */
8415 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008416 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008417 int n_name;
8418 int len; /* the length of the name, if -1 it is recomputed */
8419 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008420
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008421 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8422 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8423 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8424 mem_base = xmlMemBlocks();
8425 dict = gen_xmlDictPtr(n_dict, 0);
8426 name = gen_const_xmlChar_ptr(n_name, 1);
8427 len = gen_int(n_len, 2);
8428
William M. Brackf13f77f2004-11-12 16:03:48 +00008429 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008430 desret_const_xmlChar_ptr(ret_val);
8431 call_tests++;
8432 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008433 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008434 des_int(n_len, len, 2);
8435 xmlResetLastError();
8436 if (mem_base != xmlMemBlocks()) {
8437 printf("Leak of %d blocks found in xmlDictLookup",
8438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008439 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008440 printf(" %d", n_dict);
8441 printf(" %d", n_name);
8442 printf(" %d", n_len);
8443 printf("\n");
8444 }
8445 }
8446 }
8447 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008449
Daniel Veillard42595322004-11-08 10:52:06 +00008450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008451}
8452
8453
8454static int
8455test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008457
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008458 int mem_base;
8459 int ret_val;
8460 xmlDictPtr dict; /* the dictionnary */
8461 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008462 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008463 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008464
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008465 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8466 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8467 mem_base = xmlMemBlocks();
8468 dict = gen_xmlDictPtr(n_dict, 0);
8469 str = gen_const_xmlChar_ptr(n_str, 1);
8470
William M. Brackf13f77f2004-11-12 16:03:48 +00008471 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008472 desret_int(ret_val);
8473 call_tests++;
8474 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008475 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008476 xmlResetLastError();
8477 if (mem_base != xmlMemBlocks()) {
8478 printf("Leak of %d blocks found in xmlDictOwns",
8479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008480 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008481 printf(" %d", n_dict);
8482 printf(" %d", n_str);
8483 printf("\n");
8484 }
8485 }
8486 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008488
Daniel Veillard42595322004-11-08 10:52:06 +00008489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008490}
8491
8492
8493static int
8494test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008496
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008497 int mem_base;
8498 const xmlChar * ret_val;
8499 xmlDictPtr dict; /* the dictionnary */
8500 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008501 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008502 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008503 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008504 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008505
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008506 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8507 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8508 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8509 mem_base = xmlMemBlocks();
8510 dict = gen_xmlDictPtr(n_dict, 0);
8511 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8512 name = gen_const_xmlChar_ptr(n_name, 2);
8513
William M. Brackf13f77f2004-11-12 16:03:48 +00008514 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008515 desret_const_xmlChar_ptr(ret_val);
8516 call_tests++;
8517 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008518 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8519 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008520 xmlResetLastError();
8521 if (mem_base != xmlMemBlocks()) {
8522 printf("Leak of %d blocks found in xmlDictQLookup",
8523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008524 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008525 printf(" %d", n_dict);
8526 printf(" %d", n_prefix);
8527 printf(" %d", n_name);
8528 printf("\n");
8529 }
8530 }
8531 }
8532 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008533 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008534
Daniel Veillard42595322004-11-08 10:52:06 +00008535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008536}
8537
8538
8539static int
8540test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008542
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008543 int mem_base;
8544 int ret_val;
8545 xmlDictPtr dict; /* the dictionnary */
8546 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008547
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008548 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8549 mem_base = xmlMemBlocks();
8550 dict = gen_xmlDictPtr(n_dict, 0);
8551
8552 ret_val = xmlDictReference(dict);
8553 xmlDictFree(dict);
8554 desret_int(ret_val);
8555 call_tests++;
8556 des_xmlDictPtr(n_dict, dict, 0);
8557 xmlResetLastError();
8558 if (mem_base != xmlMemBlocks()) {
8559 printf("Leak of %d blocks found in xmlDictReference",
8560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008561 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008562 printf(" %d", n_dict);
8563 printf("\n");
8564 }
8565 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008566 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008567
Daniel Veillard42595322004-11-08 10:52:06 +00008568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008569}
8570
8571
8572static int
8573test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008575
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008576 int mem_base;
8577 int ret_val;
8578 xmlDictPtr dict; /* the dictionnary */
8579 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008580
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008581 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8582 mem_base = xmlMemBlocks();
8583 dict = gen_xmlDictPtr(n_dict, 0);
8584
8585 ret_val = xmlDictSize(dict);
8586 desret_int(ret_val);
8587 call_tests++;
8588 des_xmlDictPtr(n_dict, dict, 0);
8589 xmlResetLastError();
8590 if (mem_base != xmlMemBlocks()) {
8591 printf("Leak of %d blocks found in xmlDictSize",
8592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008593 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008594 printf(" %d", n_dict);
8595 printf("\n");
8596 }
8597 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008598 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008599
Daniel Veillard42595322004-11-08 10:52:06 +00008600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008601}
8602
8603static int
8604test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008606
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008607 if (quiet == 0) printf("Testing dict : 7 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008608 test_ret += test_xmlDictCreate();
8609 test_ret += test_xmlDictCreateSub();
8610 test_ret += test_xmlDictLookup();
8611 test_ret += test_xmlDictOwns();
8612 test_ret += test_xmlDictQLookup();
8613 test_ret += test_xmlDictReference();
8614 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008615
Daniel Veillard42595322004-11-08 10:52:06 +00008616 if (test_ret != 0)
8617 printf("Module dict: %d errors\n", test_ret);
8618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008619}
8620
8621static int
8622test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008624
Daniel Veillarda521d282004-11-09 14:59:59 +00008625#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008626 int mem_base;
8627 int ret_val;
8628 unsigned char * out; /* a pointer to an array of bytes to store the result */
8629 int n_out;
8630 int * outlen; /* the length of @out */
8631 int n_outlen;
8632 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8633 int n_in;
8634 int * inlen; /* the length of @in */
8635 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008636
Daniel Veillardce682bc2004-11-05 17:22:25 +00008637 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8638 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8639 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8640 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8641 mem_base = xmlMemBlocks();
8642 out = gen_unsigned_char_ptr(n_out, 0);
8643 outlen = gen_int_ptr(n_outlen, 1);
8644 in = gen_const_unsigned_char_ptr(n_in, 2);
8645 inlen = gen_int_ptr(n_inlen, 3);
8646
William M. Brackf13f77f2004-11-12 16:03:48 +00008647 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008648 desret_int(ret_val);
8649 call_tests++;
8650 des_unsigned_char_ptr(n_out, out, 0);
8651 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008652 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008653 des_int_ptr(n_inlen, inlen, 3);
8654 xmlResetLastError();
8655 if (mem_base != xmlMemBlocks()) {
8656 printf("Leak of %d blocks found in UTF8Toisolat1",
8657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008658 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008659 printf(" %d", n_out);
8660 printf(" %d", n_outlen);
8661 printf(" %d", n_in);
8662 printf(" %d", n_inlen);
8663 printf("\n");
8664 }
8665 }
8666 }
8667 }
8668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008669 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008670#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008671
Daniel Veillard42595322004-11-08 10:52:06 +00008672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008673}
8674
8675
8676static int
8677test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008679
Daniel Veillardce682bc2004-11-05 17:22:25 +00008680 int mem_base;
8681 int ret_val;
8682 unsigned char * out; /* a pointer to an array of bytes to store the result */
8683 int n_out;
8684 int * outlen; /* the length of @out */
8685 int n_outlen;
8686 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8687 int n_in;
8688 int * inlen; /* the length of @in */
8689 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008690
Daniel Veillardce682bc2004-11-05 17:22:25 +00008691 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8692 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8693 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8694 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8695 mem_base = xmlMemBlocks();
8696 out = gen_unsigned_char_ptr(n_out, 0);
8697 outlen = gen_int_ptr(n_outlen, 1);
8698 in = gen_const_unsigned_char_ptr(n_in, 2);
8699 inlen = gen_int_ptr(n_inlen, 3);
8700
William M. Brackf13f77f2004-11-12 16:03:48 +00008701 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008702 desret_int(ret_val);
8703 call_tests++;
8704 des_unsigned_char_ptr(n_out, out, 0);
8705 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008706 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008707 des_int_ptr(n_inlen, inlen, 3);
8708 xmlResetLastError();
8709 if (mem_base != xmlMemBlocks()) {
8710 printf("Leak of %d blocks found in isolat1ToUTF8",
8711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008712 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008713 printf(" %d", n_out);
8714 printf(" %d", n_outlen);
8715 printf(" %d", n_in);
8716 printf(" %d", n_inlen);
8717 printf("\n");
8718 }
8719 }
8720 }
8721 }
8722 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008723 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008724
Daniel Veillard42595322004-11-08 10:52:06 +00008725 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008726}
8727
8728
8729static int
8730test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008732
8733 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008734 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008735 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008736 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008737 int n_alias;
8738
8739 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8740 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008741 name = gen_const_char_ptr(n_name, 0);
8742 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008743
William M. Brackf13f77f2004-11-12 16:03:48 +00008744 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008745 desret_int(ret_val);
8746 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008747 des_const_char_ptr(n_name, (const char *)name, 0);
8748 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008749 xmlResetLastError();
8750 }
8751 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008752 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008753
Daniel Veillard42595322004-11-08 10:52:06 +00008754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755}
8756
8757
Daniel Veillardce682bc2004-11-05 17:22:25 +00008758#define gen_nb_xmlCharEncodingHandler_ptr 1
8759static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8760 return(NULL);
8761}
8762static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8763}
8764
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765static int
8766test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008768
Daniel Veillardce682bc2004-11-05 17:22:25 +00008769 int mem_base;
8770 int ret_val;
8771 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8772 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008773
Daniel Veillardce682bc2004-11-05 17:22:25 +00008774 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8775 mem_base = xmlMemBlocks();
8776 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8777
8778 ret_val = xmlCharEncCloseFunc(handler);
8779 desret_int(ret_val);
8780 call_tests++;
8781 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8782 xmlResetLastError();
8783 if (mem_base != xmlMemBlocks()) {
8784 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008786 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008787 printf(" %d", n_handler);
8788 printf("\n");
8789 }
8790 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008791 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008792
Daniel Veillard42595322004-11-08 10:52:06 +00008793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008794}
8795
8796
8797static int
8798test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008800
Daniel Veillardce682bc2004-11-05 17:22:25 +00008801 int mem_base;
8802 int ret_val;
8803 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8804 int n_handler;
8805 xmlBufferPtr out; /* an xmlBuffer for the output. */
8806 int n_out;
8807 xmlBufferPtr in; /* an xmlBuffer for the input */
8808 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008809
Daniel Veillardce682bc2004-11-05 17:22:25 +00008810 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8811 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8812 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8813 mem_base = xmlMemBlocks();
8814 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8815 out = gen_xmlBufferPtr(n_out, 1);
8816 in = gen_xmlBufferPtr(n_in, 2);
8817
8818 ret_val = xmlCharEncFirstLine(handler, out, in);
8819 desret_int(ret_val);
8820 call_tests++;
8821 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8822 des_xmlBufferPtr(n_out, out, 1);
8823 des_xmlBufferPtr(n_in, in, 2);
8824 xmlResetLastError();
8825 if (mem_base != xmlMemBlocks()) {
8826 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008828 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008829 printf(" %d", n_handler);
8830 printf(" %d", n_out);
8831 printf(" %d", n_in);
8832 printf("\n");
8833 }
8834 }
8835 }
8836 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008837 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008838
Daniel Veillard42595322004-11-08 10:52:06 +00008839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008840}
8841
8842
8843static int
8844test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008846
Daniel Veillardce682bc2004-11-05 17:22:25 +00008847 int mem_base;
8848 int ret_val;
8849 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8850 int n_handler;
8851 xmlBufferPtr out; /* an xmlBuffer for the output. */
8852 int n_out;
8853 xmlBufferPtr in; /* an xmlBuffer for the input */
8854 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008855
Daniel Veillardce682bc2004-11-05 17:22:25 +00008856 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8857 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8858 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8859 mem_base = xmlMemBlocks();
8860 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8861 out = gen_xmlBufferPtr(n_out, 1);
8862 in = gen_xmlBufferPtr(n_in, 2);
8863
8864 ret_val = xmlCharEncInFunc(handler, out, in);
8865 desret_int(ret_val);
8866 call_tests++;
8867 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8868 des_xmlBufferPtr(n_out, out, 1);
8869 des_xmlBufferPtr(n_in, in, 2);
8870 xmlResetLastError();
8871 if (mem_base != xmlMemBlocks()) {
8872 printf("Leak of %d blocks found in xmlCharEncInFunc",
8873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008874 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008875 printf(" %d", n_handler);
8876 printf(" %d", n_out);
8877 printf(" %d", n_in);
8878 printf("\n");
8879 }
8880 }
8881 }
8882 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008883 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008884
Daniel Veillard42595322004-11-08 10:52:06 +00008885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008886}
8887
8888
8889static int
8890test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008892
Daniel Veillardce682bc2004-11-05 17:22:25 +00008893 int mem_base;
8894 int ret_val;
8895 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8896 int n_handler;
8897 xmlBufferPtr out; /* an xmlBuffer for the output. */
8898 int n_out;
8899 xmlBufferPtr in; /* an xmlBuffer for the input */
8900 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008901
Daniel Veillardce682bc2004-11-05 17:22:25 +00008902 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8903 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8904 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8905 mem_base = xmlMemBlocks();
8906 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8907 out = gen_xmlBufferPtr(n_out, 1);
8908 in = gen_xmlBufferPtr(n_in, 2);
8909
8910 ret_val = xmlCharEncOutFunc(handler, out, in);
8911 desret_int(ret_val);
8912 call_tests++;
8913 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8914 des_xmlBufferPtr(n_out, out, 1);
8915 des_xmlBufferPtr(n_in, in, 2);
8916 xmlResetLastError();
8917 if (mem_base != xmlMemBlocks()) {
8918 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008920 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008921 printf(" %d", n_handler);
8922 printf(" %d", n_out);
8923 printf(" %d", n_in);
8924 printf("\n");
8925 }
8926 }
8927 }
8928 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008929 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008930
Daniel Veillard42595322004-11-08 10:52:06 +00008931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008932}
8933
8934
8935static int
8936test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008938
8939
8940
8941 xmlCleanupCharEncodingHandlers();
8942 call_tests++;
8943 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008944 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008945
Daniel Veillard42595322004-11-08 10:52:06 +00008946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008947}
8948
8949
8950static int
8951test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008953
8954 int mem_base;
8955
8956 mem_base = xmlMemBlocks();
8957
8958 xmlCleanupEncodingAliases();
8959 call_tests++;
8960 xmlResetLastError();
8961 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008962 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008964 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008965 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008966 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008967 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008968
Daniel Veillard42595322004-11-08 10:52:06 +00008969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008970}
8971
8972
8973static int
8974test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008976
8977 int mem_base;
8978 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008979 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008980 int n_alias;
8981
8982 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8983 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008984 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008985
William M. Brackf13f77f2004-11-12 16:03:48 +00008986 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008987 desret_int(ret_val);
8988 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008989 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008990 xmlResetLastError();
8991 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008992 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008994 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008995 printf(" %d", n_alias);
8996 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008997 }
8998 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008999 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009000
Daniel Veillard42595322004-11-08 10:52:06 +00009001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009002}
9003
9004
9005static int
9006test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009008
Daniel Veillardce682bc2004-11-05 17:22:25 +00009009 int mem_base;
9010 xmlCharEncoding ret_val;
9011 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). */
9012 int n_in;
9013 int len; /* pointer to the length of the buffer */
9014 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009015
Daniel Veillardce682bc2004-11-05 17:22:25 +00009016 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
9017 for (n_len = 0;n_len < gen_nb_int;n_len++) {
9018 mem_base = xmlMemBlocks();
9019 in = gen_const_unsigned_char_ptr(n_in, 0);
9020 len = gen_int(n_len, 1);
9021
William M. Brackf13f77f2004-11-12 16:03:48 +00009022 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00009023 desret_xmlCharEncoding(ret_val);
9024 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009025 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00009026 des_int(n_len, len, 1);
9027 xmlResetLastError();
9028 if (mem_base != xmlMemBlocks()) {
9029 printf("Leak of %d blocks found in xmlDetectCharEncoding",
9030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009031 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009032 printf(" %d", n_in);
9033 printf(" %d", n_len);
9034 printf("\n");
9035 }
9036 }
9037 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00009038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009039
Daniel Veillard42595322004-11-08 10:52:06 +00009040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009041}
9042
9043
9044static int
9045test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009047
9048
9049 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009051}
9052
9053
9054static int
9055test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009057
9058
9059 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009061}
9062
9063
9064static int
9065test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009067
Daniel Veillard3d97e662004-11-04 10:49:00 +00009068 int mem_base;
9069 const char * ret_val;
9070 xmlCharEncoding enc; /* the encoding */
9071 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009072
Daniel Veillard3d97e662004-11-04 10:49:00 +00009073 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
9074 mem_base = xmlMemBlocks();
9075 enc = gen_xmlCharEncoding(n_enc, 0);
9076
9077 ret_val = xmlGetCharEncodingName(enc);
9078 desret_const_char_ptr(ret_val);
9079 call_tests++;
9080 des_xmlCharEncoding(n_enc, enc, 0);
9081 xmlResetLastError();
9082 if (mem_base != xmlMemBlocks()) {
9083 printf("Leak of %d blocks found in xmlGetCharEncodingName",
9084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009085 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009086 printf(" %d", n_enc);
9087 printf("\n");
9088 }
9089 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009090 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009091
Daniel Veillard42595322004-11-08 10:52:06 +00009092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009093}
9094
9095
9096static int
9097test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009099
9100 int mem_base;
9101 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009102 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009103 int n_alias;
9104
9105 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
9106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009107 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009108
William M. Brackf13f77f2004-11-12 16:03:48 +00009109 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009110 desret_const_char_ptr(ret_val);
9111 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009112 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009113 xmlResetLastError();
9114 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009115 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009117 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009118 printf(" %d", n_alias);
9119 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009120 }
9121 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009122 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009123
Daniel Veillard42595322004-11-08 10:52:06 +00009124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009125}
9126
9127
9128static int
9129test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009131
9132
9133
9134 xmlInitCharEncodingHandlers();
9135 call_tests++;
9136 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009137 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009138
Daniel Veillard42595322004-11-08 10:52:06 +00009139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009140}
9141
9142
9143static int
9144test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009146
9147
9148 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009150}
9151
9152
9153static int
9154test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009156
Daniel Veillard3d97e662004-11-04 10:49:00 +00009157 int mem_base;
9158 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009159 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00009160 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009161
Daniel Veillard3d97e662004-11-04 10:49:00 +00009162 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
9163 mem_base = xmlMemBlocks();
9164 name = gen_const_char_ptr(n_name, 0);
9165
William M. Brackf13f77f2004-11-12 16:03:48 +00009166 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009167 desret_xmlCharEncoding(ret_val);
9168 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009169 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009170 xmlResetLastError();
9171 if (mem_base != xmlMemBlocks()) {
9172 printf("Leak of %d blocks found in xmlParseCharEncoding",
9173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009174 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009175 printf(" %d", n_name);
9176 printf("\n");
9177 }
9178 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009180
Daniel Veillard42595322004-11-08 10:52:06 +00009181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009182}
9183
9184
Daniel Veillardce682bc2004-11-05 17:22:25 +00009185#define gen_nb_xmlCharEncodingHandlerPtr 1
9186static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9187 return(NULL);
9188}
9189static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9190}
9191
Daniel Veillardd93f6252004-11-02 15:53:51 +00009192static int
9193test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009195
Daniel Veillardce682bc2004-11-05 17:22:25 +00009196 int mem_base;
9197 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
9198 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009199
Daniel Veillardce682bc2004-11-05 17:22:25 +00009200 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
9201 mem_base = xmlMemBlocks();
9202 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
9203
9204 xmlRegisterCharEncodingHandler(handler);
9205 call_tests++;
9206 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
9207 xmlResetLastError();
9208 if (mem_base != xmlMemBlocks()) {
9209 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
9210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009211 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009212 printf(" %d", n_handler);
9213 printf("\n");
9214 }
9215 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00009216 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009217
Daniel Veillard42595322004-11-08 10:52:06 +00009218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009219}
9220
9221static int
9222test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009224
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009225 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009226 test_ret += test_UTF8Toisolat1();
9227 test_ret += test_isolat1ToUTF8();
9228 test_ret += test_xmlAddEncodingAlias();
9229 test_ret += test_xmlCharEncCloseFunc();
9230 test_ret += test_xmlCharEncFirstLine();
9231 test_ret += test_xmlCharEncInFunc();
9232 test_ret += test_xmlCharEncOutFunc();
9233 test_ret += test_xmlCleanupCharEncodingHandlers();
9234 test_ret += test_xmlCleanupEncodingAliases();
9235 test_ret += test_xmlDelEncodingAlias();
9236 test_ret += test_xmlDetectCharEncoding();
9237 test_ret += test_xmlFindCharEncodingHandler();
9238 test_ret += test_xmlGetCharEncodingHandler();
9239 test_ret += test_xmlGetCharEncodingName();
9240 test_ret += test_xmlGetEncodingAlias();
9241 test_ret += test_xmlInitCharEncodingHandlers();
9242 test_ret += test_xmlNewCharEncodingHandler();
9243 test_ret += test_xmlParseCharEncoding();
9244 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009245
Daniel Veillard42595322004-11-08 10:52:06 +00009246 if (test_ret != 0)
9247 printf("Module encoding: %d errors\n", test_ret);
9248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009249}
9250
9251static int
9252test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009254
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009255 int mem_base;
9256 xmlEntityPtr ret_val;
9257 xmlDocPtr doc; /* the document */
9258 int n_doc;
9259 xmlChar * name; /* the entity name */
9260 int n_name;
9261 int type; /* the entity type XML_xxx_yyy_ENTITY */
9262 int n_type;
9263 xmlChar * ExternalID; /* the entity external ID if available */
9264 int n_ExternalID;
9265 xmlChar * SystemID; /* the entity system ID if available */
9266 int n_SystemID;
9267 xmlChar * content; /* the entity content */
9268 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009269
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009270 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9271 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9272 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9273 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9274 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9275 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9276 mem_base = xmlMemBlocks();
9277 doc = gen_xmlDocPtr(n_doc, 0);
9278 name = gen_const_xmlChar_ptr(n_name, 1);
9279 type = gen_int(n_type, 2);
9280 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9281 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9282 content = gen_const_xmlChar_ptr(n_content, 5);
9283
William M. Brackf13f77f2004-11-12 16:03:48 +00009284 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009285 desret_xmlEntityPtr(ret_val);
9286 call_tests++;
9287 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009288 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009289 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009290 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9291 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9292 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009293 xmlResetLastError();
9294 if (mem_base != xmlMemBlocks()) {
9295 printf("Leak of %d blocks found in xmlAddDocEntity",
9296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009297 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009298 printf(" %d", n_doc);
9299 printf(" %d", n_name);
9300 printf(" %d", n_type);
9301 printf(" %d", n_ExternalID);
9302 printf(" %d", n_SystemID);
9303 printf(" %d", n_content);
9304 printf("\n");
9305 }
9306 }
9307 }
9308 }
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_xmlAddDtdEntity(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 */
9325 int n_doc;
9326 xmlChar * name; /* the entity name */
9327 int n_name;
9328 int type; /* the entity type XML_xxx_yyy_ENTITY */
9329 int n_type;
9330 xmlChar * ExternalID; /* the entity external ID if available */
9331 int n_ExternalID;
9332 xmlChar * SystemID; /* the entity system ID if available */
9333 int n_SystemID;
9334 xmlChar * content; /* the entity content */
9335 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009336
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009337 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9338 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9339 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9340 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9341 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9342 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9343 mem_base = xmlMemBlocks();
9344 doc = gen_xmlDocPtr(n_doc, 0);
9345 name = gen_const_xmlChar_ptr(n_name, 1);
9346 type = gen_int(n_type, 2);
9347 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9348 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9349 content = gen_const_xmlChar_ptr(n_content, 5);
9350
William M. Brackf13f77f2004-11-12 16:03:48 +00009351 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009352 desret_xmlEntityPtr(ret_val);
9353 call_tests++;
9354 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009355 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009356 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009357 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9358 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9359 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009360 xmlResetLastError();
9361 if (mem_base != xmlMemBlocks()) {
9362 printf("Leak of %d blocks found in xmlAddDtdEntity",
9363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009364 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009365 printf(" %d", n_doc);
9366 printf(" %d", n_name);
9367 printf(" %d", n_type);
9368 printf(" %d", n_ExternalID);
9369 printf(" %d", n_SystemID);
9370 printf(" %d", n_content);
9371 printf("\n");
9372 }
9373 }
9374 }
9375 }
9376 }
9377 }
9378 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009379 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009380
Daniel Veillard42595322004-11-08 10:52:06 +00009381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009382}
9383
9384
9385static int
9386test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009388
Daniel Veillarda521d282004-11-09 14:59:59 +00009389#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009390 int mem_base;
9391
9392 mem_base = xmlMemBlocks();
9393
9394 xmlCleanupPredefinedEntities();
9395 call_tests++;
9396 xmlResetLastError();
9397 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009398 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009400 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009401 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009403 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009404#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009405
Daniel Veillard42595322004-11-08 10:52:06 +00009406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009407}
9408
9409
Daniel Veillardce682bc2004-11-05 17:22:25 +00009410#define gen_nb_xmlEntitiesTablePtr 1
9411static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9412 return(NULL);
9413}
9414static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9415}
9416
Daniel Veillardd93f6252004-11-02 15:53:51 +00009417static int
9418test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009420
9421
9422 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009424}
9425
9426
9427static int
9428test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009430
9431
9432 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009434}
9435
9436
9437static int
9438test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009440
Daniel Veillardce682bc2004-11-05 17:22:25 +00009441#ifdef LIBXML_OUTPUT_ENABLED
9442 int mem_base;
9443 xmlBufferPtr buf; /* An XML buffer. */
9444 int n_buf;
9445 xmlEntitiesTablePtr table; /* An entity table */
9446 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009447
Daniel Veillardce682bc2004-11-05 17:22:25 +00009448 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9449 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9450 mem_base = xmlMemBlocks();
9451 buf = gen_xmlBufferPtr(n_buf, 0);
9452 table = gen_xmlEntitiesTablePtr(n_table, 1);
9453
9454 xmlDumpEntitiesTable(buf, table);
9455 call_tests++;
9456 des_xmlBufferPtr(n_buf, buf, 0);
9457 des_xmlEntitiesTablePtr(n_table, table, 1);
9458 xmlResetLastError();
9459 if (mem_base != xmlMemBlocks()) {
9460 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009462 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009463 printf(" %d", n_buf);
9464 printf(" %d", n_table);
9465 printf("\n");
9466 }
9467 }
9468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009469 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009470#endif
9471
Daniel Veillard42595322004-11-08 10:52:06 +00009472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009473}
9474
9475
Daniel Veillardce682bc2004-11-05 17:22:25 +00009476#define gen_nb_xmlEntityPtr 1
9477static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9478 return(NULL);
9479}
9480static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9481}
9482
Daniel Veillardd93f6252004-11-02 15:53:51 +00009483static int
9484test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009486
Daniel Veillardce682bc2004-11-05 17:22:25 +00009487#ifdef LIBXML_OUTPUT_ENABLED
9488 int mem_base;
9489 xmlBufferPtr buf; /* An XML buffer. */
9490 int n_buf;
9491 xmlEntityPtr ent; /* An entity table */
9492 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009493
Daniel Veillardce682bc2004-11-05 17:22:25 +00009494 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9495 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9496 mem_base = xmlMemBlocks();
9497 buf = gen_xmlBufferPtr(n_buf, 0);
9498 ent = gen_xmlEntityPtr(n_ent, 1);
9499
9500 xmlDumpEntityDecl(buf, ent);
9501 call_tests++;
9502 des_xmlBufferPtr(n_buf, buf, 0);
9503 des_xmlEntityPtr(n_ent, ent, 1);
9504 xmlResetLastError();
9505 if (mem_base != xmlMemBlocks()) {
9506 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009508 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009509 printf(" %d", n_buf);
9510 printf(" %d", n_ent);
9511 printf("\n");
9512 }
9513 }
9514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009515 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009516#endif
9517
Daniel Veillard42595322004-11-08 10:52:06 +00009518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009519}
9520
9521
9522static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009523test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009525
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009526 int mem_base;
9527 xmlChar * ret_val;
9528 xmlDocPtr doc; /* the document containing the string */
9529 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009530 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009531 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009532
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009533 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9534 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9535 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009536 doc = gen_xmlDocPtr(n_doc, 0);
9537 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009538
William M. Brackf13f77f2004-11-12 16:03:48 +00009539 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009540 desret_xmlChar_ptr(ret_val);
9541 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009542 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009543 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009544 xmlResetLastError();
9545 if (mem_base != xmlMemBlocks()) {
9546 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009548 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009549 printf(" %d", n_doc);
9550 printf(" %d", n_input);
9551 printf("\n");
9552 }
9553 }
9554 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009555 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009556
Daniel Veillard42595322004-11-08 10:52:06 +00009557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009558}
9559
9560
9561static int
9562test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009564
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009565 int mem_base;
9566 xmlChar * ret_val;
9567 xmlDocPtr doc; /* the document containing the string */
9568 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009569 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009570 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009571
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009572 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9573 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9574 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009575 doc = gen_xmlDocPtr(n_doc, 0);
9576 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009577
William M. Brackf13f77f2004-11-12 16:03:48 +00009578 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009579 desret_xmlChar_ptr(ret_val);
9580 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009581 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009582 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009583 xmlResetLastError();
9584 if (mem_base != xmlMemBlocks()) {
9585 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009587 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009588 printf(" %d", n_doc);
9589 printf(" %d", n_input);
9590 printf("\n");
9591 }
9592 }
9593 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009594 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009595
Daniel Veillard42595322004-11-08 10:52:06 +00009596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009597}
9598
9599
9600static int
9601test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009603
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009604 int mem_base;
9605 xmlEntityPtr ret_val;
9606 xmlDocPtr doc; /* the document referencing the entity */
9607 int n_doc;
9608 xmlChar * name; /* the entity name */
9609 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009610
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009611 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9612 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9613 mem_base = xmlMemBlocks();
9614 doc = gen_xmlDocPtr(n_doc, 0);
9615 name = gen_const_xmlChar_ptr(n_name, 1);
9616
William M. Brackf13f77f2004-11-12 16:03:48 +00009617 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009618 desret_xmlEntityPtr(ret_val);
9619 call_tests++;
9620 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009621 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009622 xmlResetLastError();
9623 if (mem_base != xmlMemBlocks()) {
9624 printf("Leak of %d blocks found in xmlGetDocEntity",
9625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009626 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009627 printf(" %d", n_doc);
9628 printf(" %d", n_name);
9629 printf("\n");
9630 }
9631 }
9632 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009633 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009634
Daniel Veillard42595322004-11-08 10:52:06 +00009635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009636}
9637
9638
9639static int
9640test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009642
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009643 int mem_base;
9644 xmlEntityPtr ret_val;
9645 xmlDocPtr doc; /* the document referencing the entity */
9646 int n_doc;
9647 xmlChar * name; /* the entity name */
9648 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009649
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009650 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9651 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9652 mem_base = xmlMemBlocks();
9653 doc = gen_xmlDocPtr(n_doc, 0);
9654 name = gen_const_xmlChar_ptr(n_name, 1);
9655
William M. Brackf13f77f2004-11-12 16:03:48 +00009656 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009657 desret_xmlEntityPtr(ret_val);
9658 call_tests++;
9659 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009660 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009661 xmlResetLastError();
9662 if (mem_base != xmlMemBlocks()) {
9663 printf("Leak of %d blocks found in xmlGetDtdEntity",
9664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009665 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009666 printf(" %d", n_doc);
9667 printf(" %d", n_name);
9668 printf("\n");
9669 }
9670 }
9671 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009673
Daniel Veillard42595322004-11-08 10:52:06 +00009674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009675}
9676
9677
9678static int
9679test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009681
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009682 int mem_base;
9683 xmlEntityPtr ret_val;
9684 xmlDocPtr doc; /* the document referencing the entity */
9685 int n_doc;
9686 xmlChar * name; /* the entity name */
9687 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009688
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009689 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9690 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9691 mem_base = xmlMemBlocks();
9692 doc = gen_xmlDocPtr(n_doc, 0);
9693 name = gen_const_xmlChar_ptr(n_name, 1);
9694
William M. Brackf13f77f2004-11-12 16:03:48 +00009695 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009696 desret_xmlEntityPtr(ret_val);
9697 call_tests++;
9698 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009699 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009700 xmlResetLastError();
9701 if (mem_base != xmlMemBlocks()) {
9702 printf("Leak of %d blocks found in xmlGetParameterEntity",
9703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009704 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009705 printf(" %d", n_doc);
9706 printf(" %d", n_name);
9707 printf("\n");
9708 }
9709 }
9710 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009712
Daniel Veillard42595322004-11-08 10:52:06 +00009713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009714}
9715
9716
9717static int
9718test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009720
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009721 int mem_base;
9722 xmlEntityPtr ret_val;
9723 xmlChar * name; /* the entity name */
9724 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009725
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009726 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9727 mem_base = xmlMemBlocks();
9728 name = gen_const_xmlChar_ptr(n_name, 0);
9729
William M. Brackf13f77f2004-11-12 16:03:48 +00009730 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009731 desret_xmlEntityPtr(ret_val);
9732 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009733 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009734 xmlResetLastError();
9735 if (mem_base != xmlMemBlocks()) {
9736 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009738 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009739 printf(" %d", n_name);
9740 printf("\n");
9741 }
9742 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009744
Daniel Veillard42595322004-11-08 10:52:06 +00009745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009746}
9747
9748
9749static int
9750test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009752
Daniel Veillarda521d282004-11-09 14:59:59 +00009753#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009754 int mem_base;
9755
9756 mem_base = xmlMemBlocks();
9757
9758 xmlInitializePredefinedEntities();
9759 call_tests++;
9760 xmlResetLastError();
9761 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009762 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009764 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009765 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009767 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009768#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009769
Daniel Veillard42595322004-11-08 10:52:06 +00009770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009771}
9772
9773static int
9774test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009776
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009777 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009778 test_ret += test_xmlAddDocEntity();
9779 test_ret += test_xmlAddDtdEntity();
9780 test_ret += test_xmlCleanupPredefinedEntities();
9781 test_ret += test_xmlCopyEntitiesTable();
9782 test_ret += test_xmlCreateEntitiesTable();
9783 test_ret += test_xmlDumpEntitiesTable();
9784 test_ret += test_xmlDumpEntityDecl();
9785 test_ret += test_xmlEncodeEntitiesReentrant();
9786 test_ret += test_xmlEncodeSpecialChars();
9787 test_ret += test_xmlGetDocEntity();
9788 test_ret += test_xmlGetDtdEntity();
9789 test_ret += test_xmlGetParameterEntity();
9790 test_ret += test_xmlGetPredefinedEntity();
9791 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009792
Daniel Veillard42595322004-11-08 10:52:06 +00009793 if (test_ret != 0)
9794 printf("Module entities: %d errors\n", test_ret);
9795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009796}
9797
9798static int
9799test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009801
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009802 int mem_base;
9803 int ret_val;
9804 xmlHashTablePtr table; /* the hash table */
9805 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009806 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009807 int n_name;
9808 void * userdata; /* a pointer to the userdata */
9809 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009810
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009811 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9812 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9813 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009815 table = gen_xmlHashTablePtr(n_table, 0);
9816 name = gen_const_xmlChar_ptr(n_name, 1);
9817 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009818
William M. Brackf13f77f2004-11-12 16:03:48 +00009819 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009820 desret_int(ret_val);
9821 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009822 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009823 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009824 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009825 xmlResetLastError();
9826 if (mem_base != xmlMemBlocks()) {
9827 printf("Leak of %d blocks found in xmlHashAddEntry",
9828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009829 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009830 printf(" %d", n_table);
9831 printf(" %d", n_name);
9832 printf(" %d", n_userdata);
9833 printf("\n");
9834 }
9835 }
9836 }
9837 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009838 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009839
Daniel Veillard42595322004-11-08 10:52:06 +00009840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009841}
9842
9843
9844static int
9845test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009847
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009848 int mem_base;
9849 int ret_val;
9850 xmlHashTablePtr table; /* the hash table */
9851 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009852 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009853 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009854 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009855 int n_name2;
9856 void * userdata; /* a pointer to the userdata */
9857 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009858
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009859 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9860 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9861 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9862 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9863 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009864 table = gen_xmlHashTablePtr(n_table, 0);
9865 name = gen_const_xmlChar_ptr(n_name, 1);
9866 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9867 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009868
William M. Brackf13f77f2004-11-12 16:03:48 +00009869 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009870 desret_int(ret_val);
9871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009872 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009873 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9874 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009875 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009876 xmlResetLastError();
9877 if (mem_base != xmlMemBlocks()) {
9878 printf("Leak of %d blocks found in xmlHashAddEntry2",
9879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009880 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009881 printf(" %d", n_table);
9882 printf(" %d", n_name);
9883 printf(" %d", n_name2);
9884 printf(" %d", n_userdata);
9885 printf("\n");
9886 }
9887 }
9888 }
9889 }
9890 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009891 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009892
Daniel Veillard42595322004-11-08 10:52:06 +00009893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009894}
9895
9896
9897static int
9898test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009900
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009901 int mem_base;
9902 int ret_val;
9903 xmlHashTablePtr table; /* the hash table */
9904 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009905 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009906 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009907 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009908 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009909 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009910 int n_name3;
9911 void * userdata; /* a pointer to the userdata */
9912 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009913
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009914 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9915 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9916 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9917 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9918 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9919 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009920 table = gen_xmlHashTablePtr(n_table, 0);
9921 name = gen_const_xmlChar_ptr(n_name, 1);
9922 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9923 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9924 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009925
William M. Brackf13f77f2004-11-12 16:03:48 +00009926 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009927 desret_int(ret_val);
9928 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009929 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009930 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9931 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9932 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009933 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009934 xmlResetLastError();
9935 if (mem_base != xmlMemBlocks()) {
9936 printf("Leak of %d blocks found in xmlHashAddEntry3",
9937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009938 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009939 printf(" %d", n_table);
9940 printf(" %d", n_name);
9941 printf(" %d", n_name2);
9942 printf(" %d", n_name3);
9943 printf(" %d", n_userdata);
9944 printf("\n");
9945 }
9946 }
9947 }
9948 }
9949 }
9950 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009951 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009952
Daniel Veillard42595322004-11-08 10:52:06 +00009953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009954}
9955
9956
9957static int
9958test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009960
9961
9962 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009964}
9965
9966
9967static int
9968test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009970
9971
9972 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009974}
9975
9976
9977static int
9978test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009980
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009981 int mem_base;
9982 void * ret_val;
9983 xmlHashTablePtr table; /* the hash table */
9984 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009985 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009986 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009987
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009988 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9989 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009991 table = gen_xmlHashTablePtr(n_table, 0);
9992 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009993
William M. Brackf13f77f2004-11-12 16:03:48 +00009994 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009995 desret_void_ptr(ret_val);
9996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009997 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009998 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009999 xmlResetLastError();
10000 if (mem_base != xmlMemBlocks()) {
10001 printf("Leak of %d blocks found in xmlHashLookup",
10002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010003 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010004 printf(" %d", n_table);
10005 printf(" %d", n_name);
10006 printf("\n");
10007 }
10008 }
10009 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010011
Daniel Veillard42595322004-11-08 10:52:06 +000010012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010013}
10014
10015
10016static int
10017test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010019
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010020 int mem_base;
10021 void * ret_val;
10022 xmlHashTablePtr table; /* the hash table */
10023 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010024 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010025 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010026 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010027 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010028
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010029 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10030 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10031 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010033 table = gen_xmlHashTablePtr(n_table, 0);
10034 name = gen_const_xmlChar_ptr(n_name, 1);
10035 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010036
William M. Brackf13f77f2004-11-12 16:03:48 +000010037 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010038 desret_void_ptr(ret_val);
10039 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010040 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010041 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10042 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010043 xmlResetLastError();
10044 if (mem_base != xmlMemBlocks()) {
10045 printf("Leak of %d blocks found in xmlHashLookup2",
10046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010047 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010048 printf(" %d", n_table);
10049 printf(" %d", n_name);
10050 printf(" %d", n_name2);
10051 printf("\n");
10052 }
10053 }
10054 }
10055 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010056 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010057
Daniel Veillard42595322004-11-08 10:52:06 +000010058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010059}
10060
10061
10062static int
10063test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010065
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010066 int mem_base;
10067 void * ret_val;
10068 xmlHashTablePtr table; /* the hash table */
10069 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010070 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010071 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010072 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010073 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010074 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010075 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010076
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010077 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10078 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10079 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10080 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010082 table = gen_xmlHashTablePtr(n_table, 0);
10083 name = gen_const_xmlChar_ptr(n_name, 1);
10084 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10085 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010086
William M. Brackf13f77f2004-11-12 16:03:48 +000010087 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010088 desret_void_ptr(ret_val);
10089 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010090 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010091 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10092 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10093 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010094 xmlResetLastError();
10095 if (mem_base != xmlMemBlocks()) {
10096 printf("Leak of %d blocks found in xmlHashLookup3",
10097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010098 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010099 printf(" %d", n_table);
10100 printf(" %d", n_name);
10101 printf(" %d", n_name2);
10102 printf(" %d", n_name3);
10103 printf("\n");
10104 }
10105 }
10106 }
10107 }
10108 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010109 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010110
Daniel Veillard42595322004-11-08 10:52:06 +000010111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010112}
10113
10114
10115static int
10116test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010118
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010119 int mem_base;
10120 void * ret_val;
10121 xmlHashTablePtr table; /* the hash table */
10122 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010123 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010124 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010125 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010126 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010127
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010128 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10129 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10130 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010132 table = gen_xmlHashTablePtr(n_table, 0);
10133 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10134 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010135
William M. Brackf13f77f2004-11-12 16:03:48 +000010136 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010137 desret_void_ptr(ret_val);
10138 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010139 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010140 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
10141 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010142 xmlResetLastError();
10143 if (mem_base != xmlMemBlocks()) {
10144 printf("Leak of %d blocks found in xmlHashQLookup",
10145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010146 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010147 printf(" %d", n_table);
10148 printf(" %d", n_prefix);
10149 printf(" %d", n_name);
10150 printf("\n");
10151 }
10152 }
10153 }
10154 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010155 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010156
Daniel Veillard42595322004-11-08 10:52:06 +000010157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010158}
10159
10160
10161static int
10162test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010164
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010165 int mem_base;
10166 void * ret_val;
10167 xmlHashTablePtr table; /* the hash table */
10168 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010169 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010170 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010171 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010172 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010173 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010174 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010175 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010176 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010177
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010178 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10179 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10180 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10181 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10182 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10183 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010184 table = gen_xmlHashTablePtr(n_table, 0);
10185 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10186 name = gen_const_xmlChar_ptr(n_name, 2);
10187 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10188 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010189
William M. Brackf13f77f2004-11-12 16:03:48 +000010190 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010191 desret_void_ptr(ret_val);
10192 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010193 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010194 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
10195 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
10196 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
10197 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010198 xmlResetLastError();
10199 if (mem_base != xmlMemBlocks()) {
10200 printf("Leak of %d blocks found in xmlHashQLookup2",
10201 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010202 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010203 printf(" %d", n_table);
10204 printf(" %d", n_prefix);
10205 printf(" %d", n_name);
10206 printf(" %d", n_prefix2);
10207 printf(" %d", n_name2);
10208 printf("\n");
10209 }
10210 }
10211 }
10212 }
10213 }
10214 }
Daniel Veillard3d97e662004-11-04 10:49:00 +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_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010224
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010225 int mem_base;
10226 void * ret_val;
10227 xmlHashTablePtr table; /* the hash table */
10228 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010229 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010230 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010231 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010232 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010233 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010234 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010235 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010236 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010237 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010238 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010239 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010240 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010241
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010242 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10243 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10244 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10245 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10246 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10247 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
10248 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10249 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010250 table = gen_xmlHashTablePtr(n_table, 0);
10251 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10252 name = gen_const_xmlChar_ptr(n_name, 2);
10253 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10254 name2 = gen_const_xmlChar_ptr(n_name2, 4);
10255 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
10256 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010257
William M. Brackf13f77f2004-11-12 16:03:48 +000010258 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 +000010259 desret_void_ptr(ret_val);
10260 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010261 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010262 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
10263 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
10264 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
10265 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
10266 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
10267 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010268 xmlResetLastError();
10269 if (mem_base != xmlMemBlocks()) {
10270 printf("Leak of %d blocks found in xmlHashQLookup3",
10271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010272 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010273 printf(" %d", n_table);
10274 printf(" %d", n_prefix);
10275 printf(" %d", n_name);
10276 printf(" %d", n_prefix2);
10277 printf(" %d", n_name2);
10278 printf(" %d", n_prefix3);
10279 printf(" %d", n_name3);
10280 printf("\n");
10281 }
10282 }
10283 }
10284 }
10285 }
10286 }
10287 }
10288 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010290
Daniel Veillard42595322004-11-08 10:52:06 +000010291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010292}
10293
10294
10295static int
10296test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010298
Daniel Veillard42595322004-11-08 10:52:06 +000010299 int mem_base;
10300 int ret_val;
10301 xmlHashTablePtr table; /* the hash table */
10302 int n_table;
10303 xmlChar * name; /* the name of the userdata */
10304 int n_name;
10305 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10306 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010307
Daniel Veillard42595322004-11-08 10:52:06 +000010308 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10309 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10310 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10311 mem_base = xmlMemBlocks();
10312 table = gen_xmlHashTablePtr(n_table, 0);
10313 name = gen_const_xmlChar_ptr(n_name, 1);
10314 f = gen_xmlHashDeallocator(n_f, 2);
10315
William M. Brackf13f77f2004-11-12 16:03:48 +000010316 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010317 desret_int(ret_val);
10318 call_tests++;
10319 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010320 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010321 des_xmlHashDeallocator(n_f, f, 2);
10322 xmlResetLastError();
10323 if (mem_base != xmlMemBlocks()) {
10324 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10325 xmlMemBlocks() - mem_base);
10326 test_ret++;
10327 printf(" %d", n_table);
10328 printf(" %d", n_name);
10329 printf(" %d", n_f);
10330 printf("\n");
10331 }
10332 }
10333 }
10334 }
Daniel Veillard42595322004-11-08 10:52:06 +000010335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010336
Daniel Veillard42595322004-11-08 10:52:06 +000010337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010338}
10339
10340
10341static int
10342test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010344
Daniel Veillard42595322004-11-08 10:52:06 +000010345 int mem_base;
10346 int ret_val;
10347 xmlHashTablePtr table; /* the hash table */
10348 int n_table;
10349 xmlChar * name; /* the name of the userdata */
10350 int n_name;
10351 xmlChar * name2; /* a second name of the userdata */
10352 int n_name2;
10353 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10354 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010355
Daniel Veillard42595322004-11-08 10:52:06 +000010356 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10357 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10358 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10359 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10360 mem_base = xmlMemBlocks();
10361 table = gen_xmlHashTablePtr(n_table, 0);
10362 name = gen_const_xmlChar_ptr(n_name, 1);
10363 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10364 f = gen_xmlHashDeallocator(n_f, 3);
10365
William M. Brackf13f77f2004-11-12 16:03:48 +000010366 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010367 desret_int(ret_val);
10368 call_tests++;
10369 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010370 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10371 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010372 des_xmlHashDeallocator(n_f, f, 3);
10373 xmlResetLastError();
10374 if (mem_base != xmlMemBlocks()) {
10375 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10376 xmlMemBlocks() - mem_base);
10377 test_ret++;
10378 printf(" %d", n_table);
10379 printf(" %d", n_name);
10380 printf(" %d", n_name2);
10381 printf(" %d", n_f);
10382 printf("\n");
10383 }
10384 }
10385 }
10386 }
10387 }
Daniel Veillard42595322004-11-08 10:52:06 +000010388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010389
Daniel Veillard42595322004-11-08 10:52:06 +000010390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010391}
10392
10393
10394static int
10395test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010397
Daniel Veillard42595322004-11-08 10:52:06 +000010398 int mem_base;
10399 int ret_val;
10400 xmlHashTablePtr table; /* the hash table */
10401 int n_table;
10402 xmlChar * name; /* the name of the userdata */
10403 int n_name;
10404 xmlChar * name2; /* a second name of the userdata */
10405 int n_name2;
10406 xmlChar * name3; /* a third name of the userdata */
10407 int n_name3;
10408 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10409 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010410
Daniel Veillard42595322004-11-08 10:52:06 +000010411 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10412 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10413 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10414 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10415 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10416 mem_base = xmlMemBlocks();
10417 table = gen_xmlHashTablePtr(n_table, 0);
10418 name = gen_const_xmlChar_ptr(n_name, 1);
10419 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10420 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10421 f = gen_xmlHashDeallocator(n_f, 4);
10422
William M. Brackf13f77f2004-11-12 16:03:48 +000010423 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010424 desret_int(ret_val);
10425 call_tests++;
10426 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010427 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10428 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10429 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010430 des_xmlHashDeallocator(n_f, f, 4);
10431 xmlResetLastError();
10432 if (mem_base != xmlMemBlocks()) {
10433 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10434 xmlMemBlocks() - mem_base);
10435 test_ret++;
10436 printf(" %d", n_table);
10437 printf(" %d", n_name);
10438 printf(" %d", n_name2);
10439 printf(" %d", n_name3);
10440 printf(" %d", n_f);
10441 printf("\n");
10442 }
10443 }
10444 }
10445 }
10446 }
10447 }
Daniel Veillard42595322004-11-08 10:52:06 +000010448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010449
Daniel Veillard42595322004-11-08 10:52:06 +000010450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010451}
10452
10453
10454static int
10455test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010457
10458
10459 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461}
10462
10463
10464static int
10465test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010467
10468
10469 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010471}
10472
10473
10474static int
10475test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010477
10478
10479 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010481}
10482
10483
10484static int
10485test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010487
10488
10489 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010491}
10492
10493
10494static int
10495test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010497
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010498 int mem_base;
10499 int ret_val;
10500 xmlHashTablePtr table; /* the hash table */
10501 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010502
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010503 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10504 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010505 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010506
10507 ret_val = xmlHashSize(table);
10508 desret_int(ret_val);
10509 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010510 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010511 xmlResetLastError();
10512 if (mem_base != xmlMemBlocks()) {
10513 printf("Leak of %d blocks found in xmlHashSize",
10514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010515 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010516 printf(" %d", n_table);
10517 printf("\n");
10518 }
10519 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010520 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010521
Daniel Veillard42595322004-11-08 10:52:06 +000010522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010523}
10524
10525
10526static int
10527test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010529
Daniel Veillard42595322004-11-08 10:52:06 +000010530 int mem_base;
10531 int ret_val;
10532 xmlHashTablePtr table; /* the hash table */
10533 int n_table;
10534 xmlChar * name; /* the name of the userdata */
10535 int n_name;
10536 void * userdata; /* a pointer to the userdata */
10537 int n_userdata;
10538 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10539 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010540
Daniel Veillard42595322004-11-08 10:52:06 +000010541 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10542 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10543 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10544 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10545 mem_base = xmlMemBlocks();
10546 table = gen_xmlHashTablePtr(n_table, 0);
10547 name = gen_const_xmlChar_ptr(n_name, 1);
10548 userdata = gen_userdata(n_userdata, 2);
10549 f = gen_xmlHashDeallocator(n_f, 3);
10550
William M. Brackf13f77f2004-11-12 16:03:48 +000010551 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010552 desret_int(ret_val);
10553 call_tests++;
10554 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010555 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010556 des_userdata(n_userdata, userdata, 2);
10557 des_xmlHashDeallocator(n_f, f, 3);
10558 xmlResetLastError();
10559 if (mem_base != xmlMemBlocks()) {
10560 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10561 xmlMemBlocks() - mem_base);
10562 test_ret++;
10563 printf(" %d", n_table);
10564 printf(" %d", n_name);
10565 printf(" %d", n_userdata);
10566 printf(" %d", n_f);
10567 printf("\n");
10568 }
10569 }
10570 }
10571 }
10572 }
Daniel Veillard42595322004-11-08 10:52:06 +000010573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010574
Daniel Veillard42595322004-11-08 10:52:06 +000010575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576}
10577
10578
10579static int
10580test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010582
Daniel Veillard42595322004-11-08 10:52:06 +000010583 int mem_base;
10584 int ret_val;
10585 xmlHashTablePtr table; /* the hash table */
10586 int n_table;
10587 xmlChar * name; /* the name of the userdata */
10588 int n_name;
10589 xmlChar * name2; /* a second name of the userdata */
10590 int n_name2;
10591 void * userdata; /* a pointer to the userdata */
10592 int n_userdata;
10593 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10594 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010595
Daniel Veillard42595322004-11-08 10:52:06 +000010596 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10597 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10598 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10599 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10600 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10601 mem_base = xmlMemBlocks();
10602 table = gen_xmlHashTablePtr(n_table, 0);
10603 name = gen_const_xmlChar_ptr(n_name, 1);
10604 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10605 userdata = gen_userdata(n_userdata, 3);
10606 f = gen_xmlHashDeallocator(n_f, 4);
10607
William M. Brackf13f77f2004-11-12 16:03:48 +000010608 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010609 desret_int(ret_val);
10610 call_tests++;
10611 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010612 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10613 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010614 des_userdata(n_userdata, userdata, 3);
10615 des_xmlHashDeallocator(n_f, f, 4);
10616 xmlResetLastError();
10617 if (mem_base != xmlMemBlocks()) {
10618 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10619 xmlMemBlocks() - mem_base);
10620 test_ret++;
10621 printf(" %d", n_table);
10622 printf(" %d", n_name);
10623 printf(" %d", n_name2);
10624 printf(" %d", n_userdata);
10625 printf(" %d", n_f);
10626 printf("\n");
10627 }
10628 }
10629 }
10630 }
10631 }
10632 }
Daniel Veillard42595322004-11-08 10:52:06 +000010633 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010634
Daniel Veillard42595322004-11-08 10:52:06 +000010635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010636}
10637
10638
10639static int
10640test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010642
Daniel Veillard42595322004-11-08 10:52:06 +000010643 int mem_base;
10644 int ret_val;
10645 xmlHashTablePtr table; /* the hash table */
10646 int n_table;
10647 xmlChar * name; /* the name of the userdata */
10648 int n_name;
10649 xmlChar * name2; /* a second name of the userdata */
10650 int n_name2;
10651 xmlChar * name3; /* a third name of the userdata */
10652 int n_name3;
10653 void * userdata; /* a pointer to the userdata */
10654 int n_userdata;
10655 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10656 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010657
Daniel Veillard42595322004-11-08 10:52:06 +000010658 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10659 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10660 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10661 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10662 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10663 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10664 mem_base = xmlMemBlocks();
10665 table = gen_xmlHashTablePtr(n_table, 0);
10666 name = gen_const_xmlChar_ptr(n_name, 1);
10667 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10668 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10669 userdata = gen_userdata(n_userdata, 4);
10670 f = gen_xmlHashDeallocator(n_f, 5);
10671
William M. Brackf13f77f2004-11-12 16:03:48 +000010672 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010673 desret_int(ret_val);
10674 call_tests++;
10675 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010676 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10677 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10678 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010679 des_userdata(n_userdata, userdata, 4);
10680 des_xmlHashDeallocator(n_f, f, 5);
10681 xmlResetLastError();
10682 if (mem_base != xmlMemBlocks()) {
10683 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10684 xmlMemBlocks() - mem_base);
10685 test_ret++;
10686 printf(" %d", n_table);
10687 printf(" %d", n_name);
10688 printf(" %d", n_name2);
10689 printf(" %d", n_name3);
10690 printf(" %d", n_userdata);
10691 printf(" %d", n_f);
10692 printf("\n");
10693 }
10694 }
10695 }
10696 }
10697 }
10698 }
10699 }
Daniel Veillard42595322004-11-08 10:52:06 +000010700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010701
Daniel Veillard42595322004-11-08 10:52:06 +000010702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010703}
10704
10705static int
10706test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010708
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010709 if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010710 test_ret += test_xmlHashAddEntry();
10711 test_ret += test_xmlHashAddEntry2();
10712 test_ret += test_xmlHashAddEntry3();
10713 test_ret += test_xmlHashCopy();
10714 test_ret += test_xmlHashCreate();
10715 test_ret += test_xmlHashLookup();
10716 test_ret += test_xmlHashLookup2();
10717 test_ret += test_xmlHashLookup3();
10718 test_ret += test_xmlHashQLookup();
10719 test_ret += test_xmlHashQLookup2();
10720 test_ret += test_xmlHashQLookup3();
10721 test_ret += test_xmlHashRemoveEntry();
10722 test_ret += test_xmlHashRemoveEntry2();
10723 test_ret += test_xmlHashRemoveEntry3();
10724 test_ret += test_xmlHashScan();
10725 test_ret += test_xmlHashScan3();
10726 test_ret += test_xmlHashScanFull();
10727 test_ret += test_xmlHashScanFull3();
10728 test_ret += test_xmlHashSize();
10729 test_ret += test_xmlHashUpdateEntry();
10730 test_ret += test_xmlHashUpdateEntry2();
10731 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010732
Daniel Veillard42595322004-11-08 10:52:06 +000010733 if (test_ret != 0)
10734 printf("Module hash: %d errors\n", test_ret);
10735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010736}
10737
Daniel Veillardce682bc2004-11-05 17:22:25 +000010738#define gen_nb_xmlLinkPtr 1
10739static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10740 return(NULL);
10741}
10742static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10743}
10744
Daniel Veillardd93f6252004-11-02 15:53:51 +000010745static int
10746test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010748
Daniel Veillardce682bc2004-11-05 17:22:25 +000010749 int mem_base;
10750 void * ret_val;
10751 xmlLinkPtr lk; /* a link */
10752 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010753
Daniel Veillardce682bc2004-11-05 17:22:25 +000010754 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10755 mem_base = xmlMemBlocks();
10756 lk = gen_xmlLinkPtr(n_lk, 0);
10757
10758 ret_val = xmlLinkGetData(lk);
10759 desret_void_ptr(ret_val);
10760 call_tests++;
10761 des_xmlLinkPtr(n_lk, lk, 0);
10762 xmlResetLastError();
10763 if (mem_base != xmlMemBlocks()) {
10764 printf("Leak of %d blocks found in xmlLinkGetData",
10765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010766 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010767 printf(" %d", n_lk);
10768 printf("\n");
10769 }
10770 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010772
Daniel Veillard42595322004-11-08 10:52:06 +000010773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010774}
10775
10776
10777static int
10778test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010780
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010781 int mem_base;
10782 int ret_val;
10783 xmlListPtr l; /* a list */
10784 int n_l;
10785 void * data; /* the data */
10786 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010787
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010788 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10789 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010791 l = gen_xmlListPtr(n_l, 0);
10792 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010793
10794 ret_val = xmlListAppend(l, data);
10795 desret_int(ret_val);
10796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010797 des_xmlListPtr(n_l, l, 0);
10798 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010799 xmlResetLastError();
10800 if (mem_base != xmlMemBlocks()) {
10801 printf("Leak of %d blocks found in xmlListAppend",
10802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010803 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010804 printf(" %d", n_l);
10805 printf(" %d", n_data);
10806 printf("\n");
10807 }
10808 }
10809 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010811
Daniel Veillard42595322004-11-08 10:52:06 +000010812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010813}
10814
10815
10816static int
10817test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010819
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010820 int mem_base;
10821 xmlListPtr l; /* a list */
10822 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10825 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010826 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010827
10828 xmlListClear(l);
10829 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010830 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010831 xmlResetLastError();
10832 if (mem_base != xmlMemBlocks()) {
10833 printf("Leak of %d blocks found in xmlListClear",
10834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010835 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010836 printf(" %d", n_l);
10837 printf("\n");
10838 }
10839 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010840 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010841
Daniel Veillard42595322004-11-08 10:52:06 +000010842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010843}
10844
10845
Daniel Veillardce682bc2004-11-05 17:22:25 +000010846#define gen_nb_const_xmlListPtr 1
10847static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10848 return(NULL);
10849}
10850static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10851}
10852
Daniel Veillardd93f6252004-11-02 15:53:51 +000010853static int
10854test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010856
Daniel Veillardce682bc2004-11-05 17:22:25 +000010857 int mem_base;
10858 int ret_val;
10859 xmlListPtr cur; /* the new list */
10860 int n_cur;
10861 xmlListPtr old; /* the old list */
10862 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010863
Daniel Veillardce682bc2004-11-05 17:22:25 +000010864 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10865 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10866 mem_base = xmlMemBlocks();
10867 cur = gen_xmlListPtr(n_cur, 0);
10868 old = gen_const_xmlListPtr(n_old, 1);
10869
William M. Brackf13f77f2004-11-12 16:03:48 +000010870 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010871 desret_int(ret_val);
10872 call_tests++;
10873 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010874 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010875 xmlResetLastError();
10876 if (mem_base != xmlMemBlocks()) {
10877 printf("Leak of %d blocks found in xmlListCopy",
10878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010879 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010880 printf(" %d", n_cur);
10881 printf(" %d", n_old);
10882 printf("\n");
10883 }
10884 }
10885 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010886 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010887
Daniel Veillard42595322004-11-08 10:52:06 +000010888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010889}
10890
10891
10892static int
10893test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010895
10896
10897 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010899}
10900
10901
10902static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010903test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010905
10906
10907 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010909}
10910
10911
10912static int
10913test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010915
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010916 int mem_base;
10917 int ret_val;
10918 xmlListPtr l; /* a list */
10919 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010920
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010921 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10922 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010923 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010924
10925 ret_val = xmlListEmpty(l);
10926 desret_int(ret_val);
10927 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010928 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010929 xmlResetLastError();
10930 if (mem_base != xmlMemBlocks()) {
10931 printf("Leak of %d blocks found in xmlListEmpty",
10932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010933 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010934 printf(" %d", n_l);
10935 printf("\n");
10936 }
10937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010939
Daniel Veillard42595322004-11-08 10:52:06 +000010940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010941}
10942
10943
10944static int
10945test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010947
10948
10949 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010951}
10952
10953
10954static int
10955test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010957
10958
10959 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010961}
10962
10963
10964static int
10965test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010967
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010968 int mem_base;
10969 int ret_val;
10970 xmlListPtr l; /* a list */
10971 int n_l;
10972 void * data; /* the data */
10973 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010974
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010975 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10976 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010978 l = gen_xmlListPtr(n_l, 0);
10979 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010980
10981 ret_val = xmlListInsert(l, data);
10982 desret_int(ret_val);
10983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010984 des_xmlListPtr(n_l, l, 0);
10985 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010986 xmlResetLastError();
10987 if (mem_base != xmlMemBlocks()) {
10988 printf("Leak of %d blocks found in xmlListInsert",
10989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010990 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010991 printf(" %d", n_l);
10992 printf(" %d", n_data);
10993 printf("\n");
10994 }
10995 }
10996 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010997 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010998
Daniel Veillard42595322004-11-08 10:52:06 +000010999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011000}
11001
11002
11003static int
11004test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011006
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011007 int mem_base;
11008 xmlListPtr l1; /* the original list */
11009 int n_l1;
11010 xmlListPtr l2; /* the new list */
11011 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011012
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011013 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
11014 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
11015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011016 l1 = gen_xmlListPtr(n_l1, 0);
11017 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011018
11019 xmlListMerge(l1, l2);
11020 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011021 des_xmlListPtr(n_l1, l1, 0);
11022 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011023 xmlResetLastError();
11024 if (mem_base != xmlMemBlocks()) {
11025 printf("Leak of %d blocks found in xmlListMerge",
11026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011027 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011028 printf(" %d", n_l1);
11029 printf(" %d", n_l2);
11030 printf("\n");
11031 }
11032 }
11033 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011034 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011035
Daniel Veillard42595322004-11-08 10:52:06 +000011036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011037}
11038
11039
11040static int
11041test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011043
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011044 int mem_base;
11045 xmlListPtr l; /* a list */
11046 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011047
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011048 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011050 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011051
11052 xmlListPopBack(l);
11053 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011054 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011055 xmlResetLastError();
11056 if (mem_base != xmlMemBlocks()) {
11057 printf("Leak of %d blocks found in xmlListPopBack",
11058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011059 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011060 printf(" %d", n_l);
11061 printf("\n");
11062 }
11063 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011065
Daniel Veillard42595322004-11-08 10:52:06 +000011066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011067}
11068
11069
11070static int
11071test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011073
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011074 int mem_base;
11075 xmlListPtr l; /* a list */
11076 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011077
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011078 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11079 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011080 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011081
11082 xmlListPopFront(l);
11083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011084 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011085 xmlResetLastError();
11086 if (mem_base != xmlMemBlocks()) {
11087 printf("Leak of %d blocks found in xmlListPopFront",
11088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011089 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011090 printf(" %d", n_l);
11091 printf("\n");
11092 }
11093 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011094 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011095
Daniel Veillard42595322004-11-08 10:52:06 +000011096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011097}
11098
11099
11100static int
11101test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011103
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011104 int mem_base;
11105 int ret_val;
11106 xmlListPtr l; /* a list */
11107 int n_l;
11108 void * data; /* new data */
11109 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011110
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011111 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11112 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011114 l = gen_xmlListPtr(n_l, 0);
11115 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011116
11117 ret_val = xmlListPushBack(l, data);
11118 desret_int(ret_val);
11119 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011120 des_xmlListPtr(n_l, l, 0);
11121 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011122 xmlResetLastError();
11123 if (mem_base != xmlMemBlocks()) {
11124 printf("Leak of %d blocks found in xmlListPushBack",
11125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011126 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011127 printf(" %d", n_l);
11128 printf(" %d", n_data);
11129 printf("\n");
11130 }
11131 }
11132 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011133 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011134
Daniel Veillard42595322004-11-08 10:52:06 +000011135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011136}
11137
11138
11139static int
11140test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011142
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011143 int mem_base;
11144 int ret_val;
11145 xmlListPtr l; /* a list */
11146 int n_l;
11147 void * data; /* new data */
11148 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011149
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011150 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11151 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11152 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011153 l = gen_xmlListPtr(n_l, 0);
11154 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011155
11156 ret_val = xmlListPushFront(l, data);
11157 desret_int(ret_val);
11158 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011159 des_xmlListPtr(n_l, l, 0);
11160 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011161 xmlResetLastError();
11162 if (mem_base != xmlMemBlocks()) {
11163 printf("Leak of %d blocks found in xmlListPushFront",
11164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011165 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011166 printf(" %d", n_l);
11167 printf(" %d", n_data);
11168 printf("\n");
11169 }
11170 }
11171 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011172 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011173
Daniel Veillard42595322004-11-08 10:52:06 +000011174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011175}
11176
11177
11178static int
11179test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011181
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011182 int mem_base;
11183 int ret_val;
11184 xmlListPtr l; /* a list */
11185 int n_l;
11186 void * data; /* list data */
11187 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011188
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011189 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11190 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11191 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011192 l = gen_xmlListPtr(n_l, 0);
11193 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011194
11195 ret_val = xmlListRemoveAll(l, data);
11196 desret_int(ret_val);
11197 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011198 des_xmlListPtr(n_l, l, 0);
11199 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011200 xmlResetLastError();
11201 if (mem_base != xmlMemBlocks()) {
11202 printf("Leak of %d blocks found in xmlListRemoveAll",
11203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011204 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011205 printf(" %d", n_l);
11206 printf(" %d", n_data);
11207 printf("\n");
11208 }
11209 }
11210 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011211 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011212
Daniel Veillard42595322004-11-08 10:52:06 +000011213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011214}
11215
11216
11217static int
11218test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011220
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011221 int mem_base;
11222 int ret_val;
11223 xmlListPtr l; /* a list */
11224 int n_l;
11225 void * data; /* list data */
11226 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011227
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011228 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11229 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11230 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011231 l = gen_xmlListPtr(n_l, 0);
11232 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011233
11234 ret_val = xmlListRemoveFirst(l, data);
11235 desret_int(ret_val);
11236 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011237 des_xmlListPtr(n_l, l, 0);
11238 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011239 xmlResetLastError();
11240 if (mem_base != xmlMemBlocks()) {
11241 printf("Leak of %d blocks found in xmlListRemoveFirst",
11242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011243 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011244 printf(" %d", n_l);
11245 printf(" %d", n_data);
11246 printf("\n");
11247 }
11248 }
11249 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011250 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011251
Daniel Veillard42595322004-11-08 10:52:06 +000011252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011253}
11254
11255
11256static int
11257test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011259
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011260 int mem_base;
11261 int ret_val;
11262 xmlListPtr l; /* a list */
11263 int n_l;
11264 void * data; /* list data */
11265 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011266
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011267 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11268 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11269 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011270 l = gen_xmlListPtr(n_l, 0);
11271 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011272
11273 ret_val = xmlListRemoveLast(l, data);
11274 desret_int(ret_val);
11275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011276 des_xmlListPtr(n_l, l, 0);
11277 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011278 xmlResetLastError();
11279 if (mem_base != xmlMemBlocks()) {
11280 printf("Leak of %d blocks found in xmlListRemoveLast",
11281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011282 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011283 printf(" %d", n_l);
11284 printf(" %d", n_data);
11285 printf("\n");
11286 }
11287 }
11288 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011290
Daniel Veillard42595322004-11-08 10:52:06 +000011291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011292}
11293
11294
11295static int
11296test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011298
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011299 int mem_base;
11300 xmlListPtr l; /* a list */
11301 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011302
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011303 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11304 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011305 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011306
11307 xmlListReverse(l);
11308 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011309 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011310 xmlResetLastError();
11311 if (mem_base != xmlMemBlocks()) {
11312 printf("Leak of %d blocks found in xmlListReverse",
11313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011314 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011315 printf(" %d", n_l);
11316 printf("\n");
11317 }
11318 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011319 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011320
Daniel Veillard42595322004-11-08 10:52:06 +000011321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011322}
11323
11324
11325static int
11326test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011328
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011329 int mem_base;
11330 void * ret_val;
11331 xmlListPtr l; /* a list */
11332 int n_l;
11333 void * data; /* a search value */
11334 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011335
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011336 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11337 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11338 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011339 l = gen_xmlListPtr(n_l, 0);
11340 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011341
11342 ret_val = xmlListReverseSearch(l, data);
11343 desret_void_ptr(ret_val);
11344 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011345 des_xmlListPtr(n_l, l, 0);
11346 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011347 xmlResetLastError();
11348 if (mem_base != xmlMemBlocks()) {
11349 printf("Leak of %d blocks found in xmlListReverseSearch",
11350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011351 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011352 printf(" %d", n_l);
11353 printf(" %d", n_data);
11354 printf("\n");
11355 }
11356 }
11357 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011358 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011359
Daniel Veillard42595322004-11-08 10:52:06 +000011360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011361}
11362
11363
11364static int
11365test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011367
11368
11369 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011371}
11372
11373
11374static int
11375test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011377
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011378 int mem_base;
11379 void * ret_val;
11380 xmlListPtr l; /* a list */
11381 int n_l;
11382 void * data; /* a search value */
11383 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011384
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011385 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11386 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011388 l = gen_xmlListPtr(n_l, 0);
11389 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011390
11391 ret_val = xmlListSearch(l, data);
11392 desret_void_ptr(ret_val);
11393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011394 des_xmlListPtr(n_l, l, 0);
11395 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011396 xmlResetLastError();
11397 if (mem_base != xmlMemBlocks()) {
11398 printf("Leak of %d blocks found in xmlListSearch",
11399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011400 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011401 printf(" %d", n_l);
11402 printf(" %d", n_data);
11403 printf("\n");
11404 }
11405 }
11406 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011407 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011408
Daniel Veillard42595322004-11-08 10:52:06 +000011409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011410}
11411
11412
11413static int
11414test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011416
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011417 int mem_base;
11418 int ret_val;
11419 xmlListPtr l; /* a list */
11420 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011421
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011422 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11423 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011424 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011425
11426 ret_val = xmlListSize(l);
11427 desret_int(ret_val);
11428 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011429 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011430 xmlResetLastError();
11431 if (mem_base != xmlMemBlocks()) {
11432 printf("Leak of %d blocks found in xmlListSize",
11433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011434 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011435 printf(" %d", n_l);
11436 printf("\n");
11437 }
11438 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011439 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011440
Daniel Veillard42595322004-11-08 10:52:06 +000011441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011442}
11443
11444
11445static int
11446test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011448
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011449 int mem_base;
11450 xmlListPtr l; /* a list */
11451 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011452
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011453 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11454 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011455 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011456
11457 xmlListSort(l);
11458 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011459 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011460 xmlResetLastError();
11461 if (mem_base != xmlMemBlocks()) {
11462 printf("Leak of %d blocks found in xmlListSort",
11463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011464 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011465 printf(" %d", n_l);
11466 printf("\n");
11467 }
11468 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011469 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011470
Daniel Veillard42595322004-11-08 10:52:06 +000011471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011472}
11473
11474
11475static int
11476test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011478
11479
11480 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011482}
11483
11484static int
11485test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011487
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011488 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011489 test_ret += test_xmlLinkGetData();
11490 test_ret += test_xmlListAppend();
11491 test_ret += test_xmlListClear();
11492 test_ret += test_xmlListCopy();
11493 test_ret += test_xmlListCreate();
11494 test_ret += test_xmlListDup();
11495 test_ret += test_xmlListEmpty();
11496 test_ret += test_xmlListEnd();
11497 test_ret += test_xmlListFront();
11498 test_ret += test_xmlListInsert();
11499 test_ret += test_xmlListMerge();
11500 test_ret += test_xmlListPopBack();
11501 test_ret += test_xmlListPopFront();
11502 test_ret += test_xmlListPushBack();
11503 test_ret += test_xmlListPushFront();
11504 test_ret += test_xmlListRemoveAll();
11505 test_ret += test_xmlListRemoveFirst();
11506 test_ret += test_xmlListRemoveLast();
11507 test_ret += test_xmlListReverse();
11508 test_ret += test_xmlListReverseSearch();
11509 test_ret += test_xmlListReverseWalk();
11510 test_ret += test_xmlListSearch();
11511 test_ret += test_xmlListSize();
11512 test_ret += test_xmlListSort();
11513 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011514
Daniel Veillard42595322004-11-08 10:52:06 +000011515 if (test_ret != 0)
11516 printf("Module list: %d errors\n", test_ret);
11517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011518}
11519
11520static int
11521test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011523
Daniel Veillard27f20102004-11-05 11:50:11 +000011524#ifdef LIBXML_FTP_ENABLED
11525 int mem_base;
11526 int ret_val;
11527 void * ctx; /* an FTP context */
11528 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011529
Daniel Veillard27f20102004-11-05 11:50:11 +000011530 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11531 mem_base = xmlMemBlocks();
11532 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11533
11534 ret_val = xmlNanoFTPCheckResponse(ctx);
11535 desret_int(ret_val);
11536 call_tests++;
11537 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11538 xmlResetLastError();
11539 if (mem_base != xmlMemBlocks()) {
11540 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011542 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011543 printf(" %d", n_ctx);
11544 printf("\n");
11545 }
11546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011547 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011548#endif
11549
Daniel Veillard42595322004-11-08 10:52:06 +000011550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011551}
11552
11553
11554static int
11555test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011557
11558#ifdef LIBXML_FTP_ENABLED
11559 int mem_base;
11560
11561 mem_base = xmlMemBlocks();
11562
11563 xmlNanoFTPCleanup();
11564 call_tests++;
11565 xmlResetLastError();
11566 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011567 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011569 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011570 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011572 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011573#endif
11574
Daniel Veillard42595322004-11-08 10:52:06 +000011575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576}
11577
11578
11579static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011580test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011582
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011583#ifdef LIBXML_FTP_ENABLED
11584 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011585 int ret_val;
11586 void * ctx; /* an FTP context */
11587 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011588
Daniel Veillard27f20102004-11-05 11:50:11 +000011589 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011590 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011591 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011592
Daniel Veillard27f20102004-11-05 11:50:11 +000011593 ret_val = xmlNanoFTPCloseConnection(ctx);
11594 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011595 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011596 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011597 xmlResetLastError();
11598 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011599 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011601 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011602 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011603 printf("\n");
11604 }
11605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011606 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011607#endif
11608
Daniel Veillard42595322004-11-08 10:52:06 +000011609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011610}
11611
11612
11613static int
11614test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011616
Daniel Veillard27f20102004-11-05 11:50:11 +000011617#ifdef LIBXML_FTP_ENABLED
11618 int mem_base;
11619 int ret_val;
11620 void * ctx; /* an FTP context */
11621 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011622 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011623 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011624
Daniel Veillard27f20102004-11-05 11:50:11 +000011625 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11626 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11627 mem_base = xmlMemBlocks();
11628 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11629 directory = gen_const_char_ptr(n_directory, 1);
11630
William M. Brackf13f77f2004-11-12 16:03:48 +000011631 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011632 desret_int(ret_val);
11633 call_tests++;
11634 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011635 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011636 xmlResetLastError();
11637 if (mem_base != xmlMemBlocks()) {
11638 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011640 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011641 printf(" %d", n_ctx);
11642 printf(" %d", n_directory);
11643 printf("\n");
11644 }
11645 }
11646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011647 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011648#endif
11649
Daniel Veillard42595322004-11-08 10:52:06 +000011650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011651}
11652
11653
11654static int
11655test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011657
Daniel Veillard27f20102004-11-05 11:50:11 +000011658#ifdef LIBXML_FTP_ENABLED
11659 int mem_base;
11660 int ret_val;
11661 void * ctx; /* an FTP context */
11662 int n_ctx;
11663 const char * file; /* a file or directory on the server */
11664 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011665
Daniel Veillard27f20102004-11-05 11:50:11 +000011666 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11667 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11668 mem_base = xmlMemBlocks();
11669 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11670 file = gen_filepath(n_file, 1);
11671
11672 ret_val = xmlNanoFTPDele(ctx, file);
11673 desret_int(ret_val);
11674 call_tests++;
11675 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11676 des_filepath(n_file, file, 1);
11677 xmlResetLastError();
11678 if (mem_base != xmlMemBlocks()) {
11679 printf("Leak of %d blocks found in xmlNanoFTPDele",
11680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011681 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011682 printf(" %d", n_ctx);
11683 printf(" %d", n_file);
11684 printf("\n");
11685 }
11686 }
11687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011688 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011689#endif
11690
Daniel Veillard42595322004-11-08 10:52:06 +000011691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011692}
11693
11694
11695static int
11696test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011698
11699
11700 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011702}
11703
11704
11705static int
11706test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011708
Daniel Veillard27f20102004-11-05 11:50:11 +000011709#ifdef LIBXML_FTP_ENABLED
11710 int mem_base;
11711 int ret_val;
11712 void * ctx; /* an FTP context */
11713 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011714
Daniel Veillard27f20102004-11-05 11:50:11 +000011715 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11716 mem_base = xmlMemBlocks();
11717 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11718
11719 ret_val = xmlNanoFTPGetConnection(ctx);
11720 desret_int(ret_val);
11721 call_tests++;
11722 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11723 xmlResetLastError();
11724 if (mem_base != xmlMemBlocks()) {
11725 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011727 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011728 printf(" %d", n_ctx);
11729 printf("\n");
11730 }
11731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011732 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011733#endif
11734
Daniel Veillard42595322004-11-08 10:52:06 +000011735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011736}
11737
11738
11739static int
11740test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011742
Daniel Veillard27f20102004-11-05 11:50:11 +000011743#ifdef LIBXML_FTP_ENABLED
11744 int mem_base;
11745 int ret_val;
11746 void * ctx; /* an FTP context */
11747 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011748
Daniel Veillard27f20102004-11-05 11:50:11 +000011749 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11750 mem_base = xmlMemBlocks();
11751 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11752
11753 ret_val = xmlNanoFTPGetResponse(ctx);
11754 desret_int(ret_val);
11755 call_tests++;
11756 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11757 xmlResetLastError();
11758 if (mem_base != xmlMemBlocks()) {
11759 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011761 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011762 printf(" %d", n_ctx);
11763 printf("\n");
11764 }
11765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011766 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011767#endif
11768
Daniel Veillard42595322004-11-08 10:52:06 +000011769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011770}
11771
11772
11773static int
11774test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011776
Daniel Veillard27f20102004-11-05 11:50:11 +000011777#ifdef LIBXML_FTP_ENABLED
11778 int mem_base;
11779 int ret_val;
11780 void * ctx; /* an FTP context */
11781 int n_ctx;
11782 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11783 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011784
Daniel Veillard27f20102004-11-05 11:50:11 +000011785 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11786 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11787 mem_base = xmlMemBlocks();
11788 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11789 filename = gen_filepath(n_filename, 1);
11790
11791 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11792 desret_int(ret_val);
11793 call_tests++;
11794 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11795 des_filepath(n_filename, filename, 1);
11796 xmlResetLastError();
11797 if (mem_base != xmlMemBlocks()) {
11798 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011800 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011801 printf(" %d", n_ctx);
11802 printf(" %d", n_filename);
11803 printf("\n");
11804 }
11805 }
11806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011807 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011808#endif
11809
Daniel Veillard42595322004-11-08 10:52:06 +000011810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011811}
11812
11813
11814static int
11815test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011817
11818#ifdef LIBXML_FTP_ENABLED
11819 int mem_base;
11820
11821 mem_base = xmlMemBlocks();
11822
11823 xmlNanoFTPInit();
11824 call_tests++;
11825 xmlResetLastError();
11826 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011827 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011829 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011832 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011833#endif
11834
Daniel Veillard42595322004-11-08 10:52:06 +000011835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011836}
11837
11838
11839static int
11840test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011842
11843
11844 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011846}
11847
11848
11849static int
11850test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011852
11853
11854 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011856}
11857
11858
11859static int
11860test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011862
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011863#ifdef LIBXML_FTP_ENABLED
11864 int mem_base;
11865 void * ret_val;
11866 const char * URL; /* the URL to the resource */
11867 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011868
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011869 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11870 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011871 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011872
11873 ret_val = xmlNanoFTPOpen(URL);
11874 desret_void_ptr(ret_val);
11875 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011876 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011877 xmlResetLastError();
11878 if (mem_base != xmlMemBlocks()) {
11879 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011881 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011882 printf(" %d", n_URL);
11883 printf("\n");
11884 }
11885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011886 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011887#endif
11888
Daniel Veillard42595322004-11-08 10:52:06 +000011889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011890}
11891
11892
11893static int
11894test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011896
11897#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000011898 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011899 int n_host;
11900 int port; /* the proxy port */
11901 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011902 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011903 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011904 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011905 int n_passwd;
11906 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11907 int n_type;
11908
11909 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11910 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11911 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11912 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11913 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011914 host = gen_const_char_ptr(n_host, 0);
11915 port = gen_int(n_port, 1);
11916 user = gen_const_char_ptr(n_user, 2);
11917 passwd = gen_const_char_ptr(n_passwd, 3);
11918 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919
William M. Brackf13f77f2004-11-12 16:03:48 +000011920 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011921 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011922 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011923 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011924 des_const_char_ptr(n_user, (const char *)user, 2);
11925 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011926 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011927 xmlResetLastError();
11928 }
11929 }
11930 }
11931 }
11932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011933 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011934#endif
11935
Daniel Veillard42595322004-11-08 10:52:06 +000011936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011937}
11938
11939
11940static int
11941test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011943
Daniel Veillard27f20102004-11-05 11:50:11 +000011944#ifdef LIBXML_FTP_ENABLED
11945 int mem_base;
11946 int ret_val;
11947 void * ctx; /* an FTP context */
11948 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011949
Daniel Veillard27f20102004-11-05 11:50:11 +000011950 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11951 mem_base = xmlMemBlocks();
11952 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11953
11954 ret_val = xmlNanoFTPQuit(ctx);
11955 desret_int(ret_val);
11956 call_tests++;
11957 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11958 xmlResetLastError();
11959 if (mem_base != xmlMemBlocks()) {
11960 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011962 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011963 printf(" %d", n_ctx);
11964 printf("\n");
11965 }
11966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011967 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011968#endif
11969
Daniel Veillard42595322004-11-08 10:52:06 +000011970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011971}
11972
11973
11974static int
11975test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011977
Daniel Veillard27f20102004-11-05 11:50:11 +000011978#ifdef LIBXML_FTP_ENABLED
11979 int mem_base;
11980 int ret_val;
11981 void * ctx; /* the FTP context */
11982 int n_ctx;
11983 void * dest; /* a buffer */
11984 int n_dest;
11985 int len; /* the buffer length */
11986 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011987
Daniel Veillard27f20102004-11-05 11:50:11 +000011988 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11989 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11990 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11991 mem_base = xmlMemBlocks();
11992 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11993 dest = gen_void_ptr(n_dest, 1);
11994 len = gen_int(n_len, 2);
11995
11996 ret_val = xmlNanoFTPRead(ctx, dest, len);
11997 desret_int(ret_val);
11998 call_tests++;
11999 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
12000 des_void_ptr(n_dest, dest, 1);
12001 des_int(n_len, len, 2);
12002 xmlResetLastError();
12003 if (mem_base != xmlMemBlocks()) {
12004 printf("Leak of %d blocks found in xmlNanoFTPRead",
12005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012006 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012007 printf(" %d", n_ctx);
12008 printf(" %d", n_dest);
12009 printf(" %d", n_len);
12010 printf("\n");
12011 }
12012 }
12013 }
12014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012015 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012016#endif
12017
Daniel Veillard42595322004-11-08 10:52:06 +000012018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012019}
12020
12021
12022static int
12023test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012025
12026#ifdef LIBXML_FTP_ENABLED
12027 const char * URL; /* The proxy URL used to initialize the proxy context */
12028 int n_URL;
12029
12030 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012031 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012032
12033 xmlNanoFTPScanProxy(URL);
12034 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012035 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012036 xmlResetLastError();
12037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012038 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012039#endif
12040
Daniel Veillard42595322004-11-08 10:52:06 +000012041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012042}
12043
12044
12045static int
12046test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012048
Daniel Veillard27f20102004-11-05 11:50:11 +000012049#ifdef LIBXML_FTP_ENABLED
12050 int mem_base;
12051 int ret_val;
12052 void * ctx; /* an FTP context */
12053 int n_ctx;
12054 const char * URL; /* The URL used to update the context */
12055 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012056
Daniel Veillard27f20102004-11-05 11:50:11 +000012057 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
12058 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12059 mem_base = xmlMemBlocks();
12060 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
12061 URL = gen_filepath(n_URL, 1);
12062
12063 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
12064 desret_int(ret_val);
12065 call_tests++;
12066 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
12067 des_filepath(n_URL, URL, 1);
12068 xmlResetLastError();
12069 if (mem_base != xmlMemBlocks()) {
12070 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
12071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012072 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012073 printf(" %d", n_ctx);
12074 printf(" %d", n_URL);
12075 printf("\n");
12076 }
12077 }
12078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012079 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012080#endif
12081
Daniel Veillard42595322004-11-08 10:52:06 +000012082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012083}
12084
12085static int
12086test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012088
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012089 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012090 test_ret += test_xmlNanoFTPCheckResponse();
12091 test_ret += test_xmlNanoFTPCleanup();
12092 test_ret += test_xmlNanoFTPCloseConnection();
12093 test_ret += test_xmlNanoFTPCwd();
12094 test_ret += test_xmlNanoFTPDele();
12095 test_ret += test_xmlNanoFTPGet();
12096 test_ret += test_xmlNanoFTPGetConnection();
12097 test_ret += test_xmlNanoFTPGetResponse();
12098 test_ret += test_xmlNanoFTPGetSocket();
12099 test_ret += test_xmlNanoFTPInit();
12100 test_ret += test_xmlNanoFTPList();
12101 test_ret += test_xmlNanoFTPNewCtxt();
12102 test_ret += test_xmlNanoFTPOpen();
12103 test_ret += test_xmlNanoFTPProxy();
12104 test_ret += test_xmlNanoFTPQuit();
12105 test_ret += test_xmlNanoFTPRead();
12106 test_ret += test_xmlNanoFTPScanProxy();
12107 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012108
Daniel Veillard42595322004-11-08 10:52:06 +000012109 if (test_ret != 0)
12110 printf("Module nanoftp: %d errors\n", test_ret);
12111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012112}
12113
12114static int
12115test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012117
Daniel Veillard27f20102004-11-05 11:50:11 +000012118#ifdef LIBXML_HTTP_ENABLED
12119 int mem_base;
12120 const char * ret_val;
12121 void * ctx; /* the HTTP context */
12122 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012123
Daniel Veillard27f20102004-11-05 11:50:11 +000012124 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12125 mem_base = xmlMemBlocks();
12126 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12127
12128 ret_val = xmlNanoHTTPAuthHeader(ctx);
12129 desret_const_char_ptr(ret_val);
12130 call_tests++;
12131 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12132 xmlResetLastError();
12133 if (mem_base != xmlMemBlocks()) {
12134 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
12135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012136 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012137 printf(" %d", n_ctx);
12138 printf("\n");
12139 }
12140 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012141 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012142#endif
12143
Daniel Veillard42595322004-11-08 10:52:06 +000012144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012145}
12146
12147
12148static int
12149test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012151
12152#ifdef LIBXML_HTTP_ENABLED
12153 int mem_base;
12154
12155 mem_base = xmlMemBlocks();
12156
12157 xmlNanoHTTPCleanup();
12158 call_tests++;
12159 xmlResetLastError();
12160 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012161 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012163 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012164 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012166 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012167#endif
12168
Daniel Veillard42595322004-11-08 10:52:06 +000012169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012170}
12171
12172
12173static int
12174test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012176
Daniel Veillard27f20102004-11-05 11:50:11 +000012177#ifdef LIBXML_HTTP_ENABLED
12178 int mem_base;
12179 void * ctx; /* the HTTP context */
12180 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012181
Daniel Veillard27f20102004-11-05 11:50:11 +000012182 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12183 mem_base = xmlMemBlocks();
12184 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12185
12186 xmlNanoHTTPClose(ctx);
12187 call_tests++;
12188 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12189 xmlResetLastError();
12190 if (mem_base != xmlMemBlocks()) {
12191 printf("Leak of %d blocks found in xmlNanoHTTPClose",
12192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012193 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012194 printf(" %d", n_ctx);
12195 printf("\n");
12196 }
12197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012198 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012199#endif
12200
Daniel Veillard42595322004-11-08 10:52:06 +000012201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012202}
12203
12204
12205static int
12206test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012208
Daniel Veillard27f20102004-11-05 11:50:11 +000012209#ifdef LIBXML_HTTP_ENABLED
12210 int mem_base;
12211 int ret_val;
12212 void * ctx; /* the HTTP context */
12213 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012214
Daniel Veillard27f20102004-11-05 11:50:11 +000012215 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12216 mem_base = xmlMemBlocks();
12217 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12218
12219 ret_val = xmlNanoHTTPContentLength(ctx);
12220 desret_int(ret_val);
12221 call_tests++;
12222 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12223 xmlResetLastError();
12224 if (mem_base != xmlMemBlocks()) {
12225 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
12226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012227 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012228 printf(" %d", n_ctx);
12229 printf("\n");
12230 }
12231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012232 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012233#endif
12234
Daniel Veillard42595322004-11-08 10:52:06 +000012235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012236}
12237
12238
12239static int
12240test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012242
Daniel Veillard27f20102004-11-05 11:50:11 +000012243#ifdef LIBXML_HTTP_ENABLED
12244 int mem_base;
12245 const char * ret_val;
12246 void * ctx; /* the HTTP context */
12247 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012248
Daniel Veillard27f20102004-11-05 11:50:11 +000012249 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12250 mem_base = xmlMemBlocks();
12251 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12252
12253 ret_val = xmlNanoHTTPEncoding(ctx);
12254 desret_const_char_ptr(ret_val);
12255 call_tests++;
12256 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12257 xmlResetLastError();
12258 if (mem_base != xmlMemBlocks()) {
12259 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
12260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012261 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012262 printf(" %d", n_ctx);
12263 printf("\n");
12264 }
12265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012266 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012267#endif
12268
Daniel Veillard42595322004-11-08 10:52:06 +000012269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012270}
12271
12272
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012273#define gen_nb_char_ptr_ptr 1
12274static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12275 return(NULL);
12276}
12277static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12278}
12279
Daniel Veillardd93f6252004-11-02 15:53:51 +000012280static int
12281test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012283
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012284#ifdef LIBXML_HTTP_ENABLED
12285 int mem_base;
12286 int ret_val;
12287 const char * URL; /* The URL to load */
12288 int n_URL;
12289 const char * filename; /* the filename where the content should be saved */
12290 int n_filename;
12291 char ** contentType; /* if available the Content-Type information will be returned at that location */
12292 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012293
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012294 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12295 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12296 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12297 mem_base = xmlMemBlocks();
12298 URL = gen_filepath(n_URL, 0);
12299 filename = gen_filepath(n_filename, 1);
12300 contentType = gen_char_ptr_ptr(n_contentType, 2);
12301
12302 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12303 desret_int(ret_val);
12304 call_tests++;
12305 des_filepath(n_URL, URL, 0);
12306 des_filepath(n_filename, filename, 1);
12307 des_char_ptr_ptr(n_contentType, contentType, 2);
12308 xmlResetLastError();
12309 if (mem_base != xmlMemBlocks()) {
12310 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012312 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012313 printf(" %d", n_URL);
12314 printf(" %d", n_filename);
12315 printf(" %d", n_contentType);
12316 printf("\n");
12317 }
12318 }
12319 }
12320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012321 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012322#endif
12323
Daniel Veillard42595322004-11-08 10:52:06 +000012324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012325}
12326
12327
12328static int
12329test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012331
12332#ifdef LIBXML_HTTP_ENABLED
12333 int mem_base;
12334
12335 mem_base = xmlMemBlocks();
12336
12337 xmlNanoHTTPInit();
12338 call_tests++;
12339 xmlResetLastError();
12340 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012341 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012343 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012344 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012346 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012347#endif
12348
Daniel Veillard42595322004-11-08 10:52:06 +000012349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012350}
12351
12352
12353static int
12354test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012356
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012357#ifdef LIBXML_HTTP_ENABLED
12358 int mem_base;
12359 void * ret_val;
12360 const char * URL; /* The URL to load */
12361 int n_URL;
12362 char * method; /* the HTTP method to use */
12363 int n_method;
12364 char * input; /* the input string if any */
12365 int n_input;
12366 char ** contentType; /* the Content-Type information IN and OUT */
12367 int n_contentType;
12368 char * headers; /* the extra headers */
12369 int n_headers;
12370 int ilen; /* input length */
12371 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012372
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012373 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12374 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12375 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12376 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12377 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12378 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12379 mem_base = xmlMemBlocks();
12380 URL = gen_filepath(n_URL, 0);
12381 method = gen_const_char_ptr(n_method, 1);
12382 input = gen_const_char_ptr(n_input, 2);
12383 contentType = gen_char_ptr_ptr(n_contentType, 3);
12384 headers = gen_const_char_ptr(n_headers, 4);
12385 ilen = gen_int(n_ilen, 5);
12386
William M. Brackf13f77f2004-11-12 16:03:48 +000012387 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012388 desret_void_ptr(ret_val);
12389 call_tests++;
12390 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012391 des_const_char_ptr(n_method, (const char *)method, 1);
12392 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012393 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012394 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012395 des_int(n_ilen, ilen, 5);
12396 xmlResetLastError();
12397 if (mem_base != xmlMemBlocks()) {
12398 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012400 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012401 printf(" %d", n_URL);
12402 printf(" %d", n_method);
12403 printf(" %d", n_input);
12404 printf(" %d", n_contentType);
12405 printf(" %d", n_headers);
12406 printf(" %d", n_ilen);
12407 printf("\n");
12408 }
12409 }
12410 }
12411 }
12412 }
12413 }
12414 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012415 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012416#endif
12417
Daniel Veillard42595322004-11-08 10:52:06 +000012418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012419}
12420
12421
12422static int
12423test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012425
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012426#ifdef LIBXML_HTTP_ENABLED
12427 int mem_base;
12428 void * ret_val;
12429 const char * URL; /* The URL to load */
12430 int n_URL;
12431 char * method; /* the HTTP method to use */
12432 int n_method;
12433 char * input; /* the input string if any */
12434 int n_input;
12435 char ** contentType; /* the Content-Type information IN and OUT */
12436 int n_contentType;
12437 char ** redir; /* the redirected URL OUT */
12438 int n_redir;
12439 char * headers; /* the extra headers */
12440 int n_headers;
12441 int ilen; /* input length */
12442 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012443
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012444 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12445 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12446 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12447 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12448 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12449 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12450 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12451 mem_base = xmlMemBlocks();
12452 URL = gen_filepath(n_URL, 0);
12453 method = gen_const_char_ptr(n_method, 1);
12454 input = gen_const_char_ptr(n_input, 2);
12455 contentType = gen_char_ptr_ptr(n_contentType, 3);
12456 redir = gen_char_ptr_ptr(n_redir, 4);
12457 headers = gen_const_char_ptr(n_headers, 5);
12458 ilen = gen_int(n_ilen, 6);
12459
William M. Brackf13f77f2004-11-12 16:03:48 +000012460 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012461 desret_void_ptr(ret_val);
12462 call_tests++;
12463 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012464 des_const_char_ptr(n_method, (const char *)method, 1);
12465 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012466 des_char_ptr_ptr(n_contentType, contentType, 3);
12467 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012468 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012469 des_int(n_ilen, ilen, 6);
12470 xmlResetLastError();
12471 if (mem_base != xmlMemBlocks()) {
12472 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012474 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012475 printf(" %d", n_URL);
12476 printf(" %d", n_method);
12477 printf(" %d", n_input);
12478 printf(" %d", n_contentType);
12479 printf(" %d", n_redir);
12480 printf(" %d", n_headers);
12481 printf(" %d", n_ilen);
12482 printf("\n");
12483 }
12484 }
12485 }
12486 }
12487 }
12488 }
12489 }
12490 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012491 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012492#endif
12493
Daniel Veillard42595322004-11-08 10:52:06 +000012494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012495}
12496
12497
12498static int
12499test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012501
Daniel Veillard27f20102004-11-05 11:50:11 +000012502#ifdef LIBXML_HTTP_ENABLED
12503 int mem_base;
12504 const char * ret_val;
12505 void * ctx; /* the HTTP context */
12506 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012507
Daniel Veillard27f20102004-11-05 11:50:11 +000012508 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12509 mem_base = xmlMemBlocks();
12510 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12511
12512 ret_val = xmlNanoHTTPMimeType(ctx);
12513 desret_const_char_ptr(ret_val);
12514 call_tests++;
12515 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12516 xmlResetLastError();
12517 if (mem_base != xmlMemBlocks()) {
12518 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012520 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012521 printf(" %d", n_ctx);
12522 printf("\n");
12523 }
12524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012525 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012526#endif
12527
Daniel Veillard42595322004-11-08 10:52:06 +000012528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012529}
12530
12531
12532static int
12533test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012535
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012536#ifdef LIBXML_HTTP_ENABLED
12537 int mem_base;
12538 void * ret_val;
12539 const char * URL; /* The URL to load */
12540 int n_URL;
12541 char ** contentType; /* if available the Content-Type information will be returned at that location */
12542 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012543
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012544 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12545 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12546 mem_base = xmlMemBlocks();
12547 URL = gen_filepath(n_URL, 0);
12548 contentType = gen_char_ptr_ptr(n_contentType, 1);
12549
12550 ret_val = xmlNanoHTTPOpen(URL, contentType);
12551 desret_void_ptr(ret_val);
12552 call_tests++;
12553 des_filepath(n_URL, URL, 0);
12554 des_char_ptr_ptr(n_contentType, contentType, 1);
12555 xmlResetLastError();
12556 if (mem_base != xmlMemBlocks()) {
12557 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012559 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012560 printf(" %d", n_URL);
12561 printf(" %d", n_contentType);
12562 printf("\n");
12563 }
12564 }
12565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012566 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012567#endif
12568
Daniel Veillard42595322004-11-08 10:52:06 +000012569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570}
12571
12572
12573static int
12574test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012576
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012577#ifdef LIBXML_HTTP_ENABLED
12578 int mem_base;
12579 void * ret_val;
12580 const char * URL; /* The URL to load */
12581 int n_URL;
12582 char ** contentType; /* if available the Content-Type information will be returned at that location */
12583 int n_contentType;
12584 char ** redir; /* if available the redirected URL will be returned */
12585 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012586
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012587 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12588 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12589 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12590 mem_base = xmlMemBlocks();
12591 URL = gen_filepath(n_URL, 0);
12592 contentType = gen_char_ptr_ptr(n_contentType, 1);
12593 redir = gen_char_ptr_ptr(n_redir, 2);
12594
12595 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12596 desret_void_ptr(ret_val);
12597 call_tests++;
12598 des_filepath(n_URL, URL, 0);
12599 des_char_ptr_ptr(n_contentType, contentType, 1);
12600 des_char_ptr_ptr(n_redir, redir, 2);
12601 xmlResetLastError();
12602 if (mem_base != xmlMemBlocks()) {
12603 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012605 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012606 printf(" %d", n_URL);
12607 printf(" %d", n_contentType);
12608 printf(" %d", n_redir);
12609 printf("\n");
12610 }
12611 }
12612 }
12613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012614 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012615#endif
12616
Daniel Veillard42595322004-11-08 10:52:06 +000012617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012618}
12619
12620
12621static int
12622test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012624
Daniel Veillard27f20102004-11-05 11:50:11 +000012625#ifdef LIBXML_HTTP_ENABLED
12626 int mem_base;
12627 int ret_val;
12628 void * ctx; /* the HTTP context */
12629 int n_ctx;
12630 void * dest; /* a buffer */
12631 int n_dest;
12632 int len; /* the buffer length */
12633 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012634
Daniel Veillard27f20102004-11-05 11:50:11 +000012635 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12636 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12637 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12638 mem_base = xmlMemBlocks();
12639 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12640 dest = gen_void_ptr(n_dest, 1);
12641 len = gen_int(n_len, 2);
12642
12643 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12644 desret_int(ret_val);
12645 call_tests++;
12646 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12647 des_void_ptr(n_dest, dest, 1);
12648 des_int(n_len, len, 2);
12649 xmlResetLastError();
12650 if (mem_base != xmlMemBlocks()) {
12651 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012653 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012654 printf(" %d", n_ctx);
12655 printf(" %d", n_dest);
12656 printf(" %d", n_len);
12657 printf("\n");
12658 }
12659 }
12660 }
12661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012662 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012663#endif
12664
Daniel Veillard42595322004-11-08 10:52:06 +000012665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012666}
12667
12668
12669static int
12670test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012672
12673
12674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012676}
12677
12678
12679static int
12680test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012682
Daniel Veillard27f20102004-11-05 11:50:11 +000012683#ifdef LIBXML_HTTP_ENABLED
12684 int mem_base;
12685 int ret_val;
12686 void * ctx; /* the HTTP context */
12687 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012688
Daniel Veillard27f20102004-11-05 11:50:11 +000012689 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12690 mem_base = xmlMemBlocks();
12691 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12692
12693 ret_val = xmlNanoHTTPReturnCode(ctx);
12694 desret_int(ret_val);
12695 call_tests++;
12696 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12697 xmlResetLastError();
12698 if (mem_base != xmlMemBlocks()) {
12699 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012701 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012702 printf(" %d", n_ctx);
12703 printf("\n");
12704 }
12705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012706 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012707#endif
12708
Daniel Veillard42595322004-11-08 10:52:06 +000012709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012710}
12711
12712
12713static int
12714test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012716
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012717#ifdef LIBXML_HTTP_ENABLED
12718#ifdef LIBXML_OUTPUT_ENABLED
12719 int mem_base;
12720 int ret_val;
12721 void * ctxt; /* the HTTP context */
12722 int n_ctxt;
12723 const char * filename; /* the filename where the content should be saved */
12724 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012725
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012726 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12727 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012729 ctxt = gen_void_ptr(n_ctxt, 0);
12730 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012731
12732 ret_val = xmlNanoHTTPSave(ctxt, filename);
12733 desret_int(ret_val);
12734 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012735 des_void_ptr(n_ctxt, ctxt, 0);
12736 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012737 xmlResetLastError();
12738 if (mem_base != xmlMemBlocks()) {
12739 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012741 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012742 printf(" %d", n_ctxt);
12743 printf(" %d", n_filename);
12744 printf("\n");
12745 }
12746 }
12747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012748 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012749#endif
12750#endif
12751
Daniel Veillard42595322004-11-08 10:52:06 +000012752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012753}
12754
12755
12756static int
12757test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012759
12760#ifdef LIBXML_HTTP_ENABLED
12761 const char * URL; /* The proxy URL used to initialize the proxy context */
12762 int n_URL;
12763
12764 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012765 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012766
12767 xmlNanoHTTPScanProxy(URL);
12768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012769 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012770 xmlResetLastError();
12771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012772 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012773#endif
12774
Daniel Veillard42595322004-11-08 10:52:06 +000012775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012776}
12777
12778static int
12779test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012781
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012782 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012783 test_ret += test_xmlNanoHTTPAuthHeader();
12784 test_ret += test_xmlNanoHTTPCleanup();
12785 test_ret += test_xmlNanoHTTPClose();
12786 test_ret += test_xmlNanoHTTPContentLength();
12787 test_ret += test_xmlNanoHTTPEncoding();
12788 test_ret += test_xmlNanoHTTPFetch();
12789 test_ret += test_xmlNanoHTTPInit();
12790 test_ret += test_xmlNanoHTTPMethod();
12791 test_ret += test_xmlNanoHTTPMethodRedir();
12792 test_ret += test_xmlNanoHTTPMimeType();
12793 test_ret += test_xmlNanoHTTPOpen();
12794 test_ret += test_xmlNanoHTTPOpenRedir();
12795 test_ret += test_xmlNanoHTTPRead();
12796 test_ret += test_xmlNanoHTTPRedir();
12797 test_ret += test_xmlNanoHTTPReturnCode();
12798 test_ret += test_xmlNanoHTTPSave();
12799 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012800
Daniel Veillard42595322004-11-08 10:52:06 +000012801 if (test_ret != 0)
12802 printf("Module nanohttp: %d errors\n", test_ret);
12803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012804}
12805
12806static int
12807test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012809
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012810 int mem_base;
12811 long ret_val;
12812 xmlParserCtxtPtr ctxt; /* an XML parser context */
12813 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012815 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12816 mem_base = xmlMemBlocks();
12817 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12818
12819 ret_val = xmlByteConsumed(ctxt);
12820 desret_long(ret_val);
12821 call_tests++;
12822 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12823 xmlResetLastError();
12824 if (mem_base != xmlMemBlocks()) {
12825 printf("Leak of %d blocks found in xmlByteConsumed",
12826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012827 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012828 printf(" %d", n_ctxt);
12829 printf("\n");
12830 }
12831 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012832 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012833
Daniel Veillard42595322004-11-08 10:52:06 +000012834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012835}
12836
12837
Daniel Veillardce682bc2004-11-05 17:22:25 +000012838#define gen_nb_xmlParserNodeInfoSeqPtr 1
12839static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12840 return(NULL);
12841}
12842static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12843}
12844
Daniel Veillardd93f6252004-11-02 15:53:51 +000012845static int
12846test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012848
Daniel Veillardce682bc2004-11-05 17:22:25 +000012849 int mem_base;
12850 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12851 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012852
Daniel Veillardce682bc2004-11-05 17:22:25 +000012853 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12854 mem_base = xmlMemBlocks();
12855 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12856
12857 xmlClearNodeInfoSeq(seq);
12858 call_tests++;
12859 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12860 xmlResetLastError();
12861 if (mem_base != xmlMemBlocks()) {
12862 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012864 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012865 printf(" %d", n_seq);
12866 printf("\n");
12867 }
12868 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012869 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012870
Daniel Veillard42595322004-11-08 10:52:06 +000012871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012872}
12873
12874
12875static int
12876test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012878
12879 int mem_base;
12880 xmlParserCtxtPtr ctxt; /* an XML parser context */
12881 int n_ctxt;
12882
12883 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012885 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012886
12887 xmlClearParserCtxt(ctxt);
12888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012889 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012890 xmlResetLastError();
12891 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012892 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012894 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012895 printf(" %d", n_ctxt);
12896 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012897 }
12898 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012899 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012900
Daniel Veillard42595322004-11-08 10:52:06 +000012901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012902}
12903
12904
12905static int
12906test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012908
Daniel Veillard34099b42004-11-04 17:34:35 +000012909 int mem_base;
12910 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012911 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012912 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012913
Daniel Veillard34099b42004-11-04 17:34:35 +000012914 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12915 mem_base = xmlMemBlocks();
12916 cur = gen_const_xmlChar_ptr(n_cur, 0);
12917
William M. Brackf13f77f2004-11-12 16:03:48 +000012918 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012919 desret_xmlParserCtxtPtr(ret_val);
12920 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012921 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012922 xmlResetLastError();
12923 if (mem_base != xmlMemBlocks()) {
12924 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012926 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012927 printf(" %d", n_cur);
12928 printf("\n");
12929 }
12930 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012932
Daniel Veillard42595322004-11-08 10:52:06 +000012933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012934}
12935
12936
12937static int
12938test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012940
Daniel Veillard34099b42004-11-04 17:34:35 +000012941#ifdef LIBXML_PUSH_ENABLED
12942 int mem_base;
12943 xmlParserCtxtPtr ret_val;
12944 xmlSAXHandlerPtr sax; /* a SAX handler */
12945 int n_sax;
12946 void * user_data; /* The user data returned on SAX callbacks */
12947 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012948 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012949 int n_chunk;
12950 int size; /* number of chars in the array */
12951 int n_size;
12952 const char * filename; /* an optional file name or URI */
12953 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012954
Daniel Veillard34099b42004-11-04 17:34:35 +000012955 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12956 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12957 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12958 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012959 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012960 mem_base = xmlMemBlocks();
12961 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12962 user_data = gen_userdata(n_user_data, 1);
12963 chunk = gen_const_char_ptr(n_chunk, 2);
12964 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012965 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012966
William M. Brackf13f77f2004-11-12 16:03:48 +000012967 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012968 desret_xmlParserCtxtPtr(ret_val);
12969 call_tests++;
12970 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12971 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012972 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012973 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012974 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012975 xmlResetLastError();
12976 if (mem_base != xmlMemBlocks()) {
12977 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012979 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012980 printf(" %d", n_sax);
12981 printf(" %d", n_user_data);
12982 printf(" %d", n_chunk);
12983 printf(" %d", n_size);
12984 printf(" %d", n_filename);
12985 printf("\n");
12986 }
12987 }
12988 }
12989 }
12990 }
12991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012992 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012993#endif
12994
Daniel Veillard42595322004-11-08 10:52:06 +000012995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012996}
12997
12998
12999static int
13000test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013002
13003 int mem_base;
13004 xmlDocPtr ret_val;
13005 xmlParserCtxtPtr ctxt; /* an XML parser context */
13006 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013007 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013008 int n_cur;
13009 const char * URL; /* the base URL to use for the document */
13010 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013011 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013012 int n_encoding;
13013 int options; /* a combination of xmlParserOption */
13014 int n_options;
13015
13016 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13017 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
13018 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13019 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013020 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013021 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013022 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13023 cur = gen_const_xmlChar_ptr(n_cur, 1);
13024 URL = gen_filepath(n_URL, 2);
13025 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000013026 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013027
William M. Brackf13f77f2004-11-12 16:03:48 +000013028 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013029 desret_xmlDocPtr(ret_val);
13030 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013031 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013032 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013033 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000013034 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000013035 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013036 xmlResetLastError();
13037 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013038 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013040 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013041 printf(" %d", n_ctxt);
13042 printf(" %d", n_cur);
13043 printf(" %d", n_URL);
13044 printf(" %d", n_encoding);
13045 printf(" %d", n_options);
13046 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013047 }
13048 }
13049 }
13050 }
13051 }
13052 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013054
Daniel Veillard42595322004-11-08 10:52:06 +000013055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013056}
13057
13058
13059static int
13060test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013062
13063 int mem_base;
13064 xmlDocPtr ret_val;
13065 xmlParserCtxtPtr ctxt; /* an XML parser context */
13066 int n_ctxt;
13067 const char * filename; /* a file or URL */
13068 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013069 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013070 int n_encoding;
13071 int options; /* a combination of xmlParserOption */
13072 int n_options;
13073
13074 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13075 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13076 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013077 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013078 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013079 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13080 filename = gen_filepath(n_filename, 1);
13081 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013082 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013083
William M. Brackf13f77f2004-11-12 16:03:48 +000013084 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013085 desret_xmlDocPtr(ret_val);
13086 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013087 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13088 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000013089 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013090 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013091 xmlResetLastError();
13092 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013093 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013095 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013096 printf(" %d", n_ctxt);
13097 printf(" %d", n_filename);
13098 printf(" %d", n_encoding);
13099 printf(" %d", n_options);
13100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013101 }
13102 }
13103 }
13104 }
13105 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013106 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013107
Daniel Veillard42595322004-11-08 10:52:06 +000013108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013109}
13110
13111
13112static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000013113test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013115
13116 int mem_base;
13117 xmlDocPtr ret_val;
13118 xmlParserCtxtPtr ctxt; /* an XML parser context */
13119 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013120 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013121 int n_buffer;
13122 int size; /* the size of the array */
13123 int n_size;
13124 const char * URL; /* the base URL to use for the document */
13125 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013126 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013127 int n_encoding;
13128 int options; /* a combination of xmlParserOption */
13129 int n_options;
13130
13131 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13132 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13133 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13134 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13135 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013136 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013137 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013138 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13139 buffer = gen_const_char_ptr(n_buffer, 1);
13140 size = gen_int(n_size, 2);
13141 URL = gen_filepath(n_URL, 3);
13142 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000013143 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013144
William M. Brackf13f77f2004-11-12 16:03:48 +000013145 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013146 desret_xmlDocPtr(ret_val);
13147 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013148 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013149 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013150 des_int(n_size, size, 2);
13151 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013152 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000013153 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013154 xmlResetLastError();
13155 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013156 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013158 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013159 printf(" %d", n_ctxt);
13160 printf(" %d", n_buffer);
13161 printf(" %d", n_size);
13162 printf(" %d", n_URL);
13163 printf(" %d", n_encoding);
13164 printf(" %d", n_options);
13165 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013166 }
13167 }
13168 }
13169 }
13170 }
13171 }
13172 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013173 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013174
Daniel Veillard42595322004-11-08 10:52:06 +000013175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013176}
13177
13178
13179static int
13180test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013182
13183 int mem_base;
13184 xmlParserCtxtPtr ctxt; /* an XML parser context */
13185 int n_ctxt;
13186
13187 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13188 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013189 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013190
13191 xmlCtxtReset(ctxt);
13192 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013193 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013194 xmlResetLastError();
13195 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013196 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013198 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013199 printf(" %d", n_ctxt);
13200 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013201 }
13202 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013203 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013204
Daniel Veillard42595322004-11-08 10:52:06 +000013205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013206}
13207
13208
13209static int
13210test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013212
13213 int mem_base;
13214 int ret_val;
13215 xmlParserCtxtPtr ctxt; /* an XML parser context */
13216 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013217 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013218 int n_chunk;
13219 int size; /* number of chars in the array */
13220 int n_size;
13221 const char * filename; /* an optional file name or URI */
13222 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013223 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013224 int n_encoding;
13225
13226 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13227 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13228 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13229 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13230 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
13231 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013232 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13233 chunk = gen_const_char_ptr(n_chunk, 1);
13234 size = gen_int(n_size, 2);
13235 filename = gen_filepath(n_filename, 3);
13236 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013237
William M. Brackf13f77f2004-11-12 16:03:48 +000013238 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013239 desret_int(ret_val);
13240 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013241 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013242 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013243 des_int(n_size, size, 2);
13244 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013245 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013246 xmlResetLastError();
13247 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013248 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013250 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013251 printf(" %d", n_ctxt);
13252 printf(" %d", n_chunk);
13253 printf(" %d", n_size);
13254 printf(" %d", n_filename);
13255 printf(" %d", n_encoding);
13256 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013257 }
13258 }
13259 }
13260 }
13261 }
13262 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013263 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013264
Daniel Veillard42595322004-11-08 10:52:06 +000013265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013266}
13267
13268
13269static int
13270test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013272
13273 int mem_base;
13274 int ret_val;
13275 xmlParserCtxtPtr ctxt; /* an XML parser context */
13276 int n_ctxt;
13277 int options; /* a combination of xmlParserOption */
13278 int n_options;
13279
13280 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013281 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013282 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013283 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013284 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013285
13286 ret_val = xmlCtxtUseOptions(ctxt, options);
13287 desret_int(ret_val);
13288 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013289 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013290 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013291 xmlResetLastError();
13292 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013293 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013295 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013296 printf(" %d", n_ctxt);
13297 printf(" %d", n_options);
13298 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013299 }
13300 }
13301 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013302 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013303
Daniel Veillard42595322004-11-08 10:52:06 +000013304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013305}
13306
13307
13308static int
13309test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013311
13312
13313 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000013314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013315}
13316
13317
13318static int
13319test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013321
Daniel Veillarda521d282004-11-09 14:59:59 +000013322#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013323 int mem_base;
13324 int ret_val;
13325 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
13326 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013327 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013328 int n_name;
13329 void * result; /* location to store the result */
13330 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013331
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013332 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13333 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13334 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13335 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013336 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13337 name = gen_const_char_ptr(n_name, 1);
13338 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013339
William M. Brackf13f77f2004-11-12 16:03:48 +000013340 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013341 desret_int(ret_val);
13342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013343 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013344 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013345 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013346 xmlResetLastError();
13347 if (mem_base != xmlMemBlocks()) {
13348 printf("Leak of %d blocks found in xmlGetFeature",
13349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013350 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013351 printf(" %d", n_ctxt);
13352 printf(" %d", n_name);
13353 printf(" %d", n_result);
13354 printf("\n");
13355 }
13356 }
13357 }
13358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013359 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013360#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013361
Daniel Veillard42595322004-11-08 10:52:06 +000013362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013363}
13364
13365
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013366#define gen_nb_const_char_ptr_ptr 1
13367static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13368 return(NULL);
13369}
13370static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13371}
13372
Daniel Veillardd93f6252004-11-02 15:53:51 +000013373static int
13374test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376
Daniel Veillarda521d282004-11-09 14:59:59 +000013377#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013378 int mem_base;
13379 int ret_val;
13380 int * len; /* the length of the features name array (input/output) */
13381 int n_len;
13382 char ** result; /* an array of string to be filled with the features name. */
13383 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013384
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013385 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13386 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13387 mem_base = xmlMemBlocks();
13388 len = gen_int_ptr(n_len, 0);
13389 result = gen_const_char_ptr_ptr(n_result, 1);
13390
William M. Brackf13f77f2004-11-12 16:03:48 +000013391 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013392 desret_int(ret_val);
13393 call_tests++;
13394 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013395 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013396 xmlResetLastError();
13397 if (mem_base != xmlMemBlocks()) {
13398 printf("Leak of %d blocks found in xmlGetFeaturesList",
13399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013400 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013401 printf(" %d", n_len);
13402 printf(" %d", n_result);
13403 printf("\n");
13404 }
13405 }
13406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013407 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013408#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013409
Daniel Veillard42595322004-11-08 10:52:06 +000013410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013411}
13412
13413
13414static int
13415test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013417
Daniel Veillarda521d282004-11-09 14:59:59 +000013418#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013419 int mem_base;
13420 xmlDtdPtr ret_val;
13421 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13422 int n_sax;
13423 xmlParserInputBufferPtr input; /* an Input Buffer */
13424 int n_input;
13425 xmlCharEncoding enc; /* the charset encoding if known */
13426 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013427
Daniel Veillard34099b42004-11-04 17:34:35 +000013428 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13429 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13430 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13431 mem_base = xmlMemBlocks();
13432 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13433 input = gen_xmlParserInputBufferPtr(n_input, 1);
13434 enc = gen_xmlCharEncoding(n_enc, 2);
13435
13436 ret_val = xmlIOParseDTD(sax, input, enc);
13437 input = NULL;
13438 desret_xmlDtdPtr(ret_val);
13439 call_tests++;
13440 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13441 des_xmlParserInputBufferPtr(n_input, input, 1);
13442 des_xmlCharEncoding(n_enc, enc, 2);
13443 xmlResetLastError();
13444 if (mem_base != xmlMemBlocks()) {
13445 printf("Leak of %d blocks found in xmlIOParseDTD",
13446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013447 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013448 printf(" %d", n_sax);
13449 printf(" %d", n_input);
13450 printf(" %d", n_enc);
13451 printf("\n");
13452 }
13453 }
13454 }
13455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013456 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013457#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013458
Daniel Veillard42595322004-11-08 10:52:06 +000013459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013460}
13461
13462
13463static int
13464test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013466
Daniel Veillardce682bc2004-11-05 17:22:25 +000013467 int mem_base;
13468 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13469 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013470
Daniel Veillardce682bc2004-11-05 17:22:25 +000013471 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13472 mem_base = xmlMemBlocks();
13473 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13474
13475 xmlInitNodeInfoSeq(seq);
13476 call_tests++;
13477 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13478 xmlResetLastError();
13479 if (mem_base != xmlMemBlocks()) {
13480 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013482 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013483 printf(" %d", n_seq);
13484 printf("\n");
13485 }
13486 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013488
Daniel Veillard42595322004-11-08 10:52:06 +000013489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013490}
13491
13492
13493static int
13494test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013496
13497 int mem_base;
13498
13499 mem_base = xmlMemBlocks();
13500
13501 xmlInitParser();
13502 call_tests++;
13503 xmlResetLastError();
13504 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013505 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013507 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013508 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013509 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013510 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013511
Daniel Veillard42595322004-11-08 10:52:06 +000013512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013513}
13514
13515
13516static int
13517test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013519
13520 int mem_base;
13521 int ret_val;
13522 xmlParserCtxtPtr ctxt; /* an XML parser context */
13523 int n_ctxt;
13524
13525 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13526 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013527 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013528
13529 ret_val = xmlInitParserCtxt(ctxt);
13530 desret_int(ret_val);
13531 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013532 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013533 xmlResetLastError();
13534 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013535 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013537 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013538 printf(" %d", n_ctxt);
13539 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013540 }
13541 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013542 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013543
Daniel Veillard42595322004-11-08 10:52:06 +000013544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013545}
13546
13547
13548static int
13549test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013551
13552 int mem_base;
13553 int ret_val;
13554 int val; /* int 0 or 1 */
13555 int n_val;
13556
13557 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13558 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013559 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013560
13561 ret_val = xmlKeepBlanksDefault(val);
13562 desret_int(ret_val);
13563 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013564 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013565 xmlResetLastError();
13566 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013567 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013569 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013570 printf(" %d", n_val);
13571 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013572 }
13573 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013574 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013575
Daniel Veillard42595322004-11-08 10:52:06 +000013576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013577}
13578
13579
13580static int
13581test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013583
13584 int mem_base;
13585 int ret_val;
13586 int val; /* int 0 or 1 */
13587 int n_val;
13588
13589 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013591 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013592
13593 ret_val = xmlLineNumbersDefault(val);
13594 desret_int(ret_val);
13595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013596 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013597 xmlResetLastError();
13598 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013599 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013601 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013602 printf(" %d", n_val);
13603 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013604 }
13605 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013606 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013607
Daniel Veillard42595322004-11-08 10:52:06 +000013608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013609}
13610
13611
13612static int
13613test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013615
Daniel Veillard42595322004-11-08 10:52:06 +000013616 int mem_base;
13617 xmlParserInputPtr ret_val;
13618 const char * URL; /* the URL for the entity to load */
13619 int n_URL;
13620 char * ID; /* the Public ID for the entity to load */
13621 int n_ID;
13622 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13623 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013624
Daniel Veillard42595322004-11-08 10:52:06 +000013625 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13626 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13627 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13628 mem_base = xmlMemBlocks();
13629 URL = gen_filepath(n_URL, 0);
13630 ID = gen_const_char_ptr(n_ID, 1);
13631 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13632
William M. Brackf13f77f2004-11-12 16:03:48 +000013633 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013634 desret_xmlParserInputPtr(ret_val);
13635 call_tests++;
13636 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013637 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013638 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13639 xmlResetLastError();
13640 if (mem_base != xmlMemBlocks()) {
13641 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13642 xmlMemBlocks() - mem_base);
13643 test_ret++;
13644 printf(" %d", n_URL);
13645 printf(" %d", n_ID);
13646 printf(" %d", n_ctxt);
13647 printf("\n");
13648 }
13649 }
13650 }
13651 }
Daniel Veillard42595322004-11-08 10:52:06 +000013652 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013653
Daniel Veillard42595322004-11-08 10:52:06 +000013654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013655}
13656
13657
13658static int
13659test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013661
Daniel Veillard42595322004-11-08 10:52:06 +000013662 int mem_base;
13663 xmlParserInputPtr ret_val;
13664 xmlParserCtxtPtr ctxt; /* an XML parser context */
13665 int n_ctxt;
13666 xmlParserInputBufferPtr input; /* an I/O Input */
13667 int n_input;
13668 xmlCharEncoding enc; /* the charset encoding if known */
13669 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013670
Daniel Veillard42595322004-11-08 10:52:06 +000013671 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13672 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13673 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13674 mem_base = xmlMemBlocks();
13675 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13676 input = gen_xmlParserInputBufferPtr(n_input, 1);
13677 enc = gen_xmlCharEncoding(n_enc, 2);
13678
13679 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13680 if (ret_val != NULL) input = NULL;
13681 desret_xmlParserInputPtr(ret_val);
13682 call_tests++;
13683 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13684 des_xmlParserInputBufferPtr(n_input, input, 1);
13685 des_xmlCharEncoding(n_enc, enc, 2);
13686 xmlResetLastError();
13687 if (mem_base != xmlMemBlocks()) {
13688 printf("Leak of %d blocks found in xmlNewIOInputStream",
13689 xmlMemBlocks() - mem_base);
13690 test_ret++;
13691 printf(" %d", n_ctxt);
13692 printf(" %d", n_input);
13693 printf(" %d", n_enc);
13694 printf("\n");
13695 }
13696 }
13697 }
13698 }
Daniel Veillard42595322004-11-08 10:52:06 +000013699 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013700
Daniel Veillard42595322004-11-08 10:52:06 +000013701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013702}
13703
13704
13705static int
13706test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013708
Daniel Veillard34099b42004-11-04 17:34:35 +000013709 int mem_base;
13710 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013711
Daniel Veillard34099b42004-11-04 17:34:35 +000013712 mem_base = xmlMemBlocks();
13713
13714 ret_val = xmlNewParserCtxt();
13715 desret_xmlParserCtxtPtr(ret_val);
13716 call_tests++;
13717 xmlResetLastError();
13718 if (mem_base != xmlMemBlocks()) {
13719 printf("Leak of %d blocks found in xmlNewParserCtxt",
13720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013721 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013722 printf("\n");
13723 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013725
Daniel Veillard42595322004-11-08 10:52:06 +000013726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013727}
13728
13729
Daniel Veillardce682bc2004-11-05 17:22:25 +000013730#define gen_nb_xmlNodePtr_ptr 1
13731static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13732 return(NULL);
13733}
13734static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13735}
13736
Daniel Veillardd93f6252004-11-02 15:53:51 +000013737static int
13738test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013740
Daniel Veillarda521d282004-11-09 14:59:59 +000013741#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013742 int mem_base;
13743 int ret_val;
13744 xmlDocPtr doc; /* the document the chunk pertains to */
13745 int n_doc;
13746 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13747 int n_sax;
13748 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13749 int n_user_data;
13750 int depth; /* Used for loop detection, use 0 */
13751 int n_depth;
13752 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13753 int n_string;
13754 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13755 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013756
Daniel Veillardce682bc2004-11-05 17:22:25 +000013757 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13758 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13759 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13760 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13761 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13762 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13763 mem_base = xmlMemBlocks();
13764 doc = gen_xmlDocPtr(n_doc, 0);
13765 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13766 user_data = gen_userdata(n_user_data, 2);
13767 depth = gen_int(n_depth, 3);
13768 string = gen_const_xmlChar_ptr(n_string, 4);
13769 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013770
13771#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013772 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013773#endif
13774
Daniel Veillardce682bc2004-11-05 17:22:25 +000013775
William M. Brackf13f77f2004-11-12 16:03:48 +000013776 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013777 desret_int(ret_val);
13778 call_tests++;
13779 des_xmlDocPtr(n_doc, doc, 0);
13780 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13781 des_userdata(n_user_data, user_data, 2);
13782 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013783 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013784 des_xmlNodePtr_ptr(n_lst, lst, 5);
13785 xmlResetLastError();
13786 if (mem_base != xmlMemBlocks()) {
13787 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013789 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013790 printf(" %d", n_doc);
13791 printf(" %d", n_sax);
13792 printf(" %d", n_user_data);
13793 printf(" %d", n_depth);
13794 printf(" %d", n_string);
13795 printf(" %d", n_lst);
13796 printf("\n");
13797 }
13798 }
13799 }
13800 }
13801 }
13802 }
13803 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013804 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013805#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013806
Daniel Veillard42595322004-11-08 10:52:06 +000013807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013808}
13809
13810
13811static int
13812test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013813 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013814
Daniel Veillarda521d282004-11-09 14:59:59 +000013815#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013816 int mem_base;
13817 int ret_val;
13818 xmlDocPtr doc; /* the document the chunk pertains to */
13819 int n_doc;
13820 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13821 int n_sax;
13822 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13823 int n_user_data;
13824 int depth; /* Used for loop detection, use 0 */
13825 int n_depth;
13826 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13827 int n_string;
13828 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13829 int n_lst;
13830 int recover; /* return nodes even if the data is broken (use 0) */
13831 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013832
Daniel Veillardce682bc2004-11-05 17:22:25 +000013833 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13834 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13835 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13836 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13837 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13838 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13839 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13840 mem_base = xmlMemBlocks();
13841 doc = gen_xmlDocPtr(n_doc, 0);
13842 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13843 user_data = gen_userdata(n_user_data, 2);
13844 depth = gen_int(n_depth, 3);
13845 string = gen_const_xmlChar_ptr(n_string, 4);
13846 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13847 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013848
13849#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013850 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013851#endif
13852
Daniel Veillardce682bc2004-11-05 17:22:25 +000013853
William M. Brackf13f77f2004-11-12 16:03:48 +000013854 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013855 desret_int(ret_val);
13856 call_tests++;
13857 des_xmlDocPtr(n_doc, doc, 0);
13858 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13859 des_userdata(n_user_data, user_data, 2);
13860 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013861 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013862 des_xmlNodePtr_ptr(n_lst, lst, 5);
13863 des_int(n_recover, recover, 6);
13864 xmlResetLastError();
13865 if (mem_base != xmlMemBlocks()) {
13866 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013868 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013869 printf(" %d", n_doc);
13870 printf(" %d", n_sax);
13871 printf(" %d", n_user_data);
13872 printf(" %d", n_depth);
13873 printf(" %d", n_string);
13874 printf(" %d", n_lst);
13875 printf(" %d", n_recover);
13876 printf("\n");
13877 }
13878 }
13879 }
13880 }
13881 }
13882 }
13883 }
13884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013885 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013886#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013887
Daniel Veillard42595322004-11-08 10:52:06 +000013888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013889}
13890
13891
13892static int
13893test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013895
13896#ifdef LIBXML_PUSH_ENABLED
13897 int mem_base;
13898 int ret_val;
13899 xmlParserCtxtPtr ctxt; /* an XML parser context */
13900 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013901 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013902 int n_chunk;
13903 int size; /* the size in byte of the chunk */
13904 int n_size;
13905 int terminate; /* last chunk indicator */
13906 int n_terminate;
13907
13908 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13909 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13910 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13911 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013913 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13914 chunk = gen_const_char_ptr(n_chunk, 1);
13915 size = gen_int(n_size, 2);
13916 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013917
William M. Brackf13f77f2004-11-12 16:03:48 +000013918 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013919 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013920 desret_int(ret_val);
13921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013922 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013923 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013924 des_int(n_size, size, 2);
13925 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013926 xmlResetLastError();
13927 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013928 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013930 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013931 printf(" %d", n_ctxt);
13932 printf(" %d", n_chunk);
13933 printf(" %d", n_size);
13934 printf(" %d", n_terminate);
13935 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013936 }
13937 }
13938 }
13939 }
13940 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013941 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013942#endif
13943
Daniel Veillard42595322004-11-08 10:52:06 +000013944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013945}
13946
13947
13948static int
13949test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013951
Daniel Veillardce682bc2004-11-05 17:22:25 +000013952 int mem_base;
13953 int ret_val;
13954 xmlParserCtxtPtr ctx; /* the existing parsing context */
13955 int n_ctx;
13956 xmlChar * URL; /* the URL for the entity to load */
13957 int n_URL;
13958 xmlChar * ID; /* the System ID for the entity to load */
13959 int n_ID;
13960 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13961 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013962
Daniel Veillardce682bc2004-11-05 17:22:25 +000013963 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13964 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13965 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13966 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13967 mem_base = xmlMemBlocks();
13968 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13969 URL = gen_const_xmlChar_ptr(n_URL, 1);
13970 ID = gen_const_xmlChar_ptr(n_ID, 2);
13971 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13972
William M. Brackf13f77f2004-11-12 16:03:48 +000013973 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013974 desret_int(ret_val);
13975 call_tests++;
13976 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013977 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13978 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013979 des_xmlNodePtr_ptr(n_lst, lst, 3);
13980 xmlResetLastError();
13981 if (mem_base != xmlMemBlocks()) {
13982 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013984 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013985 printf(" %d", n_ctx);
13986 printf(" %d", n_URL);
13987 printf(" %d", n_ID);
13988 printf(" %d", n_lst);
13989 printf("\n");
13990 }
13991 }
13992 }
13993 }
13994 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013996
Daniel Veillard42595322004-11-08 10:52:06 +000013997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013998}
13999
14000
14001static int
14002test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014004
Daniel Veillarda521d282004-11-09 14:59:59 +000014005#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014006 int mem_base;
14007 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014008 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014009 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014010 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014011 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014012
Daniel Veillard34099b42004-11-04 17:34:35 +000014013 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14014 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14015 mem_base = xmlMemBlocks();
14016 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
14017 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
14018
William M. Brackf13f77f2004-11-12 16:03:48 +000014019 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014020 desret_xmlDtdPtr(ret_val);
14021 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014022 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
14023 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014024 xmlResetLastError();
14025 if (mem_base != xmlMemBlocks()) {
14026 printf("Leak of %d blocks found in xmlParseDTD",
14027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014028 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014029 printf(" %d", n_ExternalID);
14030 printf(" %d", n_SystemID);
14031 printf("\n");
14032 }
14033 }
14034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014035 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014036#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014037
Daniel Veillard42595322004-11-08 10:52:06 +000014038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039}
14040
14041
14042static int
14043test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014045
Daniel Veillarda521d282004-11-09 14:59:59 +000014046#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014047 int mem_base;
14048 xmlDocPtr ret_val;
14049 xmlChar * cur; /* a pointer to an array of xmlChar */
14050 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014051
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014052 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014054 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014055
14056 ret_val = xmlParseDoc(cur);
14057 desret_xmlDocPtr(ret_val);
14058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014059 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014060 xmlResetLastError();
14061 if (mem_base != xmlMemBlocks()) {
14062 printf("Leak of %d blocks found in xmlParseDoc",
14063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014064 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014065 printf(" %d", n_cur);
14066 printf("\n");
14067 }
14068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014069 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014070#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014071
Daniel Veillard42595322004-11-08 10:52:06 +000014072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014073}
14074
14075
14076static int
14077test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014079
14080 int mem_base;
14081 int ret_val;
14082 xmlParserCtxtPtr ctxt; /* an XML parser context */
14083 int n_ctxt;
14084
14085 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014087 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014088
14089 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000014090 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000014091 desret_int(ret_val);
14092 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014093 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014094 xmlResetLastError();
14095 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014096 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014098 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014099 printf(" %d", n_ctxt);
14100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014101 }
14102 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014103 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014104
Daniel Veillard42595322004-11-08 10:52:06 +000014105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014106}
14107
14108
14109static int
14110test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014112
Daniel Veillarda521d282004-11-09 14:59:59 +000014113#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014114 int mem_base;
14115 xmlDocPtr ret_val;
14116 const char * filename; /* the filename */
14117 int n_filename;
14118
14119 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14120 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014121 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014122
14123 ret_val = xmlParseEntity(filename);
14124 desret_xmlDocPtr(ret_val);
14125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014126 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014127 xmlResetLastError();
14128 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014129 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014131 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014132 printf(" %d", n_filename);
14133 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014134 }
14135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014136 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014137#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014138
Daniel Veillard42595322004-11-08 10:52:06 +000014139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014140}
14141
14142
14143static int
14144test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014146
14147 int mem_base;
14148 int ret_val;
14149 xmlParserCtxtPtr ctxt; /* an XML parser context */
14150 int n_ctxt;
14151
14152 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014154 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014155
14156 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000014157 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000014158 desret_int(ret_val);
14159 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014160 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014161 xmlResetLastError();
14162 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014163 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014165 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014166 printf(" %d", n_ctxt);
14167 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014168 }
14169 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014171
Daniel Veillard42595322004-11-08 10:52:06 +000014172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014173}
14174
14175
14176static int
14177test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014179
Daniel Veillarda521d282004-11-09 14:59:59 +000014180#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000014181 int mem_base;
14182 int ret_val;
14183 xmlDocPtr doc; /* the document the chunk pertains to */
14184 int n_doc;
14185 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
14186 int n_sax;
14187 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
14188 int n_user_data;
14189 int depth; /* Used for loop detection, use 0 */
14190 int n_depth;
14191 xmlChar * URL; /* the URL for the entity to load */
14192 int n_URL;
14193 xmlChar * ID; /* the System ID for the entity to load */
14194 int n_ID;
14195 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14196 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014197
Daniel Veillardce682bc2004-11-05 17:22:25 +000014198 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14199 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14200 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14201 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
14202 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
14203 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
14204 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14205 mem_base = xmlMemBlocks();
14206 doc = gen_xmlDocPtr(n_doc, 0);
14207 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
14208 user_data = gen_userdata(n_user_data, 2);
14209 depth = gen_int(n_depth, 3);
14210 URL = gen_const_xmlChar_ptr(n_URL, 4);
14211 ID = gen_const_xmlChar_ptr(n_ID, 5);
14212 lst = gen_xmlNodePtr_ptr(n_lst, 6);
14213
William M. Brackf13f77f2004-11-12 16:03:48 +000014214 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014215 desret_int(ret_val);
14216 call_tests++;
14217 des_xmlDocPtr(n_doc, doc, 0);
14218 des_xmlSAXHandlerPtr(n_sax, sax, 1);
14219 des_userdata(n_user_data, user_data, 2);
14220 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000014221 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
14222 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014223 des_xmlNodePtr_ptr(n_lst, lst, 6);
14224 xmlResetLastError();
14225 if (mem_base != xmlMemBlocks()) {
14226 printf("Leak of %d blocks found in xmlParseExternalEntity",
14227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014228 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014229 printf(" %d", n_doc);
14230 printf(" %d", n_sax);
14231 printf(" %d", n_user_data);
14232 printf(" %d", n_depth);
14233 printf(" %d", n_URL);
14234 printf(" %d", n_ID);
14235 printf(" %d", n_lst);
14236 printf("\n");
14237 }
14238 }
14239 }
14240 }
14241 }
14242 }
14243 }
14244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014245 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014246#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000014247
Daniel Veillard42595322004-11-08 10:52:06 +000014248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014249}
14250
14251
14252static int
14253test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014255
Daniel Veillarda521d282004-11-09 14:59:59 +000014256#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014257 int mem_base;
14258 xmlDocPtr ret_val;
14259 const char * filename; /* the filename */
14260 int n_filename;
14261
14262 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14263 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014264 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014265
14266 ret_val = xmlParseFile(filename);
14267 desret_xmlDocPtr(ret_val);
14268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014269 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014270 xmlResetLastError();
14271 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014272 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014274 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014275 printf(" %d", n_filename);
14276 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014277 }
14278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014279 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014280#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014281
Daniel Veillard42595322004-11-08 10:52:06 +000014282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014283}
14284
14285
14286static int
14287test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014289
Daniel Veillard57b25162004-11-06 14:50:18 +000014290 int mem_base;
14291 xmlParserErrors ret_val;
14292 xmlNodePtr node; /* the context node */
14293 int n_node;
14294 char * data; /* the input string */
14295 int n_data;
14296 int datalen; /* the input string length in bytes */
14297 int n_datalen;
14298 int options; /* a combination of xmlParserOption */
14299 int n_options;
14300 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14301 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014302
Daniel Veillard57b25162004-11-06 14:50:18 +000014303 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14304 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
14305 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014306 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000014307 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14308 mem_base = xmlMemBlocks();
14309 node = gen_xmlNodePtr(n_node, 0);
14310 data = gen_const_char_ptr(n_data, 1);
14311 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014312 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014313 lst = gen_xmlNodePtr_ptr(n_lst, 4);
14314
William M. Brackf13f77f2004-11-12 16:03:48 +000014315 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000014316 desret_xmlParserErrors(ret_val);
14317 call_tests++;
14318 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014319 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000014320 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014321 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014322 des_xmlNodePtr_ptr(n_lst, lst, 4);
14323 xmlResetLastError();
14324 if (mem_base != xmlMemBlocks()) {
14325 printf("Leak of %d blocks found in xmlParseInNodeContext",
14326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014327 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014328 printf(" %d", n_node);
14329 printf(" %d", n_data);
14330 printf(" %d", n_datalen);
14331 printf(" %d", n_options);
14332 printf(" %d", n_lst);
14333 printf("\n");
14334 }
14335 }
14336 }
14337 }
14338 }
14339 }
Daniel Veillard57b25162004-11-06 14:50:18 +000014340 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014341
Daniel Veillard42595322004-11-08 10:52:06 +000014342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014343}
14344
14345
14346static int
14347test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014349
Daniel Veillarda521d282004-11-09 14:59:59 +000014350#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014351 int mem_base;
14352 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014353 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014354 int n_buffer;
14355 int size; /* the size of the array */
14356 int n_size;
14357
14358 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14359 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014361 buffer = gen_const_char_ptr(n_buffer, 0);
14362 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014363
William M. Brackf13f77f2004-11-12 16:03:48 +000014364 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014365 desret_xmlDocPtr(ret_val);
14366 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014367 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014368 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014369 xmlResetLastError();
14370 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014371 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014373 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014374 printf(" %d", n_buffer);
14375 printf(" %d", n_size);
14376 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014377 }
14378 }
14379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014380 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014381#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014382
Daniel Veillard42595322004-11-08 10:52:06 +000014383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014384}
14385
14386
Daniel Veillardce682bc2004-11-05 17:22:25 +000014387#define gen_nb_const_xmlParserNodeInfoPtr 1
14388static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14389 return(NULL);
14390}
14391static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14392}
14393
Daniel Veillardd93f6252004-11-02 15:53:51 +000014394static int
14395test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014397
Daniel Veillardce682bc2004-11-05 17:22:25 +000014398 int mem_base;
14399 xmlParserCtxtPtr ctxt; /* an XML parser context */
14400 int n_ctxt;
14401 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14402 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014403
Daniel Veillardce682bc2004-11-05 17:22:25 +000014404 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14405 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14406 mem_base = xmlMemBlocks();
14407 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14408 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14409
William M. Brackf13f77f2004-11-12 16:03:48 +000014410 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014411 call_tests++;
14412 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014413 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014414 xmlResetLastError();
14415 if (mem_base != xmlMemBlocks()) {
14416 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014418 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014419 printf(" %d", n_ctxt);
14420 printf(" %d", n_info);
14421 printf("\n");
14422 }
14423 }
14424 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014425 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014426
Daniel Veillard42595322004-11-08 10:52:06 +000014427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014428}
14429
14430
Daniel Veillardce682bc2004-11-05 17:22:25 +000014431#define gen_nb_const_xmlParserCtxtPtr 1
14432static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14433 return(NULL);
14434}
14435static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14436}
14437
Daniel Veillarda521d282004-11-09 14:59:59 +000014438#define gen_nb_const_xmlNodePtr 1
14439static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14440 return(NULL);
14441}
14442static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14443}
14444
Daniel Veillardd93f6252004-11-02 15:53:51 +000014445static int
14446test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014448
14449
14450 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014452}
14453
14454
Daniel Veillardce682bc2004-11-05 17:22:25 +000014455#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14456static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14457 return(NULL);
14458}
14459static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14460}
14461
Daniel Veillardd93f6252004-11-02 15:53:51 +000014462static int
14463test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014465
14466
14467 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014469}
14470
14471
Daniel Veillardce682bc2004-11-05 17:22:25 +000014472#define gen_nb_xmlParserInputPtr 1
14473static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14474 return(NULL);
14475}
14476static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14477}
14478
Daniel Veillardd93f6252004-11-02 15:53:51 +000014479static int
14480test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014482
Daniel Veillardce682bc2004-11-05 17:22:25 +000014483 int mem_base;
14484 int ret_val;
14485 xmlParserInputPtr in; /* an XML parser input */
14486 int n_in;
14487 int len; /* an indicative size for the lookahead */
14488 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014489
Daniel Veillardce682bc2004-11-05 17:22:25 +000014490 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14491 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14492 mem_base = xmlMemBlocks();
14493 in = gen_xmlParserInputPtr(n_in, 0);
14494 len = gen_int(n_len, 1);
14495
14496 ret_val = xmlParserInputGrow(in, len);
14497 desret_int(ret_val);
14498 call_tests++;
14499 des_xmlParserInputPtr(n_in, in, 0);
14500 des_int(n_len, len, 1);
14501 xmlResetLastError();
14502 if (mem_base != xmlMemBlocks()) {
14503 printf("Leak of %d blocks found in xmlParserInputGrow",
14504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014505 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014506 printf(" %d", n_in);
14507 printf(" %d", n_len);
14508 printf("\n");
14509 }
14510 }
14511 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014513
Daniel Veillard42595322004-11-08 10:52:06 +000014514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014515}
14516
14517
14518static int
14519test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014521
Daniel Veillardce682bc2004-11-05 17:22:25 +000014522 int mem_base;
14523 int ret_val;
14524 xmlParserInputPtr in; /* an XML parser input */
14525 int n_in;
14526 int len; /* an indicative size for the lookahead */
14527 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014528
Daniel Veillardce682bc2004-11-05 17:22:25 +000014529 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14530 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14531 mem_base = xmlMemBlocks();
14532 in = gen_xmlParserInputPtr(n_in, 0);
14533 len = gen_int(n_len, 1);
14534
14535 ret_val = xmlParserInputRead(in, len);
14536 desret_int(ret_val);
14537 call_tests++;
14538 des_xmlParserInputPtr(n_in, in, 0);
14539 des_int(n_len, len, 1);
14540 xmlResetLastError();
14541 if (mem_base != xmlMemBlocks()) {
14542 printf("Leak of %d blocks found in xmlParserInputRead",
14543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014544 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014545 printf(" %d", n_in);
14546 printf(" %d", n_len);
14547 printf("\n");
14548 }
14549 }
14550 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014551 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014552
Daniel Veillard42595322004-11-08 10:52:06 +000014553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014554}
14555
14556
14557static int
14558test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014560
14561 int mem_base;
14562 int ret_val;
14563 int val; /* int 0 or 1 */
14564 int n_val;
14565
14566 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14567 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014568 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014569
14570 ret_val = xmlPedanticParserDefault(val);
14571 desret_int(ret_val);
14572 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014573 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014574 xmlResetLastError();
14575 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014576 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014578 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014579 printf(" %d", n_val);
14580 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014581 }
14582 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014584
Daniel Veillard42595322004-11-08 10:52:06 +000014585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014586}
14587
14588
14589static int
14590test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014592
14593 int mem_base;
14594 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014595 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014596 int n_cur;
14597 const char * URL; /* the base URL to use for the document */
14598 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014599 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014600 int n_encoding;
14601 int options; /* a combination of xmlParserOption */
14602 int n_options;
14603
14604 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14605 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14606 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014607 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014608 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014609 cur = gen_const_xmlChar_ptr(n_cur, 0);
14610 URL = gen_filepath(n_URL, 1);
14611 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014612 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014613
William M. Brackf13f77f2004-11-12 16:03:48 +000014614 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014615 desret_xmlDocPtr(ret_val);
14616 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014617 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014618 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014619 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014620 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014621 xmlResetLastError();
14622 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014623 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014625 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014626 printf(" %d", n_cur);
14627 printf(" %d", n_URL);
14628 printf(" %d", n_encoding);
14629 printf(" %d", n_options);
14630 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014631 }
14632 }
14633 }
14634 }
14635 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014637
Daniel Veillard42595322004-11-08 10:52:06 +000014638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014639}
14640
14641
14642static int
14643test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014645
14646 int mem_base;
14647 xmlDocPtr ret_val;
14648 const char * filename; /* a file or URL */
14649 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014650 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014651 int n_encoding;
14652 int options; /* a combination of xmlParserOption */
14653 int n_options;
14654
14655 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14656 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014657 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014659 filename = gen_filepath(n_filename, 0);
14660 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014661 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014662
William M. Brackf13f77f2004-11-12 16:03:48 +000014663 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014664 desret_xmlDocPtr(ret_val);
14665 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014666 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014667 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014668 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014669 xmlResetLastError();
14670 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014671 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014673 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014674 printf(" %d", n_filename);
14675 printf(" %d", n_encoding);
14676 printf(" %d", n_options);
14677 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014678 }
14679 }
14680 }
14681 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014683
Daniel Veillard42595322004-11-08 10:52:06 +000014684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014685}
14686
14687
14688static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014689test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014691
14692 int mem_base;
14693 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014694 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014695 int n_buffer;
14696 int size; /* the size of the array */
14697 int n_size;
14698 const char * URL; /* the base URL to use for the document */
14699 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014700 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014701 int n_encoding;
14702 int options; /* a combination of xmlParserOption */
14703 int n_options;
14704
14705 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14706 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14707 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14708 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014709 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014710 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014711 buffer = gen_const_char_ptr(n_buffer, 0);
14712 size = gen_int(n_size, 1);
14713 URL = gen_filepath(n_URL, 2);
14714 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014715 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014716
William M. Brackf13f77f2004-11-12 16:03:48 +000014717 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014718 desret_xmlDocPtr(ret_val);
14719 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014720 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014721 des_int(n_size, size, 1);
14722 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014723 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014724 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014725 xmlResetLastError();
14726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014727 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014730 printf(" %d", n_buffer);
14731 printf(" %d", n_size);
14732 printf(" %d", n_URL);
14733 printf(" %d", n_encoding);
14734 printf(" %d", n_options);
14735 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014736 }
14737 }
14738 }
14739 }
14740 }
14741 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014743
Daniel Veillard42595322004-11-08 10:52:06 +000014744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014745}
14746
14747
14748static int
14749test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014751
Daniel Veillarda521d282004-11-09 14:59:59 +000014752#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014753 int mem_base;
14754 xmlDocPtr ret_val;
14755 xmlChar * cur; /* a pointer to an array of xmlChar */
14756 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014757
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014758 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014760 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014761
14762 ret_val = xmlRecoverDoc(cur);
14763 desret_xmlDocPtr(ret_val);
14764 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014765 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014766 xmlResetLastError();
14767 if (mem_base != xmlMemBlocks()) {
14768 printf("Leak of %d blocks found in xmlRecoverDoc",
14769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014770 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014771 printf(" %d", n_cur);
14772 printf("\n");
14773 }
14774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014775 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014776#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014777
Daniel Veillard42595322004-11-08 10:52:06 +000014778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014779}
14780
14781
14782static int
14783test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014785
Daniel Veillarda521d282004-11-09 14:59:59 +000014786#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014787 int mem_base;
14788 xmlDocPtr ret_val;
14789 const char * filename; /* the filename */
14790 int n_filename;
14791
14792 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014794 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014795
14796 ret_val = xmlRecoverFile(filename);
14797 desret_xmlDocPtr(ret_val);
14798 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014799 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014800 xmlResetLastError();
14801 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014802 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014804 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014805 printf(" %d", n_filename);
14806 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014807 }
14808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014809 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014810#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014811
Daniel Veillard42595322004-11-08 10:52:06 +000014812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014813}
14814
14815
14816static int
14817test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014819
Daniel Veillarda521d282004-11-09 14:59:59 +000014820#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014821 int mem_base;
14822 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014823 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014824 int n_buffer;
14825 int size; /* the size of the array */
14826 int n_size;
14827
14828 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14829 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014831 buffer = gen_const_char_ptr(n_buffer, 0);
14832 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014833
William M. Brackf13f77f2004-11-12 16:03:48 +000014834 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014835 desret_xmlDocPtr(ret_val);
14836 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014837 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014838 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014839 xmlResetLastError();
14840 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014841 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014843 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014844 printf(" %d", n_buffer);
14845 printf(" %d", n_size);
14846 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014847 }
14848 }
14849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014850 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014851#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014852
Daniel Veillard42595322004-11-08 10:52:06 +000014853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014854}
14855
14856
14857static int
14858test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014860
Daniel Veillarda521d282004-11-09 14:59:59 +000014861#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014862 int mem_base;
14863 xmlDtdPtr ret_val;
14864 xmlSAXHandlerPtr sax; /* the SAX handler block */
14865 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014866 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014867 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014868 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014869 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014870
Daniel Veillard34099b42004-11-04 17:34:35 +000014871 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14872 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14873 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14874 mem_base = xmlMemBlocks();
14875 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14876 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14877 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14878
William M. Brackf13f77f2004-11-12 16:03:48 +000014879 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014880 desret_xmlDtdPtr(ret_val);
14881 call_tests++;
14882 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014883 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14884 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014885 xmlResetLastError();
14886 if (mem_base != xmlMemBlocks()) {
14887 printf("Leak of %d blocks found in xmlSAXParseDTD",
14888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014889 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014890 printf(" %d", n_sax);
14891 printf(" %d", n_ExternalID);
14892 printf(" %d", n_SystemID);
14893 printf("\n");
14894 }
14895 }
14896 }
14897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014898 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014899#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014900
Daniel Veillard42595322004-11-08 10:52:06 +000014901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014902}
14903
14904
14905static int
14906test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014908
Daniel Veillarda521d282004-11-09 14:59:59 +000014909#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014910 int mem_base;
14911 xmlDocPtr ret_val;
14912 xmlSAXHandlerPtr sax; /* the SAX handler block */
14913 int n_sax;
14914 xmlChar * cur; /* a pointer to an array of xmlChar */
14915 int n_cur;
14916 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14917 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014918
Daniel Veillard34099b42004-11-04 17:34:35 +000014919 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14920 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14921 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14922 mem_base = xmlMemBlocks();
14923 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14924 cur = gen_xmlChar_ptr(n_cur, 1);
14925 recovery = gen_int(n_recovery, 2);
14926
14927 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14928 desret_xmlDocPtr(ret_val);
14929 call_tests++;
14930 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14931 des_xmlChar_ptr(n_cur, cur, 1);
14932 des_int(n_recovery, recovery, 2);
14933 xmlResetLastError();
14934 if (mem_base != xmlMemBlocks()) {
14935 printf("Leak of %d blocks found in xmlSAXParseDoc",
14936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014937 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014938 printf(" %d", n_sax);
14939 printf(" %d", n_cur);
14940 printf(" %d", n_recovery);
14941 printf("\n");
14942 }
14943 }
14944 }
14945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014946 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014947#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014948
Daniel Veillard42595322004-11-08 10:52:06 +000014949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014950}
14951
14952
14953static int
14954test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014956
Daniel Veillarda521d282004-11-09 14:59:59 +000014957#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014958 int mem_base;
14959 xmlDocPtr ret_val;
14960 xmlSAXHandlerPtr sax; /* the SAX handler block */
14961 int n_sax;
14962 const char * filename; /* the filename */
14963 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014964
Daniel Veillard34099b42004-11-04 17:34:35 +000014965 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14966 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14967 mem_base = xmlMemBlocks();
14968 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14969 filename = gen_filepath(n_filename, 1);
14970
14971 ret_val = xmlSAXParseEntity(sax, filename);
14972 desret_xmlDocPtr(ret_val);
14973 call_tests++;
14974 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14975 des_filepath(n_filename, filename, 1);
14976 xmlResetLastError();
14977 if (mem_base != xmlMemBlocks()) {
14978 printf("Leak of %d blocks found in xmlSAXParseEntity",
14979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014980 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014981 printf(" %d", n_sax);
14982 printf(" %d", n_filename);
14983 printf("\n");
14984 }
14985 }
14986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014987 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014988#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014989
Daniel Veillard42595322004-11-08 10:52:06 +000014990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014991}
14992
14993
14994static int
14995test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014997
Daniel Veillarda521d282004-11-09 14:59:59 +000014998#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014999 int mem_base;
15000 xmlDocPtr ret_val;
15001 xmlSAXHandlerPtr sax; /* the SAX handler block */
15002 int n_sax;
15003 const char * filename; /* the filename */
15004 int n_filename;
15005 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15006 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015007
Daniel Veillard34099b42004-11-04 17:34:35 +000015008 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15009 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15010 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15011 mem_base = xmlMemBlocks();
15012 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15013 filename = gen_filepath(n_filename, 1);
15014 recovery = gen_int(n_recovery, 2);
15015
15016 ret_val = xmlSAXParseFile(sax, filename, recovery);
15017 desret_xmlDocPtr(ret_val);
15018 call_tests++;
15019 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15020 des_filepath(n_filename, filename, 1);
15021 des_int(n_recovery, recovery, 2);
15022 xmlResetLastError();
15023 if (mem_base != xmlMemBlocks()) {
15024 printf("Leak of %d blocks found in xmlSAXParseFile",
15025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015026 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015027 printf(" %d", n_sax);
15028 printf(" %d", n_filename);
15029 printf(" %d", n_recovery);
15030 printf("\n");
15031 }
15032 }
15033 }
15034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015035 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015036#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015037
Daniel Veillard42595322004-11-08 10:52:06 +000015038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015039}
15040
15041
15042static int
15043test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015045
Daniel Veillarda521d282004-11-09 14:59:59 +000015046#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015047 int mem_base;
15048 xmlDocPtr ret_val;
15049 xmlSAXHandlerPtr sax; /* the SAX handler block */
15050 int n_sax;
15051 const char * filename; /* the filename */
15052 int n_filename;
15053 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15054 int n_recovery;
15055 void * data; /* the userdata */
15056 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015057
Daniel Veillard34099b42004-11-04 17:34:35 +000015058 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15059 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15060 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15061 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
15062 mem_base = xmlMemBlocks();
15063 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15064 filename = gen_filepath(n_filename, 1);
15065 recovery = gen_int(n_recovery, 2);
15066 data = gen_userdata(n_data, 3);
15067
15068 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
15069 desret_xmlDocPtr(ret_val);
15070 call_tests++;
15071 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15072 des_filepath(n_filename, filename, 1);
15073 des_int(n_recovery, recovery, 2);
15074 des_userdata(n_data, data, 3);
15075 xmlResetLastError();
15076 if (mem_base != xmlMemBlocks()) {
15077 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
15078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015079 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015080 printf(" %d", n_sax);
15081 printf(" %d", n_filename);
15082 printf(" %d", n_recovery);
15083 printf(" %d", n_data);
15084 printf("\n");
15085 }
15086 }
15087 }
15088 }
15089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015090 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015091#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015092
Daniel Veillard42595322004-11-08 10:52:06 +000015093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015094}
15095
15096
15097static int
15098test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015100
Daniel Veillarda521d282004-11-09 14:59:59 +000015101#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015102 int mem_base;
15103 xmlDocPtr ret_val;
15104 xmlSAXHandlerPtr sax; /* the SAX handler block */
15105 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015106 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000015107 int n_buffer;
15108 int size; /* the size of the array */
15109 int n_size;
15110 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
15111 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015112
Daniel Veillard34099b42004-11-04 17:34:35 +000015113 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15114 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15115 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15116 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15117 mem_base = xmlMemBlocks();
15118 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15119 buffer = gen_const_char_ptr(n_buffer, 1);
15120 size = gen_int(n_size, 2);
15121 recovery = gen_int(n_recovery, 3);
15122
William M. Brackf13f77f2004-11-12 16:03:48 +000015123 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000015124 desret_xmlDocPtr(ret_val);
15125 call_tests++;
15126 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015127 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000015128 des_int(n_size, size, 2);
15129 des_int(n_recovery, recovery, 3);
15130 xmlResetLastError();
15131 if (mem_base != xmlMemBlocks()) {
15132 printf("Leak of %d blocks found in xmlSAXParseMemory",
15133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015134 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015135 printf(" %d", n_sax);
15136 printf(" %d", n_buffer);
15137 printf(" %d", n_size);
15138 printf(" %d", n_recovery);
15139 printf("\n");
15140 }
15141 }
15142 }
15143 }
15144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015145 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015146#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015147
Daniel Veillard42595322004-11-08 10:52:06 +000015148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015149}
15150
15151
15152static int
15153test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015155
Daniel Veillarda521d282004-11-09 14:59:59 +000015156#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015157 int mem_base;
15158 xmlDocPtr ret_val;
15159 xmlSAXHandlerPtr sax; /* the SAX handler block */
15160 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015161 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000015162 int n_buffer;
15163 int size; /* the size of the array */
15164 int n_size;
15165 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15166 int n_recovery;
15167 void * data; /* the userdata */
15168 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169
Daniel Veillard34099b42004-11-04 17:34:35 +000015170 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15171 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15172 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15173 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15174 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
15175 mem_base = xmlMemBlocks();
15176 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15177 buffer = gen_const_char_ptr(n_buffer, 1);
15178 size = gen_int(n_size, 2);
15179 recovery = gen_int(n_recovery, 3);
15180 data = gen_userdata(n_data, 4);
15181
William M. Brackf13f77f2004-11-12 16:03:48 +000015182 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000015183 desret_xmlDocPtr(ret_val);
15184 call_tests++;
15185 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015186 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000015187 des_int(n_size, size, 2);
15188 des_int(n_recovery, recovery, 3);
15189 des_userdata(n_data, data, 4);
15190 xmlResetLastError();
15191 if (mem_base != xmlMemBlocks()) {
15192 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
15193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015194 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015195 printf(" %d", n_sax);
15196 printf(" %d", n_buffer);
15197 printf(" %d", n_size);
15198 printf(" %d", n_recovery);
15199 printf(" %d", n_data);
15200 printf("\n");
15201 }
15202 }
15203 }
15204 }
15205 }
15206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015207 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015208#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015209
Daniel Veillard42595322004-11-08 10:52:06 +000015210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015211}
15212
15213
15214static int
15215test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015217
Daniel Veillarda521d282004-11-09 14:59:59 +000015218#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015219 int mem_base;
15220 int ret_val;
15221 xmlSAXHandlerPtr sax; /* a SAX handler */
15222 int n_sax;
15223 void * user_data; /* The user data returned on SAX callbacks */
15224 int n_user_data;
15225 const char * filename; /* a file name */
15226 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015227
Daniel Veillard34099b42004-11-04 17:34:35 +000015228 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15229 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15230 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15231 mem_base = xmlMemBlocks();
15232 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15233 user_data = gen_userdata(n_user_data, 1);
15234 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000015235
15236#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015237 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015238#endif
15239
Daniel Veillard34099b42004-11-04 17:34:35 +000015240
15241 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
15242 desret_int(ret_val);
15243 call_tests++;
15244 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15245 des_userdata(n_user_data, user_data, 1);
15246 des_filepath(n_filename, filename, 2);
15247 xmlResetLastError();
15248 if (mem_base != xmlMemBlocks()) {
15249 printf("Leak of %d blocks found in xmlSAXUserParseFile",
15250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015251 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015252 printf(" %d", n_sax);
15253 printf(" %d", n_user_data);
15254 printf(" %d", n_filename);
15255 printf("\n");
15256 }
15257 }
15258 }
15259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015260 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015261#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015262
Daniel Veillard42595322004-11-08 10:52:06 +000015263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015264}
15265
15266
15267static int
15268test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015270
Daniel Veillarda521d282004-11-09 14:59:59 +000015271#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015272 int mem_base;
15273 int ret_val;
15274 xmlSAXHandlerPtr sax; /* a SAX handler */
15275 int n_sax;
15276 void * user_data; /* The user data returned on SAX callbacks */
15277 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015278 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015279 int n_buffer;
15280 int size; /* the length of the XML document in bytes */
15281 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015282
Daniel Veillard34099b42004-11-04 17:34:35 +000015283 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15284 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15285 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15286 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15287 mem_base = xmlMemBlocks();
15288 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15289 user_data = gen_userdata(n_user_data, 1);
15290 buffer = gen_const_char_ptr(n_buffer, 2);
15291 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015292
15293#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015294 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015295#endif
15296
Daniel Veillard34099b42004-11-04 17:34:35 +000015297
William M. Brackf13f77f2004-11-12 16:03:48 +000015298 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015299 desret_int(ret_val);
15300 call_tests++;
15301 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15302 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015303 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015304 des_int(n_size, size, 3);
15305 xmlResetLastError();
15306 if (mem_base != xmlMemBlocks()) {
15307 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015309 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015310 printf(" %d", n_sax);
15311 printf(" %d", n_user_data);
15312 printf(" %d", n_buffer);
15313 printf(" %d", n_size);
15314 printf("\n");
15315 }
15316 }
15317 }
15318 }
15319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015320 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015321#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015322
Daniel Veillard42595322004-11-08 10:52:06 +000015323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015324}
15325
15326
15327static int
15328test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015330
15331
15332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015334}
15335
15336
15337static int
15338test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015340
Daniel Veillarda521d282004-11-09 14:59:59 +000015341#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015342 int mem_base;
15343 int ret_val;
15344 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15345 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015346 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015347 int n_name;
15348 void * value; /* pointer to the location of the new value */
15349 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015350
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015351 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15352 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15353 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15354 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015355 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15356 name = gen_const_char_ptr(n_name, 1);
15357 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015358
William M. Brackf13f77f2004-11-12 16:03:48 +000015359 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015360 desret_int(ret_val);
15361 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015362 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015363 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015364 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015365 xmlResetLastError();
15366 if (mem_base != xmlMemBlocks()) {
15367 printf("Leak of %d blocks found in xmlSetFeature",
15368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015369 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015370 printf(" %d", n_ctxt);
15371 printf(" %d", n_name);
15372 printf(" %d", n_value);
15373 printf("\n");
15374 }
15375 }
15376 }
15377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015378 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015379#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015380
Daniel Veillard42595322004-11-08 10:52:06 +000015381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015382}
15383
15384
15385static int
15386test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015388
Daniel Veillarda521d282004-11-09 14:59:59 +000015389#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015390 int mem_base;
15391 xmlParserCtxtPtr ctxt; /* an XML parser context */
15392 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015393 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015394 int n_buffer;
15395 const char * filename; /* a file name */
15396 int n_filename;
15397
15398 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15399 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15400 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015402 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15403 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15404 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015405
William M. Brackf13f77f2004-11-12 16:03:48 +000015406 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015407 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015408 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015409 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015410 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015411 xmlResetLastError();
15412 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015413 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015415 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015416 printf(" %d", n_ctxt);
15417 printf(" %d", n_buffer);
15418 printf(" %d", n_filename);
15419 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015420 }
15421 }
15422 }
15423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015424 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015425#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015426
Daniel Veillard42595322004-11-08 10:52:06 +000015427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015428}
15429
15430
15431static int
15432test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015434
Daniel Veillarda521d282004-11-09 14:59:59 +000015435#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015436 int mem_base;
15437 xmlParserCtxtPtr ctxt; /* an XML parser context */
15438 int n_ctxt;
15439
15440 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15441 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015442 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015443
15444 xmlStopParser(ctxt);
15445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015446 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015447 xmlResetLastError();
15448 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015449 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015451 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015452 printf(" %d", n_ctxt);
15453 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015454 }
15455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015456 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015457#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015458
Daniel Veillard42595322004-11-08 10:52:06 +000015459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015460}
15461
15462
15463static int
15464test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015466
15467 int mem_base;
15468 int ret_val;
15469 int val; /* int 0 or 1 */
15470 int n_val;
15471
15472 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15473 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015474 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015475
15476 ret_val = xmlSubstituteEntitiesDefault(val);
15477 desret_int(ret_val);
15478 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015479 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015480 xmlResetLastError();
15481 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015482 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015484 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015485 printf(" %d", n_val);
15486 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015487 }
15488 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015490
Daniel Veillard42595322004-11-08 10:52:06 +000015491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015492}
15493
15494static int
15495test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015497
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015498 if (quiet == 0) printf("Testing parser : 58 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015499 test_ret += test_xmlByteConsumed();
15500 test_ret += test_xmlClearNodeInfoSeq();
15501 test_ret += test_xmlClearParserCtxt();
15502 test_ret += test_xmlCreateDocParserCtxt();
15503 test_ret += test_xmlCreatePushParserCtxt();
15504 test_ret += test_xmlCtxtReadDoc();
15505 test_ret += test_xmlCtxtReadFile();
15506 test_ret += test_xmlCtxtReadMemory();
15507 test_ret += test_xmlCtxtReset();
15508 test_ret += test_xmlCtxtResetPush();
15509 test_ret += test_xmlCtxtUseOptions();
15510 test_ret += test_xmlGetExternalEntityLoader();
15511 test_ret += test_xmlGetFeature();
15512 test_ret += test_xmlGetFeaturesList();
15513 test_ret += test_xmlIOParseDTD();
15514 test_ret += test_xmlInitNodeInfoSeq();
15515 test_ret += test_xmlInitParser();
15516 test_ret += test_xmlInitParserCtxt();
15517 test_ret += test_xmlKeepBlanksDefault();
15518 test_ret += test_xmlLineNumbersDefault();
15519 test_ret += test_xmlLoadExternalEntity();
15520 test_ret += test_xmlNewIOInputStream();
15521 test_ret += test_xmlNewParserCtxt();
15522 test_ret += test_xmlParseBalancedChunkMemory();
15523 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15524 test_ret += test_xmlParseChunk();
15525 test_ret += test_xmlParseCtxtExternalEntity();
15526 test_ret += test_xmlParseDTD();
15527 test_ret += test_xmlParseDoc();
15528 test_ret += test_xmlParseDocument();
15529 test_ret += test_xmlParseEntity();
15530 test_ret += test_xmlParseExtParsedEnt();
15531 test_ret += test_xmlParseExternalEntity();
15532 test_ret += test_xmlParseFile();
15533 test_ret += test_xmlParseInNodeContext();
15534 test_ret += test_xmlParseMemory();
15535 test_ret += test_xmlParserAddNodeInfo();
15536 test_ret += test_xmlParserFindNodeInfo();
15537 test_ret += test_xmlParserFindNodeInfoIndex();
15538 test_ret += test_xmlParserInputGrow();
15539 test_ret += test_xmlParserInputRead();
15540 test_ret += test_xmlPedanticParserDefault();
15541 test_ret += test_xmlReadDoc();
15542 test_ret += test_xmlReadFile();
15543 test_ret += test_xmlReadMemory();
15544 test_ret += test_xmlRecoverDoc();
15545 test_ret += test_xmlRecoverFile();
15546 test_ret += test_xmlRecoverMemory();
15547 test_ret += test_xmlSAXParseDTD();
15548 test_ret += test_xmlSAXParseDoc();
15549 test_ret += test_xmlSAXParseEntity();
15550 test_ret += test_xmlSAXParseFile();
15551 test_ret += test_xmlSAXParseFileWithData();
15552 test_ret += test_xmlSAXParseMemory();
15553 test_ret += test_xmlSAXParseMemoryWithData();
15554 test_ret += test_xmlSAXUserParseFile();
15555 test_ret += test_xmlSAXUserParseMemory();
15556 test_ret += test_xmlSetExternalEntityLoader();
15557 test_ret += test_xmlSetFeature();
15558 test_ret += test_xmlSetupParserForBuffer();
15559 test_ret += test_xmlStopParser();
15560 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015561
Daniel Veillard42595322004-11-08 10:52:06 +000015562 if (test_ret != 0)
15563 printf("Module parser: %d errors\n", test_ret);
15564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015565}
15566
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015567static int
15568test_htmlCreateFileParserCtxt(void) {
15569 int test_ret = 0;
15570
15571#ifdef LIBXML_HTML_ENABLED
15572 int mem_base;
15573 htmlParserCtxtPtr ret_val;
15574 const char * filename; /* the filename */
15575 int n_filename;
15576 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15577 int n_encoding;
15578
15579 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15580 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15581 mem_base = xmlMemBlocks();
15582 filename = gen_fileoutput(n_filename, 0);
15583 encoding = gen_const_char_ptr(n_encoding, 1);
15584
William M. Brackf13f77f2004-11-12 16:03:48 +000015585 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015586 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015587 call_tests++;
15588 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015589 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015590 xmlResetLastError();
15591 if (mem_base != xmlMemBlocks()) {
15592 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15593 xmlMemBlocks() - mem_base);
15594 test_ret++;
15595 printf(" %d", n_filename);
15596 printf(" %d", n_encoding);
15597 printf("\n");
15598 }
15599 }
15600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015601 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015602#endif
15603
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015604 return(test_ret);
15605}
15606
15607
15608static int
15609test_htmlInitAutoClose(void) {
15610 int test_ret = 0;
15611
15612#ifdef LIBXML_HTML_ENABLED
15613 int mem_base;
15614
15615 mem_base = xmlMemBlocks();
15616
15617 htmlInitAutoClose();
15618 call_tests++;
15619 xmlResetLastError();
15620 if (mem_base != xmlMemBlocks()) {
15621 printf("Leak of %d blocks found in htmlInitAutoClose",
15622 xmlMemBlocks() - mem_base);
15623 test_ret++;
15624 printf("\n");
15625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015626 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015627#endif
15628
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015629 return(test_ret);
15630}
15631
15632
15633static int
15634test_inputPop(void) {
15635 int test_ret = 0;
15636
15637 int mem_base;
15638 xmlParserInputPtr ret_val;
15639 xmlParserCtxtPtr ctxt; /* an XML parser context */
15640 int n_ctxt;
15641
15642 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15643 mem_base = xmlMemBlocks();
15644 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15645
15646 ret_val = inputPop(ctxt);
15647 desret_xmlParserInputPtr(ret_val);
15648 call_tests++;
15649 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15650 xmlResetLastError();
15651 if (mem_base != xmlMemBlocks()) {
15652 printf("Leak of %d blocks found in inputPop",
15653 xmlMemBlocks() - mem_base);
15654 test_ret++;
15655 printf(" %d", n_ctxt);
15656 printf("\n");
15657 }
15658 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015659 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015660
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015661 return(test_ret);
15662}
15663
15664
15665static int
15666test_inputPush(void) {
15667 int test_ret = 0;
15668
15669 int mem_base;
15670 int ret_val;
15671 xmlParserCtxtPtr ctxt; /* an XML parser context */
15672 int n_ctxt;
15673 xmlParserInputPtr value; /* the parser input */
15674 int n_value;
15675
15676 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15677 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15678 mem_base = xmlMemBlocks();
15679 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15680 value = gen_xmlParserInputPtr(n_value, 1);
15681
15682 ret_val = inputPush(ctxt, value);
15683 desret_int(ret_val);
15684 call_tests++;
15685 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15686 des_xmlParserInputPtr(n_value, value, 1);
15687 xmlResetLastError();
15688 if (mem_base != xmlMemBlocks()) {
15689 printf("Leak of %d blocks found in inputPush",
15690 xmlMemBlocks() - mem_base);
15691 test_ret++;
15692 printf(" %d", n_ctxt);
15693 printf(" %d", n_value);
15694 printf("\n");
15695 }
15696 }
15697 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015699
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015700 return(test_ret);
15701}
15702
15703
15704static int
15705test_namePop(void) {
15706 int test_ret = 0;
15707
15708 int mem_base;
15709 const xmlChar * ret_val;
15710 xmlParserCtxtPtr ctxt; /* an XML parser context */
15711 int n_ctxt;
15712
15713 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15714 mem_base = xmlMemBlocks();
15715 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15716
15717 ret_val = namePop(ctxt);
15718 desret_const_xmlChar_ptr(ret_val);
15719 call_tests++;
15720 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15721 xmlResetLastError();
15722 if (mem_base != xmlMemBlocks()) {
15723 printf("Leak of %d blocks found in namePop",
15724 xmlMemBlocks() - mem_base);
15725 test_ret++;
15726 printf(" %d", n_ctxt);
15727 printf("\n");
15728 }
15729 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015730 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015731
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015732 return(test_ret);
15733}
15734
15735
15736static int
15737test_namePush(void) {
15738 int test_ret = 0;
15739
15740 int mem_base;
15741 int ret_val;
15742 xmlParserCtxtPtr ctxt; /* an XML parser context */
15743 int n_ctxt;
15744 xmlChar * value; /* the element name */
15745 int n_value;
15746
15747 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15748 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15749 mem_base = xmlMemBlocks();
15750 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15751 value = gen_const_xmlChar_ptr(n_value, 1);
15752
William M. Brackf13f77f2004-11-12 16:03:48 +000015753 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015754 desret_int(ret_val);
15755 call_tests++;
15756 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015757 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015758 xmlResetLastError();
15759 if (mem_base != xmlMemBlocks()) {
15760 printf("Leak of %d blocks found in namePush",
15761 xmlMemBlocks() - mem_base);
15762 test_ret++;
15763 printf(" %d", n_ctxt);
15764 printf(" %d", n_value);
15765 printf("\n");
15766 }
15767 }
15768 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015769 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015770
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015771 return(test_ret);
15772}
15773
15774
15775static int
15776test_nodePop(void) {
15777 int test_ret = 0;
15778
15779 int mem_base;
15780 xmlNodePtr ret_val;
15781 xmlParserCtxtPtr ctxt; /* an XML parser context */
15782 int n_ctxt;
15783
15784 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15785 mem_base = xmlMemBlocks();
15786 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15787
15788 ret_val = nodePop(ctxt);
15789 desret_xmlNodePtr(ret_val);
15790 call_tests++;
15791 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15792 xmlResetLastError();
15793 if (mem_base != xmlMemBlocks()) {
15794 printf("Leak of %d blocks found in nodePop",
15795 xmlMemBlocks() - mem_base);
15796 test_ret++;
15797 printf(" %d", n_ctxt);
15798 printf("\n");
15799 }
15800 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015801 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015802
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015803 return(test_ret);
15804}
15805
15806
15807static int
15808test_nodePush(void) {
15809 int test_ret = 0;
15810
15811 int mem_base;
15812 int ret_val;
15813 xmlParserCtxtPtr ctxt; /* an XML parser context */
15814 int n_ctxt;
15815 xmlNodePtr value; /* the element node */
15816 int n_value;
15817
15818 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15819 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15820 mem_base = xmlMemBlocks();
15821 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15822 value = gen_xmlNodePtr(n_value, 1);
15823
15824 ret_val = nodePush(ctxt, value);
15825 desret_int(ret_val);
15826 call_tests++;
15827 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15828 des_xmlNodePtr(n_value, value, 1);
15829 xmlResetLastError();
15830 if (mem_base != xmlMemBlocks()) {
15831 printf("Leak of %d blocks found in nodePush",
15832 xmlMemBlocks() - mem_base);
15833 test_ret++;
15834 printf(" %d", n_ctxt);
15835 printf(" %d", n_value);
15836 printf("\n");
15837 }
15838 }
15839 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015840 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015841
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015842 return(test_ret);
15843}
15844
15845
15846static int
15847test_xmlCheckLanguageID(void) {
15848 int test_ret = 0;
15849
15850 int mem_base;
15851 int ret_val;
15852 xmlChar * lang; /* pointer to the string value */
15853 int n_lang;
15854
15855 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15856 mem_base = xmlMemBlocks();
15857 lang = gen_const_xmlChar_ptr(n_lang, 0);
15858
William M. Brackf13f77f2004-11-12 16:03:48 +000015859 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015860 desret_int(ret_val);
15861 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015862 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015863 xmlResetLastError();
15864 if (mem_base != xmlMemBlocks()) {
15865 printf("Leak of %d blocks found in xmlCheckLanguageID",
15866 xmlMemBlocks() - mem_base);
15867 test_ret++;
15868 printf(" %d", n_lang);
15869 printf("\n");
15870 }
15871 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015872 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015873
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015874 return(test_ret);
15875}
15876
15877
15878static int
15879test_xmlCopyChar(void) {
15880 int test_ret = 0;
15881
15882 int mem_base;
15883 int ret_val;
15884 int len; /* Ignored, compatibility */
15885 int n_len;
15886 xmlChar * out; /* pointer to an array of xmlChar */
15887 int n_out;
15888 int val; /* the char value */
15889 int n_val;
15890
15891 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15892 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15893 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15894 mem_base = xmlMemBlocks();
15895 len = gen_int(n_len, 0);
15896 out = gen_xmlChar_ptr(n_out, 1);
15897 val = gen_int(n_val, 2);
15898
15899 ret_val = xmlCopyChar(len, out, val);
15900 desret_int(ret_val);
15901 call_tests++;
15902 des_int(n_len, len, 0);
15903 des_xmlChar_ptr(n_out, out, 1);
15904 des_int(n_val, val, 2);
15905 xmlResetLastError();
15906 if (mem_base != xmlMemBlocks()) {
15907 printf("Leak of %d blocks found in xmlCopyChar",
15908 xmlMemBlocks() - mem_base);
15909 test_ret++;
15910 printf(" %d", n_len);
15911 printf(" %d", n_out);
15912 printf(" %d", n_val);
15913 printf("\n");
15914 }
15915 }
15916 }
15917 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015919
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015920 return(test_ret);
15921}
15922
15923
15924static int
15925test_xmlCopyCharMultiByte(void) {
15926 int test_ret = 0;
15927
15928 int mem_base;
15929 int ret_val;
15930 xmlChar * out; /* pointer to an array of xmlChar */
15931 int n_out;
15932 int val; /* the char value */
15933 int n_val;
15934
15935 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15936 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15937 mem_base = xmlMemBlocks();
15938 out = gen_xmlChar_ptr(n_out, 0);
15939 val = gen_int(n_val, 1);
15940
15941 ret_val = xmlCopyCharMultiByte(out, val);
15942 desret_int(ret_val);
15943 call_tests++;
15944 des_xmlChar_ptr(n_out, out, 0);
15945 des_int(n_val, val, 1);
15946 xmlResetLastError();
15947 if (mem_base != xmlMemBlocks()) {
15948 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15949 xmlMemBlocks() - mem_base);
15950 test_ret++;
15951 printf(" %d", n_out);
15952 printf(" %d", n_val);
15953 printf("\n");
15954 }
15955 }
15956 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015957 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015958
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015959 return(test_ret);
15960}
15961
15962
15963static int
15964test_xmlCreateEntityParserCtxt(void) {
15965 int test_ret = 0;
15966
15967 int mem_base;
15968 xmlParserCtxtPtr ret_val;
15969 xmlChar * URL; /* the entity URL */
15970 int n_URL;
15971 xmlChar * ID; /* the entity PUBLIC ID */
15972 int n_ID;
15973 xmlChar * base; /* a possible base for the target URI */
15974 int n_base;
15975
15976 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15977 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15978 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15979 mem_base = xmlMemBlocks();
15980 URL = gen_const_xmlChar_ptr(n_URL, 0);
15981 ID = gen_const_xmlChar_ptr(n_ID, 1);
15982 base = gen_const_xmlChar_ptr(n_base, 2);
15983
William M. Brackf13f77f2004-11-12 16:03:48 +000015984 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015985 desret_xmlParserCtxtPtr(ret_val);
15986 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015987 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15988 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15989 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015990 xmlResetLastError();
15991 if (mem_base != xmlMemBlocks()) {
15992 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15993 xmlMemBlocks() - mem_base);
15994 test_ret++;
15995 printf(" %d", n_URL);
15996 printf(" %d", n_ID);
15997 printf(" %d", n_base);
15998 printf("\n");
15999 }
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_xmlCreateFileParserCtxt(void) {
16011 int test_ret = 0;
16012
16013 int mem_base;
16014 xmlParserCtxtPtr ret_val;
16015 const char * filename; /* the filename */
16016 int n_filename;
16017
16018 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
16019 mem_base = xmlMemBlocks();
16020 filename = gen_fileoutput(n_filename, 0);
16021
16022 ret_val = xmlCreateFileParserCtxt(filename);
16023 desret_xmlParserCtxtPtr(ret_val);
16024 call_tests++;
16025 des_fileoutput(n_filename, filename, 0);
16026 xmlResetLastError();
16027 if (mem_base != xmlMemBlocks()) {
16028 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
16029 xmlMemBlocks() - mem_base);
16030 test_ret++;
16031 printf(" %d", n_filename);
16032 printf("\n");
16033 }
16034 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016035 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016036
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016037 return(test_ret);
16038}
16039
16040
16041static int
16042test_xmlCreateMemoryParserCtxt(void) {
16043 int test_ret = 0;
16044
16045 int mem_base;
16046 xmlParserCtxtPtr ret_val;
16047 char * buffer; /* a pointer to a char array */
16048 int n_buffer;
16049 int size; /* the size of the array */
16050 int n_size;
16051
16052 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
16053 for (n_size = 0;n_size < gen_nb_int;n_size++) {
16054 mem_base = xmlMemBlocks();
16055 buffer = gen_const_char_ptr(n_buffer, 0);
16056 size = gen_int(n_size, 1);
16057
William M. Brackf13f77f2004-11-12 16:03:48 +000016058 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016059 desret_xmlParserCtxtPtr(ret_val);
16060 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000016061 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016062 des_int(n_size, size, 1);
16063 xmlResetLastError();
16064 if (mem_base != xmlMemBlocks()) {
16065 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
16066 xmlMemBlocks() - mem_base);
16067 test_ret++;
16068 printf(" %d", n_buffer);
16069 printf(" %d", n_size);
16070 printf("\n");
16071 }
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_xmlCreateURLParserCtxt(void) {
16082 int test_ret = 0;
16083
16084 int mem_base;
16085 xmlParserCtxtPtr ret_val;
16086 const char * filename; /* the filename or URL */
16087 int n_filename;
16088 int options; /* a combination of xmlParserOption */
16089 int n_options;
16090
16091 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
16092 for (n_options = 0;n_options < gen_nb_int;n_options++) {
16093 mem_base = xmlMemBlocks();
16094 filename = gen_fileoutput(n_filename, 0);
16095 options = gen_int(n_options, 1);
16096
16097 ret_val = xmlCreateURLParserCtxt(filename, options);
16098 desret_xmlParserCtxtPtr(ret_val);
16099 call_tests++;
16100 des_fileoutput(n_filename, filename, 0);
16101 des_int(n_options, options, 1);
16102 xmlResetLastError();
16103 if (mem_base != xmlMemBlocks()) {
16104 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
16105 xmlMemBlocks() - mem_base);
16106 test_ret++;
16107 printf(" %d", n_filename);
16108 printf(" %d", n_options);
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_xmlCurrentChar(void) {
16121 int test_ret = 0;
16122
16123 int mem_base;
16124 int ret_val;
16125 xmlParserCtxtPtr ctxt; /* the XML parser context */
16126 int n_ctxt;
16127 int * len; /* pointer to the length of the char read */
16128 int n_len;
16129
16130 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16131 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16132 mem_base = xmlMemBlocks();
16133 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16134 len = gen_int_ptr(n_len, 1);
16135
16136 ret_val = xmlCurrentChar(ctxt, len);
16137 desret_int(ret_val);
16138 call_tests++;
16139 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16140 des_int_ptr(n_len, len, 1);
16141 xmlResetLastError();
16142 if (mem_base != xmlMemBlocks()) {
16143 printf("Leak of %d blocks found in xmlCurrentChar",
16144 xmlMemBlocks() - mem_base);
16145 test_ret++;
16146 printf(" %d", n_ctxt);
16147 printf(" %d", n_len);
16148 printf("\n");
16149 }
16150 }
16151 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016152 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016153
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016154 return(test_ret);
16155}
16156
16157
16158static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016159test_xmlErrMemory(void) {
16160 int test_ret = 0;
16161
16162 int mem_base;
16163 xmlParserCtxtPtr ctxt; /* an XML parser context */
16164 int n_ctxt;
16165 char * extra; /* extra informations */
16166 int n_extra;
16167
16168 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16169 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
16170 mem_base = xmlMemBlocks();
16171 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16172 extra = gen_const_char_ptr(n_extra, 1);
16173
William M. Brackf13f77f2004-11-12 16:03:48 +000016174 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016175 call_tests++;
16176 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016177 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016178 xmlResetLastError();
16179 if (mem_base != xmlMemBlocks()) {
16180 printf("Leak of %d blocks found in xmlErrMemory",
16181 xmlMemBlocks() - mem_base);
16182 test_ret++;
16183 printf(" %d", n_ctxt);
16184 printf(" %d", n_extra);
16185 printf("\n");
16186 }
16187 }
16188 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016189 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016190
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016191 return(test_ret);
16192}
16193
16194
16195static int
16196test_xmlIsLetter(void) {
16197 int test_ret = 0;
16198
16199 int mem_base;
16200 int ret_val;
16201 int c; /* an unicode character (int) */
16202 int n_c;
16203
16204 for (n_c = 0;n_c < gen_nb_int;n_c++) {
16205 mem_base = xmlMemBlocks();
16206 c = gen_int(n_c, 0);
16207
16208 ret_val = xmlIsLetter(c);
16209 desret_int(ret_val);
16210 call_tests++;
16211 des_int(n_c, c, 0);
16212 xmlResetLastError();
16213 if (mem_base != xmlMemBlocks()) {
16214 printf("Leak of %d blocks found in xmlIsLetter",
16215 xmlMemBlocks() - mem_base);
16216 test_ret++;
16217 printf(" %d", n_c);
16218 printf("\n");
16219 }
16220 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016221 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016222
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016223 return(test_ret);
16224}
16225
16226
16227static int
16228test_xmlNewEntityInputStream(void) {
16229 int test_ret = 0;
16230
16231 int mem_base;
16232 xmlParserInputPtr ret_val;
16233 xmlParserCtxtPtr ctxt; /* an XML parser context */
16234 int n_ctxt;
16235 xmlEntityPtr entity; /* an Entity pointer */
16236 int n_entity;
16237
16238 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16239 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
16240 mem_base = xmlMemBlocks();
16241 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16242 entity = gen_xmlEntityPtr(n_entity, 1);
16243
16244 ret_val = xmlNewEntityInputStream(ctxt, entity);
16245 desret_xmlParserInputPtr(ret_val);
16246 call_tests++;
16247 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16248 des_xmlEntityPtr(n_entity, entity, 1);
16249 xmlResetLastError();
16250 if (mem_base != xmlMemBlocks()) {
16251 printf("Leak of %d blocks found in xmlNewEntityInputStream",
16252 xmlMemBlocks() - mem_base);
16253 test_ret++;
16254 printf(" %d", n_ctxt);
16255 printf(" %d", n_entity);
16256 printf("\n");
16257 }
16258 }
16259 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016261
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016262 return(test_ret);
16263}
16264
16265
16266static int
16267test_xmlNewInputFromFile(void) {
16268 int test_ret = 0;
16269
16270 int mem_base;
16271 xmlParserInputPtr ret_val;
16272 xmlParserCtxtPtr ctxt; /* an XML parser context */
16273 int n_ctxt;
16274 const char * filename; /* the filename to use as entity */
16275 int n_filename;
16276
16277 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16278 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16279 mem_base = xmlMemBlocks();
16280 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16281 filename = gen_filepath(n_filename, 1);
16282
16283 ret_val = xmlNewInputFromFile(ctxt, filename);
16284 desret_xmlParserInputPtr(ret_val);
16285 call_tests++;
16286 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16287 des_filepath(n_filename, filename, 1);
16288 xmlResetLastError();
16289 if (mem_base != xmlMemBlocks()) {
16290 printf("Leak of %d blocks found in xmlNewInputFromFile",
16291 xmlMemBlocks() - mem_base);
16292 test_ret++;
16293 printf(" %d", n_ctxt);
16294 printf(" %d", n_filename);
16295 printf("\n");
16296 }
16297 }
16298 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016299 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016300
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016301 return(test_ret);
16302}
16303
16304
16305static int
16306test_xmlNewInputStream(void) {
16307 int test_ret = 0;
16308
16309 int mem_base;
16310 xmlParserInputPtr ret_val;
16311 xmlParserCtxtPtr ctxt; /* an XML parser context */
16312 int n_ctxt;
16313
16314 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16315 mem_base = xmlMemBlocks();
16316 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16317
16318 ret_val = xmlNewInputStream(ctxt);
16319 desret_xmlParserInputPtr(ret_val);
16320 call_tests++;
16321 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16322 xmlResetLastError();
16323 if (mem_base != xmlMemBlocks()) {
16324 printf("Leak of %d blocks found in xmlNewInputStream",
16325 xmlMemBlocks() - mem_base);
16326 test_ret++;
16327 printf(" %d", n_ctxt);
16328 printf("\n");
16329 }
16330 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016331 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016332
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016333 return(test_ret);
16334}
16335
16336
16337static int
16338test_xmlNewStringInputStream(void) {
16339 int test_ret = 0;
16340
16341 int mem_base;
16342 xmlParserInputPtr ret_val;
16343 xmlParserCtxtPtr ctxt; /* an XML parser context */
16344 int n_ctxt;
16345 xmlChar * buffer; /* an memory buffer */
16346 int n_buffer;
16347
16348 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16349 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16350 mem_base = xmlMemBlocks();
16351 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16352 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16353
William M. Brackf13f77f2004-11-12 16:03:48 +000016354 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016355 desret_xmlParserInputPtr(ret_val);
16356 call_tests++;
16357 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016358 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016359 xmlResetLastError();
16360 if (mem_base != xmlMemBlocks()) {
16361 printf("Leak of %d blocks found in xmlNewStringInputStream",
16362 xmlMemBlocks() - mem_base);
16363 test_ret++;
16364 printf(" %d", n_ctxt);
16365 printf(" %d", n_buffer);
16366 printf("\n");
16367 }
16368 }
16369 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016371
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016372 return(test_ret);
16373}
16374
16375
16376static int
16377test_xmlNextChar(void) {
16378 int test_ret = 0;
16379
16380 int mem_base;
16381 xmlParserCtxtPtr ctxt; /* the XML parser context */
16382 int n_ctxt;
16383
16384 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16385 mem_base = xmlMemBlocks();
16386 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16387
16388 xmlNextChar(ctxt);
16389 call_tests++;
16390 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16391 xmlResetLastError();
16392 if (mem_base != xmlMemBlocks()) {
16393 printf("Leak of %d blocks found in xmlNextChar",
16394 xmlMemBlocks() - mem_base);
16395 test_ret++;
16396 printf(" %d", n_ctxt);
16397 printf("\n");
16398 }
16399 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016400 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016401
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016402 return(test_ret);
16403}
16404
16405
16406static int
16407test_xmlParserInputShrink(void) {
16408 int test_ret = 0;
16409
16410 int mem_base;
16411 xmlParserInputPtr in; /* an XML parser input */
16412 int n_in;
16413
16414 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16415 mem_base = xmlMemBlocks();
16416 in = gen_xmlParserInputPtr(n_in, 0);
16417
16418 xmlParserInputShrink(in);
16419 call_tests++;
16420 des_xmlParserInputPtr(n_in, in, 0);
16421 xmlResetLastError();
16422 if (mem_base != xmlMemBlocks()) {
16423 printf("Leak of %d blocks found in xmlParserInputShrink",
16424 xmlMemBlocks() - mem_base);
16425 test_ret++;
16426 printf(" %d", n_in);
16427 printf("\n");
16428 }
16429 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016431
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016432 return(test_ret);
16433}
16434
16435
16436static int
16437test_xmlPopInput(void) {
16438 int test_ret = 0;
16439
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016440 int mem_base;
16441 xmlChar ret_val;
16442 xmlParserCtxtPtr ctxt; /* an XML parser context */
16443 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016444
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016445 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16446 mem_base = xmlMemBlocks();
16447 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16448
16449 ret_val = xmlPopInput(ctxt);
16450 desret_xmlChar(ret_val);
16451 call_tests++;
16452 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16453 xmlResetLastError();
16454 if (mem_base != xmlMemBlocks()) {
16455 printf("Leak of %d blocks found in xmlPopInput",
16456 xmlMemBlocks() - mem_base);
16457 test_ret++;
16458 printf(" %d", n_ctxt);
16459 printf("\n");
16460 }
16461 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016462 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016463
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016464 return(test_ret);
16465}
16466
16467
16468static int
16469test_xmlPushInput(void) {
16470 int test_ret = 0;
16471
16472 int mem_base;
16473 xmlParserCtxtPtr ctxt; /* an XML parser context */
16474 int n_ctxt;
16475 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16476 int n_input;
16477
16478 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16479 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16480 mem_base = xmlMemBlocks();
16481 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16482 input = gen_xmlParserInputPtr(n_input, 1);
16483
16484 xmlPushInput(ctxt, input);
16485 call_tests++;
16486 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16487 des_xmlParserInputPtr(n_input, input, 1);
16488 xmlResetLastError();
16489 if (mem_base != xmlMemBlocks()) {
16490 printf("Leak of %d blocks found in xmlPushInput",
16491 xmlMemBlocks() - mem_base);
16492 test_ret++;
16493 printf(" %d", n_ctxt);
16494 printf(" %d", n_input);
16495 printf("\n");
16496 }
16497 }
16498 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016499 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016500
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016501 return(test_ret);
16502}
16503
16504
16505static int
16506test_xmlSetEntityReferenceFunc(void) {
16507 int test_ret = 0;
16508
16509
16510 /* missing type support */
16511 return(test_ret);
16512}
16513
16514
16515static int
16516test_xmlSplitQName(void) {
16517 int test_ret = 0;
16518
16519 int mem_base;
16520 xmlChar * ret_val;
16521 xmlParserCtxtPtr ctxt; /* an XML parser context */
16522 int n_ctxt;
16523 xmlChar * name; /* an XML parser context */
16524 int n_name;
16525 xmlChar ** prefix; /* a xmlChar ** */
16526 int n_prefix;
16527
16528 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16529 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16530 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16531 mem_base = xmlMemBlocks();
16532 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16533 name = gen_const_xmlChar_ptr(n_name, 1);
16534 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16535
William M. Brackf13f77f2004-11-12 16:03:48 +000016536 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016537 desret_xmlChar_ptr(ret_val);
16538 call_tests++;
16539 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016540 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016541 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16542 xmlResetLastError();
16543 if (mem_base != xmlMemBlocks()) {
16544 printf("Leak of %d blocks found in xmlSplitQName",
16545 xmlMemBlocks() - mem_base);
16546 test_ret++;
16547 printf(" %d", n_ctxt);
16548 printf(" %d", n_name);
16549 printf(" %d", n_prefix);
16550 printf("\n");
16551 }
16552 }
16553 }
16554 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016555 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016556
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016557 return(test_ret);
16558}
16559
16560
16561static int
16562test_xmlStringCurrentChar(void) {
16563 int test_ret = 0;
16564
16565 int mem_base;
16566 int ret_val;
16567 xmlParserCtxtPtr ctxt; /* the XML parser context */
16568 int n_ctxt;
16569 xmlChar * cur; /* pointer to the beginning of the char */
16570 int n_cur;
16571 int * len; /* pointer to the length of the char read */
16572 int n_len;
16573
16574 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16575 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16576 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16577 mem_base = xmlMemBlocks();
16578 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16579 cur = gen_const_xmlChar_ptr(n_cur, 1);
16580 len = gen_int_ptr(n_len, 2);
16581
William M. Brackf13f77f2004-11-12 16:03:48 +000016582 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016583 desret_int(ret_val);
16584 call_tests++;
16585 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016586 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016587 des_int_ptr(n_len, len, 2);
16588 xmlResetLastError();
16589 if (mem_base != xmlMemBlocks()) {
16590 printf("Leak of %d blocks found in xmlStringCurrentChar",
16591 xmlMemBlocks() - mem_base);
16592 test_ret++;
16593 printf(" %d", n_ctxt);
16594 printf(" %d", n_cur);
16595 printf(" %d", n_len);
16596 printf("\n");
16597 }
16598 }
16599 }
16600 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016602
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016603 return(test_ret);
16604}
16605
16606
16607static int
16608test_xmlStringDecodeEntities(void) {
16609 int test_ret = 0;
16610
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016611 int mem_base;
16612 xmlChar * ret_val;
16613 xmlParserCtxtPtr ctxt; /* the parser context */
16614 int n_ctxt;
16615 xmlChar * str; /* the input string */
16616 int n_str;
16617 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16618 int n_what;
16619 xmlChar end; /* an end marker xmlChar, 0 if none */
16620 int n_end;
16621 xmlChar end2; /* an end marker xmlChar, 0 if none */
16622 int n_end2;
16623 xmlChar end3; /* an end marker xmlChar, 0 if none */
16624 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016625
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016626 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16627 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16628 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16629 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16630 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16631 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16632 mem_base = xmlMemBlocks();
16633 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16634 str = gen_const_xmlChar_ptr(n_str, 1);
16635 what = gen_int(n_what, 2);
16636 end = gen_xmlChar(n_end, 3);
16637 end2 = gen_xmlChar(n_end2, 4);
16638 end3 = gen_xmlChar(n_end3, 5);
16639
William M. Brackf13f77f2004-11-12 16:03:48 +000016640 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016641 desret_xmlChar_ptr(ret_val);
16642 call_tests++;
16643 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016644 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016645 des_int(n_what, what, 2);
16646 des_xmlChar(n_end, end, 3);
16647 des_xmlChar(n_end2, end2, 4);
16648 des_xmlChar(n_end3, end3, 5);
16649 xmlResetLastError();
16650 if (mem_base != xmlMemBlocks()) {
16651 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16652 xmlMemBlocks() - mem_base);
16653 test_ret++;
16654 printf(" %d", n_ctxt);
16655 printf(" %d", n_str);
16656 printf(" %d", n_what);
16657 printf(" %d", n_end);
16658 printf(" %d", n_end2);
16659 printf(" %d", n_end3);
16660 printf("\n");
16661 }
16662 }
16663 }
16664 }
16665 }
16666 }
16667 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016668 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016669
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016670 return(test_ret);
16671}
16672
16673
16674static int
16675test_xmlStringLenDecodeEntities(void) {
16676 int test_ret = 0;
16677
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016678 int mem_base;
16679 xmlChar * ret_val;
16680 xmlParserCtxtPtr ctxt; /* the parser context */
16681 int n_ctxt;
16682 xmlChar * str; /* the input string */
16683 int n_str;
16684 int len; /* the string length */
16685 int n_len;
16686 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16687 int n_what;
16688 xmlChar end; /* an end marker xmlChar, 0 if none */
16689 int n_end;
16690 xmlChar end2; /* an end marker xmlChar, 0 if none */
16691 int n_end2;
16692 xmlChar end3; /* an end marker xmlChar, 0 if none */
16693 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016694
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016695 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16696 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16697 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16698 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16699 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16700 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16701 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16702 mem_base = xmlMemBlocks();
16703 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16704 str = gen_const_xmlChar_ptr(n_str, 1);
16705 len = gen_int(n_len, 2);
16706 what = gen_int(n_what, 3);
16707 end = gen_xmlChar(n_end, 4);
16708 end2 = gen_xmlChar(n_end2, 5);
16709 end3 = gen_xmlChar(n_end3, 6);
16710
William M. Brackf13f77f2004-11-12 16:03:48 +000016711 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016712 desret_xmlChar_ptr(ret_val);
16713 call_tests++;
16714 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016715 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016716 des_int(n_len, len, 2);
16717 des_int(n_what, what, 3);
16718 des_xmlChar(n_end, end, 4);
16719 des_xmlChar(n_end2, end2, 5);
16720 des_xmlChar(n_end3, end3, 6);
16721 xmlResetLastError();
16722 if (mem_base != xmlMemBlocks()) {
16723 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16724 xmlMemBlocks() - mem_base);
16725 test_ret++;
16726 printf(" %d", n_ctxt);
16727 printf(" %d", n_str);
16728 printf(" %d", n_len);
16729 printf(" %d", n_what);
16730 printf(" %d", n_end);
16731 printf(" %d", n_end2);
16732 printf(" %d", n_end3);
16733 printf("\n");
16734 }
16735 }
16736 }
16737 }
16738 }
16739 }
16740 }
16741 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016743
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016744 return(test_ret);
16745}
16746
16747
16748static int
16749test_xmlSwitchEncoding(void) {
16750 int test_ret = 0;
16751
16752 int mem_base;
16753 int ret_val;
16754 xmlParserCtxtPtr ctxt; /* the parser context */
16755 int n_ctxt;
16756 xmlCharEncoding enc; /* the encoding value (number) */
16757 int n_enc;
16758
16759 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16760 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16761 mem_base = xmlMemBlocks();
16762 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16763 enc = gen_xmlCharEncoding(n_enc, 1);
16764
16765 ret_val = xmlSwitchEncoding(ctxt, enc);
16766 desret_int(ret_val);
16767 call_tests++;
16768 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16769 des_xmlCharEncoding(n_enc, enc, 1);
16770 xmlResetLastError();
16771 if (mem_base != xmlMemBlocks()) {
16772 printf("Leak of %d blocks found in xmlSwitchEncoding",
16773 xmlMemBlocks() - mem_base);
16774 test_ret++;
16775 printf(" %d", n_ctxt);
16776 printf(" %d", n_enc);
16777 printf("\n");
16778 }
16779 }
16780 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016781 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016782
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016783 return(test_ret);
16784}
16785
16786
16787static int
16788test_xmlSwitchInputEncoding(void) {
16789 int test_ret = 0;
16790
16791 int mem_base;
16792 int ret_val;
16793 xmlParserCtxtPtr ctxt; /* the parser context */
16794 int n_ctxt;
16795 xmlParserInputPtr input; /* the input stream */
16796 int n_input;
16797 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16798 int n_handler;
16799
16800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16801 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16802 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16803 mem_base = xmlMemBlocks();
16804 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16805 input = gen_xmlParserInputPtr(n_input, 1);
16806 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16807
16808 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16809 desret_int(ret_val);
16810 call_tests++;
16811 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16812 des_xmlParserInputPtr(n_input, input, 1);
16813 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16814 xmlResetLastError();
16815 if (mem_base != xmlMemBlocks()) {
16816 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16817 xmlMemBlocks() - mem_base);
16818 test_ret++;
16819 printf(" %d", n_ctxt);
16820 printf(" %d", n_input);
16821 printf(" %d", n_handler);
16822 printf("\n");
16823 }
16824 }
16825 }
16826 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016827 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016828
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016829 return(test_ret);
16830}
16831
16832
16833static int
16834test_xmlSwitchToEncoding(void) {
16835 int test_ret = 0;
16836
16837 int mem_base;
16838 int ret_val;
16839 xmlParserCtxtPtr ctxt; /* the parser context */
16840 int n_ctxt;
16841 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16842 int n_handler;
16843
16844 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16845 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16846 mem_base = xmlMemBlocks();
16847 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16848 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16849
16850 ret_val = xmlSwitchToEncoding(ctxt, handler);
16851 desret_int(ret_val);
16852 call_tests++;
16853 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16854 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16855 xmlResetLastError();
16856 if (mem_base != xmlMemBlocks()) {
16857 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16858 xmlMemBlocks() - mem_base);
16859 test_ret++;
16860 printf(" %d", n_ctxt);
16861 printf(" %d", n_handler);
16862 printf("\n");
16863 }
16864 }
16865 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016867
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016868 return(test_ret);
16869}
16870
16871static int
16872test_parserInternals(void) {
16873 int test_ret = 0;
16874
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016875 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016876 test_ret += test_htmlCreateFileParserCtxt();
16877 test_ret += test_htmlInitAutoClose();
16878 test_ret += test_inputPop();
16879 test_ret += test_inputPush();
16880 test_ret += test_namePop();
16881 test_ret += test_namePush();
16882 test_ret += test_nodePop();
16883 test_ret += test_nodePush();
16884 test_ret += test_xmlCheckLanguageID();
16885 test_ret += test_xmlCopyChar();
16886 test_ret += test_xmlCopyCharMultiByte();
16887 test_ret += test_xmlCreateEntityParserCtxt();
16888 test_ret += test_xmlCreateFileParserCtxt();
16889 test_ret += test_xmlCreateMemoryParserCtxt();
16890 test_ret += test_xmlCreateURLParserCtxt();
16891 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016892 test_ret += test_xmlErrMemory();
16893 test_ret += test_xmlIsLetter();
16894 test_ret += test_xmlNewEntityInputStream();
16895 test_ret += test_xmlNewInputFromFile();
16896 test_ret += test_xmlNewInputStream();
16897 test_ret += test_xmlNewStringInputStream();
16898 test_ret += test_xmlNextChar();
16899 test_ret += test_xmlParserInputShrink();
16900 test_ret += test_xmlPopInput();
16901 test_ret += test_xmlPushInput();
16902 test_ret += test_xmlSetEntityReferenceFunc();
16903 test_ret += test_xmlSplitQName();
16904 test_ret += test_xmlStringCurrentChar();
16905 test_ret += test_xmlStringDecodeEntities();
16906 test_ret += test_xmlStringLenDecodeEntities();
16907 test_ret += test_xmlSwitchEncoding();
16908 test_ret += test_xmlSwitchInputEncoding();
16909 test_ret += test_xmlSwitchToEncoding();
16910
16911 if (test_ret != 0)
16912 printf("Module parserInternals: %d errors\n", test_ret);
16913 return(test_ret);
16914}
16915
Daniel Veillardd93f6252004-11-02 15:53:51 +000016916static int
16917test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016919
Daniel Veillardce682bc2004-11-05 17:22:25 +000016920#ifdef LIBXML_PATTERN_ENABLED
16921 int mem_base;
16922 int ret_val;
16923 xmlPatternPtr comp; /* the precompiled pattern */
16924 int n_comp;
16925 xmlNodePtr node; /* a node */
16926 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016927
Daniel Veillardce682bc2004-11-05 17:22:25 +000016928 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16929 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16930 mem_base = xmlMemBlocks();
16931 comp = gen_xmlPatternPtr(n_comp, 0);
16932 node = gen_xmlNodePtr(n_node, 1);
16933
16934 ret_val = xmlPatternMatch(comp, node);
16935 desret_int(ret_val);
16936 call_tests++;
16937 des_xmlPatternPtr(n_comp, comp, 0);
16938 des_xmlNodePtr(n_node, node, 1);
16939 xmlResetLastError();
16940 if (mem_base != xmlMemBlocks()) {
16941 printf("Leak of %d blocks found in xmlPatternMatch",
16942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016943 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016944 printf(" %d", n_comp);
16945 printf(" %d", n_node);
16946 printf("\n");
16947 }
16948 }
16949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016950 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016951#endif
16952
Daniel Veillard42595322004-11-08 10:52:06 +000016953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016954}
16955
16956
16957static int
16958test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016960
16961
16962 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016964}
16965
16966static int
16967test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016969
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016970 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016971 test_ret += test_xmlPatternMatch();
16972 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016973
Daniel Veillard42595322004-11-08 10:52:06 +000016974 if (test_ret != 0)
16975 printf("Module pattern: %d errors\n", test_ret);
16976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016977}
Daniel Veillarda521d282004-11-09 14:59:59 +000016978#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016979
Daniel Veillardce682bc2004-11-05 17:22:25 +000016980#define gen_nb_xmlRelaxNGPtr 1
16981static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16982 return(NULL);
16983}
16984static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16985}
Daniel Veillarda521d282004-11-09 14:59:59 +000016986#endif
16987
Daniel Veillardce682bc2004-11-05 17:22:25 +000016988
Daniel Veillardd93f6252004-11-02 15:53:51 +000016989static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016990test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016992
Daniel Veillardce682bc2004-11-05 17:22:25 +000016993#ifdef LIBXML_SCHEMAS_ENABLED
16994#ifdef LIBXML_OUTPUT_ENABLED
16995 int mem_base;
16996 FILE * output; /* the file output */
16997 int n_output;
16998 xmlRelaxNGPtr schema; /* a schema structure */
16999 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017000
Daniel Veillardce682bc2004-11-05 17:22:25 +000017001 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
17002 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
17003 mem_base = xmlMemBlocks();
17004 output = gen_FILE_ptr(n_output, 0);
17005 schema = gen_xmlRelaxNGPtr(n_schema, 1);
17006
17007 xmlRelaxNGDump(output, schema);
17008 call_tests++;
17009 des_FILE_ptr(n_output, output, 0);
17010 des_xmlRelaxNGPtr(n_schema, schema, 1);
17011 xmlResetLastError();
17012 if (mem_base != xmlMemBlocks()) {
17013 printf("Leak of %d blocks found in xmlRelaxNGDump",
17014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017015 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017016 printf(" %d", n_output);
17017 printf(" %d", n_schema);
17018 printf("\n");
17019 }
17020 }
17021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017022 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017023#endif
17024#endif
17025
Daniel Veillard42595322004-11-08 10:52:06 +000017026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017027}
17028
17029
17030static int
17031test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017033
Daniel Veillardce682bc2004-11-05 17:22:25 +000017034#ifdef LIBXML_SCHEMAS_ENABLED
17035#ifdef LIBXML_OUTPUT_ENABLED
17036 int mem_base;
17037 FILE * output; /* the file output */
17038 int n_output;
17039 xmlRelaxNGPtr schema; /* a schema structure */
17040 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017041
Daniel Veillardce682bc2004-11-05 17:22:25 +000017042 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
17043 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
17044 mem_base = xmlMemBlocks();
17045 output = gen_FILE_ptr(n_output, 0);
17046 schema = gen_xmlRelaxNGPtr(n_schema, 1);
17047
17048 xmlRelaxNGDumpTree(output, schema);
17049 call_tests++;
17050 des_FILE_ptr(n_output, output, 0);
17051 des_xmlRelaxNGPtr(n_schema, schema, 1);
17052 xmlResetLastError();
17053 if (mem_base != xmlMemBlocks()) {
17054 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
17055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017056 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017057 printf(" %d", n_output);
17058 printf(" %d", n_schema);
17059 printf("\n");
17060 }
17061 }
17062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017063 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017064#endif
17065#endif
17066
Daniel Veillard42595322004-11-08 10:52:06 +000017067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017068}
17069
Daniel Veillarda521d282004-11-09 14:59:59 +000017070#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017071
Daniel Veillardce682bc2004-11-05 17:22:25 +000017072#define gen_nb_xmlRelaxNGParserCtxtPtr 1
17073static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17074 return(NULL);
17075}
17076static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17077}
Daniel Veillarda521d282004-11-09 14:59:59 +000017078#endif
17079
17080#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017081
17082#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
17083static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17084 return(NULL);
17085}
17086static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17087}
Daniel Veillarda521d282004-11-09 14:59:59 +000017088#endif
17089
17090#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017091
17092#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17093static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17094 return(NULL);
17095}
17096static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17097}
Daniel Veillarda521d282004-11-09 14:59:59 +000017098#endif
17099
17100#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017101
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017102#define gen_nb_void_ptr_ptr 1
17103static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17104 return(NULL);
17105}
17106static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17107}
Daniel Veillarda521d282004-11-09 14:59:59 +000017108#endif
17109
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017110
Daniel Veillardd93f6252004-11-02 15:53:51 +000017111static int
17112test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017114
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017115#ifdef LIBXML_SCHEMAS_ENABLED
17116 int mem_base;
17117 int ret_val;
17118 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17119 int n_ctxt;
17120 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17121 int n_err;
17122 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17123 int n_warn;
17124 void ** ctx; /* contextual data for the callbacks result */
17125 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017126
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017127 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17128 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17129 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17130 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17131 mem_base = xmlMemBlocks();
17132 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17133 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17134 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17135 ctx = gen_void_ptr_ptr(n_ctx, 3);
17136
17137 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17138 desret_int(ret_val);
17139 call_tests++;
17140 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17141 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17142 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17143 des_void_ptr_ptr(n_ctx, ctx, 3);
17144 xmlResetLastError();
17145 if (mem_base != xmlMemBlocks()) {
17146 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017148 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017149 printf(" %d", n_ctxt);
17150 printf(" %d", n_err);
17151 printf(" %d", n_warn);
17152 printf(" %d", n_ctx);
17153 printf("\n");
17154 }
17155 }
17156 }
17157 }
17158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017159 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017160#endif
17161
Daniel Veillard42595322004-11-08 10:52:06 +000017162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017163}
17164
Daniel Veillarda521d282004-11-09 14:59:59 +000017165#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017166
Daniel Veillardce682bc2004-11-05 17:22:25 +000017167#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17168static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17169 return(NULL);
17170}
17171static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17172}
Daniel Veillarda521d282004-11-09 14:59:59 +000017173#endif
17174
Daniel Veillardce682bc2004-11-05 17:22:25 +000017175
Daniel Veillardd93f6252004-11-02 15:53:51 +000017176static int
17177test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017179
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017180#ifdef LIBXML_SCHEMAS_ENABLED
17181 int mem_base;
17182 int ret_val;
17183 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17184 int n_ctxt;
17185 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17186 int n_err;
17187 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17188 int n_warn;
17189 void ** ctx; /* the functions context result */
17190 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017191
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017192 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17193 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17194 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17195 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17196 mem_base = xmlMemBlocks();
17197 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17198 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17199 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17200 ctx = gen_void_ptr_ptr(n_ctx, 3);
17201
17202 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17203 desret_int(ret_val);
17204 call_tests++;
17205 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17206 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17207 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17208 des_void_ptr_ptr(n_ctx, ctx, 3);
17209 xmlResetLastError();
17210 if (mem_base != xmlMemBlocks()) {
17211 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017213 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017214 printf(" %d", n_ctxt);
17215 printf(" %d", n_err);
17216 printf(" %d", n_warn);
17217 printf(" %d", n_ctx);
17218 printf("\n");
17219 }
17220 }
17221 }
17222 }
17223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017224 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017225#endif
17226
Daniel Veillard42595322004-11-08 10:52:06 +000017227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017228}
17229
17230
17231static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017232test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017233 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017234
17235#ifdef LIBXML_SCHEMAS_ENABLED
17236 int mem_base;
17237 int ret_val;
17238
17239 mem_base = xmlMemBlocks();
17240
17241 ret_val = xmlRelaxNGInitTypes();
17242 desret_int(ret_val);
17243 call_tests++;
17244 xmlResetLastError();
17245 if (mem_base != xmlMemBlocks()) {
17246 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017248 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017249 printf("\n");
17250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017251 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017252#endif
17253
Daniel Veillard42595322004-11-08 10:52:06 +000017254 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017255}
17256
17257
17258static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017259test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017261
Daniel Veillard42595322004-11-08 10:52:06 +000017262#ifdef LIBXML_SCHEMAS_ENABLED
17263 int mem_base;
17264 xmlRelaxNGParserCtxtPtr ret_val;
17265 xmlDocPtr doc; /* a preparsed document tree */
17266 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017267
Daniel Veillard42595322004-11-08 10:52:06 +000017268 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17269 mem_base = xmlMemBlocks();
17270 doc = gen_xmlDocPtr(n_doc, 0);
17271
17272 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17273 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17274 call_tests++;
17275 des_xmlDocPtr(n_doc, doc, 0);
17276 xmlResetLastError();
17277 if (mem_base != xmlMemBlocks()) {
17278 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17279 xmlMemBlocks() - mem_base);
17280 test_ret++;
17281 printf(" %d", n_doc);
17282 printf("\n");
17283 }
17284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017285 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017286#endif
17287
Daniel Veillard42595322004-11-08 10:52:06 +000017288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017289}
17290
17291
17292static int
17293test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017295
Daniel Veillard42595322004-11-08 10:52:06 +000017296#ifdef LIBXML_SCHEMAS_ENABLED
17297 int mem_base;
17298 xmlRelaxNGParserCtxtPtr ret_val;
17299 char * buffer; /* a pointer to a char array containing the schemas */
17300 int n_buffer;
17301 int size; /* the size of the array */
17302 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017303
Daniel Veillard42595322004-11-08 10:52:06 +000017304 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17305 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17306 mem_base = xmlMemBlocks();
17307 buffer = gen_const_char_ptr(n_buffer, 0);
17308 size = gen_int(n_size, 1);
17309
William M. Brackf13f77f2004-11-12 16:03:48 +000017310 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017311 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17312 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017313 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017314 des_int(n_size, size, 1);
17315 xmlResetLastError();
17316 if (mem_base != xmlMemBlocks()) {
17317 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17318 xmlMemBlocks() - mem_base);
17319 test_ret++;
17320 printf(" %d", n_buffer);
17321 printf(" %d", n_size);
17322 printf("\n");
17323 }
17324 }
17325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017326 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017327#endif
17328
Daniel Veillard42595322004-11-08 10:52:06 +000017329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017330}
17331
17332
17333static int
17334test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017336
Daniel Veillard42595322004-11-08 10:52:06 +000017337#ifdef LIBXML_SCHEMAS_ENABLED
17338 int mem_base;
17339 xmlRelaxNGParserCtxtPtr ret_val;
17340 char * URL; /* the location of the schema */
17341 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017342
Daniel Veillard42595322004-11-08 10:52:06 +000017343 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17344 mem_base = xmlMemBlocks();
17345 URL = gen_const_char_ptr(n_URL, 0);
17346
William M. Brackf13f77f2004-11-12 16:03:48 +000017347 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017348 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17349 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017350 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017351 xmlResetLastError();
17352 if (mem_base != xmlMemBlocks()) {
17353 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17354 xmlMemBlocks() - mem_base);
17355 test_ret++;
17356 printf(" %d", n_URL);
17357 printf("\n");
17358 }
17359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017360 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017361#endif
17362
Daniel Veillard42595322004-11-08 10:52:06 +000017363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017364}
17365
17366
17367static int
17368test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017370
17371
17372 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017374}
17375
17376
17377static int
17378test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017380
17381
17382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017384}
17385
17386
17387static int
17388test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017390
17391
17392 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017394}
17395
17396
17397static int
17398test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017400
17401
17402 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017404}
17405
17406
17407static int
17408test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017410
Daniel Veillardce682bc2004-11-05 17:22:25 +000017411#ifdef LIBXML_SCHEMAS_ENABLED
17412 int mem_base;
17413 int ret_val;
17414 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17415 int n_ctxt;
17416 xmlDocPtr doc; /* a parsed document tree */
17417 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017418
Daniel Veillardce682bc2004-11-05 17:22:25 +000017419 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17420 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17421 mem_base = xmlMemBlocks();
17422 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17423 doc = gen_xmlDocPtr(n_doc, 1);
17424
17425 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17426 desret_int(ret_val);
17427 call_tests++;
17428 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17429 des_xmlDocPtr(n_doc, doc, 1);
17430 xmlResetLastError();
17431 if (mem_base != xmlMemBlocks()) {
17432 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017434 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017435 printf(" %d", n_ctxt);
17436 printf(" %d", n_doc);
17437 printf("\n");
17438 }
17439 }
17440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017441 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017442#endif
17443
Daniel Veillard42595322004-11-08 10:52:06 +000017444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017445}
17446
17447
17448static int
17449test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017451
Daniel Veillardce682bc2004-11-05 17:22:25 +000017452#ifdef LIBXML_SCHEMAS_ENABLED
17453 int mem_base;
17454 int ret_val;
17455 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17456 int n_ctxt;
17457 xmlDocPtr doc; /* a document instance */
17458 int n_doc;
17459 xmlNodePtr elem; /* an element instance */
17460 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017461
Daniel Veillardce682bc2004-11-05 17:22:25 +000017462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17463 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17464 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17465 mem_base = xmlMemBlocks();
17466 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17467 doc = gen_xmlDocPtr(n_doc, 1);
17468 elem = gen_xmlNodePtr(n_elem, 2);
17469
17470 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17471 desret_int(ret_val);
17472 call_tests++;
17473 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17474 des_xmlDocPtr(n_doc, doc, 1);
17475 des_xmlNodePtr(n_elem, elem, 2);
17476 xmlResetLastError();
17477 if (mem_base != xmlMemBlocks()) {
17478 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017481 printf(" %d", n_ctxt);
17482 printf(" %d", n_doc);
17483 printf(" %d", n_elem);
17484 printf("\n");
17485 }
17486 }
17487 }
17488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017489 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017490#endif
17491
Daniel Veillard42595322004-11-08 10:52:06 +000017492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017493}
17494
17495
17496static int
17497test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017499
Daniel Veillardce682bc2004-11-05 17:22:25 +000017500#ifdef LIBXML_SCHEMAS_ENABLED
17501 int mem_base;
17502 int ret_val;
17503 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17504 int n_ctxt;
17505 xmlDocPtr doc; /* a document instance */
17506 int n_doc;
17507 xmlNodePtr elem; /* an element instance */
17508 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017509
Daniel Veillardce682bc2004-11-05 17:22:25 +000017510 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17511 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17512 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17513 mem_base = xmlMemBlocks();
17514 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17515 doc = gen_xmlDocPtr(n_doc, 1);
17516 elem = gen_xmlNodePtr(n_elem, 2);
17517
17518 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17519 desret_int(ret_val);
17520 call_tests++;
17521 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17522 des_xmlDocPtr(n_doc, doc, 1);
17523 des_xmlNodePtr(n_elem, elem, 2);
17524 xmlResetLastError();
17525 if (mem_base != xmlMemBlocks()) {
17526 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017528 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017529 printf(" %d", n_ctxt);
17530 printf(" %d", n_doc);
17531 printf(" %d", n_elem);
17532 printf("\n");
17533 }
17534 }
17535 }
17536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017537 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017538#endif
17539
Daniel Veillard42595322004-11-08 10:52:06 +000017540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017541}
17542
17543
17544static int
17545test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017547
Daniel Veillardce682bc2004-11-05 17:22:25 +000017548#ifdef LIBXML_SCHEMAS_ENABLED
17549 int mem_base;
17550 int ret_val;
17551 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17552 int n_ctxt;
17553 xmlChar * data; /* some character data read */
17554 int n_data;
17555 int len; /* the lenght of the data */
17556 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017557
Daniel Veillardce682bc2004-11-05 17:22:25 +000017558 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17559 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17560 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17561 mem_base = xmlMemBlocks();
17562 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17563 data = gen_const_xmlChar_ptr(n_data, 1);
17564 len = gen_int(n_len, 2);
17565
William M. Brackf13f77f2004-11-12 16:03:48 +000017566 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017567 desret_int(ret_val);
17568 call_tests++;
17569 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017570 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017571 des_int(n_len, len, 2);
17572 xmlResetLastError();
17573 if (mem_base != xmlMemBlocks()) {
17574 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017576 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017577 printf(" %d", n_ctxt);
17578 printf(" %d", n_data);
17579 printf(" %d", n_len);
17580 printf("\n");
17581 }
17582 }
17583 }
17584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017585 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017586#endif
17587
Daniel Veillard42595322004-11-08 10:52:06 +000017588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017589}
17590
17591
17592static int
17593test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017595
Daniel Veillardce682bc2004-11-05 17:22:25 +000017596#ifdef LIBXML_SCHEMAS_ENABLED
17597 int mem_base;
17598 int ret_val;
17599 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17600 int n_ctxt;
17601 xmlDocPtr doc; /* a document instance */
17602 int n_doc;
17603 xmlNodePtr elem; /* an element instance */
17604 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017605
Daniel Veillardce682bc2004-11-05 17:22:25 +000017606 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17607 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17608 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17609 mem_base = xmlMemBlocks();
17610 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17611 doc = gen_xmlDocPtr(n_doc, 1);
17612 elem = gen_xmlNodePtr(n_elem, 2);
17613
17614 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17615 desret_int(ret_val);
17616 call_tests++;
17617 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17618 des_xmlDocPtr(n_doc, doc, 1);
17619 des_xmlNodePtr(n_elem, elem, 2);
17620 xmlResetLastError();
17621 if (mem_base != xmlMemBlocks()) {
17622 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017624 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017625 printf(" %d", n_ctxt);
17626 printf(" %d", n_doc);
17627 printf(" %d", n_elem);
17628 printf("\n");
17629 }
17630 }
17631 }
17632 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017633 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017634#endif
17635
Daniel Veillard42595322004-11-08 10:52:06 +000017636 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017637}
17638
17639
17640static int
17641test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017642 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017643
Daniel Veillardce682bc2004-11-05 17:22:25 +000017644#ifdef LIBXML_SCHEMAS_ENABLED
17645 int mem_base;
17646 int ret_val;
17647 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17648 int n_ctxt;
17649 int flags; /* a set of flags values */
17650 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017651
Daniel Veillardce682bc2004-11-05 17:22:25 +000017652 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17653 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17654 mem_base = xmlMemBlocks();
17655 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17656 flags = gen_int(n_flags, 1);
17657
17658 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17659 desret_int(ret_val);
17660 call_tests++;
17661 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17662 des_int(n_flags, flags, 1);
17663 xmlResetLastError();
17664 if (mem_base != xmlMemBlocks()) {
17665 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017667 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017668 printf(" %d", n_ctxt);
17669 printf(" %d", n_flags);
17670 printf("\n");
17671 }
17672 }
17673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017674 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017675#endif
17676
Daniel Veillard42595322004-11-08 10:52:06 +000017677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017678}
17679
17680static int
17681test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017683
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017684 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017685 test_ret += test_xmlRelaxNGDump();
17686 test_ret += test_xmlRelaxNGDumpTree();
17687 test_ret += test_xmlRelaxNGGetParserErrors();
17688 test_ret += test_xmlRelaxNGGetValidErrors();
17689 test_ret += test_xmlRelaxNGInitTypes();
17690 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17691 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17692 test_ret += test_xmlRelaxNGNewParserCtxt();
17693 test_ret += test_xmlRelaxNGNewValidCtxt();
17694 test_ret += test_xmlRelaxNGParse();
17695 test_ret += test_xmlRelaxNGSetParserErrors();
17696 test_ret += test_xmlRelaxNGSetValidErrors();
17697 test_ret += test_xmlRelaxNGValidateDoc();
17698 test_ret += test_xmlRelaxNGValidateFullElement();
17699 test_ret += test_xmlRelaxNGValidatePopElement();
17700 test_ret += test_xmlRelaxNGValidatePushCData();
17701 test_ret += test_xmlRelaxNGValidatePushElement();
17702 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017703
Daniel Veillard42595322004-11-08 10:52:06 +000017704 if (test_ret != 0)
17705 printf("Module relaxng: %d errors\n", test_ret);
17706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017707}
17708static int
17709test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017711
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017712 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017713
Daniel Veillard42595322004-11-08 10:52:06 +000017714 if (test_ret != 0)
17715 printf("Module schemasInternals: %d errors\n", test_ret);
17716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017717}
17718
17719static int
17720test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017722
17723 int mem_base;
17724 xmlNodePtr ret_val;
17725 xmlNodePtr parent; /* the parent node */
17726 int n_parent;
17727 xmlNodePtr cur; /* the child node */
17728 int n_cur;
17729
Daniel Veillarda03e3652004-11-02 18:45:30 +000017730 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017731 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17732 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017733 parent = gen_xmlNodePtr(n_parent, 0);
17734 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735
17736 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017737 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017738 desret_xmlNodePtr(ret_val);
17739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017740 des_xmlNodePtr(n_parent, parent, 0);
17741 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017742 xmlResetLastError();
17743 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017744 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017746 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017747 printf(" %d", n_parent);
17748 printf(" %d", n_cur);
17749 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017750 }
17751 }
17752 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017753 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017754
Daniel Veillard42595322004-11-08 10:52:06 +000017755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017756}
17757
17758
17759static int
17760test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017762
17763 int mem_base;
17764 xmlNodePtr ret_val;
17765 xmlNodePtr parent; /* the parent node */
17766 int n_parent;
17767 xmlNodePtr cur; /* the first node in the list */
17768 int n_cur;
17769
Daniel Veillarda03e3652004-11-02 18:45:30 +000017770 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017771 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17772 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017773 parent = gen_xmlNodePtr(n_parent, 0);
17774 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017775
17776 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017777 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017778 desret_xmlNodePtr(ret_val);
17779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017780 des_xmlNodePtr(n_parent, parent, 0);
17781 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017782 xmlResetLastError();
17783 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017784 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017786 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017787 printf(" %d", n_parent);
17788 printf(" %d", n_cur);
17789 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017790 }
17791 }
17792 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017793 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017794
Daniel Veillard42595322004-11-08 10:52:06 +000017795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017796}
17797
17798
17799static int
17800test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017802
17803 int mem_base;
17804 xmlNodePtr ret_val;
17805 xmlNodePtr cur; /* the child node */
17806 int n_cur;
17807 xmlNodePtr elem; /* the new node */
17808 int n_elem;
17809
17810 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017811 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017813 cur = gen_xmlNodePtr(n_cur, 0);
17814 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017815
17816 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017817 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017818 desret_xmlNodePtr(ret_val);
17819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017820 des_xmlNodePtr(n_cur, cur, 0);
17821 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017822 xmlResetLastError();
17823 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017824 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017826 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017827 printf(" %d", n_cur);
17828 printf(" %d", n_elem);
17829 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017830 }
17831 }
17832 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017833 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017834
Daniel Veillard42595322004-11-08 10:52:06 +000017835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017836}
17837
17838
17839static int
17840test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017842
17843#ifdef LIBXML_TREE_ENABLED
17844 int mem_base;
17845 xmlNodePtr ret_val;
17846 xmlNodePtr cur; /* the child node */
17847 int n_cur;
17848 xmlNodePtr elem; /* the new node */
17849 int n_elem;
17850
17851 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017852 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017853 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017854 cur = gen_xmlNodePtr(n_cur, 0);
17855 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017856
17857 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017858 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017859 desret_xmlNodePtr(ret_val);
17860 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017861 des_xmlNodePtr(n_cur, cur, 0);
17862 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017863 xmlResetLastError();
17864 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017865 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017867 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017868 printf(" %d", n_cur);
17869 printf(" %d", n_elem);
17870 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017871 }
17872 }
17873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017874 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017875#endif
17876
Daniel Veillard42595322004-11-08 10:52:06 +000017877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017878}
17879
17880
17881static int
17882test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017884
17885 int mem_base;
17886 xmlNodePtr ret_val;
17887 xmlNodePtr cur; /* the child node */
17888 int n_cur;
17889 xmlNodePtr elem; /* the new node */
17890 int n_elem;
17891
17892 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017893 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017895 cur = gen_xmlNodePtr(n_cur, 0);
17896 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017897
17898 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017899 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017900 desret_xmlNodePtr(ret_val);
17901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017902 des_xmlNodePtr(n_cur, cur, 0);
17903 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017904 xmlResetLastError();
17905 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017906 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017908 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017909 printf(" %d", n_cur);
17910 printf(" %d", n_elem);
17911 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017912 }
17913 }
17914 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017915 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017916
Daniel Veillard42595322004-11-08 10:52:06 +000017917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017918}
17919
17920
17921static int
17922test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017924
Daniel Veillarda521d282004-11-09 14:59:59 +000017925#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017926 int mem_base;
17927 xmlBufferPtr buf; /* the XML buffer output */
17928 int n_buf;
17929 xmlDocPtr doc; /* the document */
17930 int n_doc;
17931 xmlAttrPtr attr; /* the attribute node */
17932 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017933 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017934 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017935
Daniel Veillardce244ad2004-11-05 10:03:46 +000017936 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17937 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17938 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17939 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17940 mem_base = xmlMemBlocks();
17941 buf = gen_xmlBufferPtr(n_buf, 0);
17942 doc = gen_xmlDocPtr(n_doc, 1);
17943 attr = gen_xmlAttrPtr(n_attr, 2);
17944 string = gen_const_xmlChar_ptr(n_string, 3);
17945
William M. Brackf13f77f2004-11-12 16:03:48 +000017946 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017947 call_tests++;
17948 des_xmlBufferPtr(n_buf, buf, 0);
17949 des_xmlDocPtr(n_doc, doc, 1);
17950 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017951 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017952 xmlResetLastError();
17953 if (mem_base != xmlMemBlocks()) {
17954 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017956 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017957 printf(" %d", n_buf);
17958 printf(" %d", n_doc);
17959 printf(" %d", n_attr);
17960 printf(" %d", n_string);
17961 printf("\n");
17962 }
17963 }
17964 }
17965 }
17966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017967 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017968#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017969
Daniel Veillard42595322004-11-08 10:52:06 +000017970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017971}
17972
17973
17974static int
17975test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017977
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017978 int mem_base;
17979 int ret_val;
17980 xmlBufferPtr buf; /* the buffer to dump */
17981 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017982 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017983 int n_str;
17984 int len; /* the number of #xmlChar to add */
17985 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017986
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017987 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17988 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17989 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017991 buf = gen_xmlBufferPtr(n_buf, 0);
17992 str = gen_const_xmlChar_ptr(n_str, 1);
17993 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017994
William M. Brackf13f77f2004-11-12 16:03:48 +000017995 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017996 desret_int(ret_val);
17997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017998 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017999 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018000 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018001 xmlResetLastError();
18002 if (mem_base != xmlMemBlocks()) {
18003 printf("Leak of %d blocks found in xmlBufferAdd",
18004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018005 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018006 printf(" %d", n_buf);
18007 printf(" %d", n_str);
18008 printf(" %d", n_len);
18009 printf("\n");
18010 }
18011 }
18012 }
18013 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018015
Daniel Veillard42595322004-11-08 10:52:06 +000018016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018017}
18018
18019
18020static int
18021test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018023
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018024 int mem_base;
18025 int ret_val;
18026 xmlBufferPtr buf; /* the buffer */
18027 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018028 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018029 int n_str;
18030 int len; /* the number of #xmlChar to add */
18031 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018032
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018033 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18034 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18035 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18036 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018037 buf = gen_xmlBufferPtr(n_buf, 0);
18038 str = gen_const_xmlChar_ptr(n_str, 1);
18039 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018040
William M. Brackf13f77f2004-11-12 16:03:48 +000018041 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018042 desret_int(ret_val);
18043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018044 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018045 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018046 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018047 xmlResetLastError();
18048 if (mem_base != xmlMemBlocks()) {
18049 printf("Leak of %d blocks found in xmlBufferAddHead",
18050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018051 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018052 printf(" %d", n_buf);
18053 printf(" %d", n_str);
18054 printf(" %d", n_len);
18055 printf("\n");
18056 }
18057 }
18058 }
18059 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018060 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018061
Daniel Veillard42595322004-11-08 10:52:06 +000018062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018063}
18064
18065
18066static int
18067test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018069
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018070 int mem_base;
18071 int ret_val;
18072 xmlBufferPtr buf; /* the buffer to dump */
18073 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018074 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018075 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018076
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018077 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18078 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
18079 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018080 buf = gen_xmlBufferPtr(n_buf, 0);
18081 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018082
William M. Brackf13f77f2004-11-12 16:03:48 +000018083 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018084 desret_int(ret_val);
18085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018086 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018087 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018088 xmlResetLastError();
18089 if (mem_base != xmlMemBlocks()) {
18090 printf("Leak of %d blocks found in xmlBufferCCat",
18091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018092 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018093 printf(" %d", n_buf);
18094 printf(" %d", n_str);
18095 printf("\n");
18096 }
18097 }
18098 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018099 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018100
Daniel Veillard42595322004-11-08 10:52:06 +000018101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018102}
18103
18104
18105static int
18106test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018108
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018109 int mem_base;
18110 int ret_val;
18111 xmlBufferPtr buf; /* the buffer to add to */
18112 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018113 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018114 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018115
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018116 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18117 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18118 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018119 buf = gen_xmlBufferPtr(n_buf, 0);
18120 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018121
William M. Brackf13f77f2004-11-12 16:03:48 +000018122 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018123 desret_int(ret_val);
18124 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018125 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018126 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018127 xmlResetLastError();
18128 if (mem_base != xmlMemBlocks()) {
18129 printf("Leak of %d blocks found in xmlBufferCat",
18130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018131 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018132 printf(" %d", n_buf);
18133 printf(" %d", n_str);
18134 printf("\n");
18135 }
18136 }
18137 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018138 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018139
Daniel Veillard42595322004-11-08 10:52:06 +000018140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018141}
18142
18143
Daniel Veillardce682bc2004-11-05 17:22:25 +000018144#define gen_nb_const_xmlBufferPtr 1
18145static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18146 return(NULL);
18147}
18148static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18149}
18150
Daniel Veillardd93f6252004-11-02 15:53:51 +000018151static int
18152test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018154
Daniel Veillardce682bc2004-11-05 17:22:25 +000018155 int mem_base;
18156 const xmlChar * ret_val;
18157 xmlBufferPtr buf; /* the buffer */
18158 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018159
Daniel Veillardce682bc2004-11-05 17:22:25 +000018160 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18161 mem_base = xmlMemBlocks();
18162 buf = gen_const_xmlBufferPtr(n_buf, 0);
18163
William M. Brackf13f77f2004-11-12 16:03:48 +000018164 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018165 desret_const_xmlChar_ptr(ret_val);
18166 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018167 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018168 xmlResetLastError();
18169 if (mem_base != xmlMemBlocks()) {
18170 printf("Leak of %d blocks found in xmlBufferContent",
18171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018173 printf(" %d", n_buf);
18174 printf("\n");
18175 }
18176 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018178
Daniel Veillard42595322004-11-08 10:52:06 +000018179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018180}
18181
18182
18183static int
18184test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018186
Daniel Veillard3d95c732004-11-06 22:25:14 +000018187 int mem_base;
18188 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018189
Daniel Veillard3d95c732004-11-06 22:25:14 +000018190 mem_base = xmlMemBlocks();
18191
18192 ret_val = xmlBufferCreate();
18193 desret_xmlBufferPtr(ret_val);
18194 call_tests++;
18195 xmlResetLastError();
18196 if (mem_base != xmlMemBlocks()) {
18197 printf("Leak of %d blocks found in xmlBufferCreate",
18198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018199 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018200 printf("\n");
18201 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018202 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018203
Daniel Veillard42595322004-11-08 10:52:06 +000018204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018205}
18206
18207
18208static int
18209test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018211
18212
18213 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018215}
18216
18217
18218static int
18219test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018221
18222
18223 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018225}
18226
18227
18228static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018229test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018231
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018232 int mem_base;
18233 xmlBufferPtr buf; /* the buffer */
18234 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018235
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018236 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18237 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018238 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018239
18240 xmlBufferEmpty(buf);
18241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018242 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018243 xmlResetLastError();
18244 if (mem_base != xmlMemBlocks()) {
18245 printf("Leak of %d blocks found in xmlBufferEmpty",
18246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018247 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018248 printf(" %d", n_buf);
18249 printf("\n");
18250 }
18251 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018252 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018253
Daniel Veillard42595322004-11-08 10:52:06 +000018254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018255}
18256
18257
18258static int
18259test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018261
Daniel Veillard3d97e662004-11-04 10:49:00 +000018262 int mem_base;
18263 int ret_val;
18264 xmlBufferPtr buf; /* the buffer */
18265 int n_buf;
18266 unsigned int len; /* the minimum free size to allocate */
18267 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018268
Daniel Veillard3d97e662004-11-04 10:49:00 +000018269 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18270 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18271 mem_base = xmlMemBlocks();
18272 buf = gen_xmlBufferPtr(n_buf, 0);
18273 len = gen_unsigned_int(n_len, 1);
18274
18275 ret_val = xmlBufferGrow(buf, len);
18276 desret_int(ret_val);
18277 call_tests++;
18278 des_xmlBufferPtr(n_buf, buf, 0);
18279 des_unsigned_int(n_len, len, 1);
18280 xmlResetLastError();
18281 if (mem_base != xmlMemBlocks()) {
18282 printf("Leak of %d blocks found in xmlBufferGrow",
18283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018284 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018285 printf(" %d", n_buf);
18286 printf(" %d", n_len);
18287 printf("\n");
18288 }
18289 }
18290 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018291 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018292
Daniel Veillard42595322004-11-08 10:52:06 +000018293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018294}
18295
18296
18297static int
18298test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018300
Daniel Veillardce682bc2004-11-05 17:22:25 +000018301 int mem_base;
18302 int ret_val;
18303 xmlBufferPtr buf; /* the buffer */
18304 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018305
Daniel Veillardce682bc2004-11-05 17:22:25 +000018306 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18307 mem_base = xmlMemBlocks();
18308 buf = gen_const_xmlBufferPtr(n_buf, 0);
18309
William M. Brackf13f77f2004-11-12 16:03:48 +000018310 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018311 desret_int(ret_val);
18312 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018313 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018314 xmlResetLastError();
18315 if (mem_base != xmlMemBlocks()) {
18316 printf("Leak of %d blocks found in xmlBufferLength",
18317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018318 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018319 printf(" %d", n_buf);
18320 printf("\n");
18321 }
18322 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018323 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018324
Daniel Veillard42595322004-11-08 10:52:06 +000018325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018326}
18327
18328
18329static int
18330test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018332
Daniel Veillard3d97e662004-11-04 10:49:00 +000018333 int mem_base;
18334 int ret_val;
18335 xmlBufferPtr buf; /* the buffer to resize */
18336 int n_buf;
18337 unsigned int size; /* the desired size */
18338 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018339
Daniel Veillard3d97e662004-11-04 10:49:00 +000018340 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18341 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18342 mem_base = xmlMemBlocks();
18343 buf = gen_xmlBufferPtr(n_buf, 0);
18344 size = gen_unsigned_int(n_size, 1);
18345
18346 ret_val = xmlBufferResize(buf, size);
18347 desret_int(ret_val);
18348 call_tests++;
18349 des_xmlBufferPtr(n_buf, buf, 0);
18350 des_unsigned_int(n_size, size, 1);
18351 xmlResetLastError();
18352 if (mem_base != xmlMemBlocks()) {
18353 printf("Leak of %d blocks found in xmlBufferResize",
18354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018355 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018356 printf(" %d", n_buf);
18357 printf(" %d", n_size);
18358 printf("\n");
18359 }
18360 }
18361 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018362 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018363
Daniel Veillard42595322004-11-08 10:52:06 +000018364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018365}
18366
18367
18368static int
18369test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018371
Daniel Veillard57b25162004-11-06 14:50:18 +000018372 int mem_base;
18373 xmlBufferPtr buf; /* the buffer to tune */
18374 int n_buf;
18375 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18376 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018377
Daniel Veillard57b25162004-11-06 14:50:18 +000018378 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18379 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18380 mem_base = xmlMemBlocks();
18381 buf = gen_xmlBufferPtr(n_buf, 0);
18382 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18383
18384 xmlBufferSetAllocationScheme(buf, scheme);
18385 call_tests++;
18386 des_xmlBufferPtr(n_buf, buf, 0);
18387 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18388 xmlResetLastError();
18389 if (mem_base != xmlMemBlocks()) {
18390 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018392 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018393 printf(" %d", n_buf);
18394 printf(" %d", n_scheme);
18395 printf("\n");
18396 }
18397 }
18398 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018399 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018400
Daniel Veillard42595322004-11-08 10:52:06 +000018401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018402}
18403
18404
18405static int
18406test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018408
Daniel Veillard3d97e662004-11-04 10:49:00 +000018409 int mem_base;
18410 int ret_val;
18411 xmlBufferPtr buf; /* the buffer to dump */
18412 int n_buf;
18413 unsigned int len; /* the number of xmlChar to remove */
18414 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018415
Daniel Veillard3d97e662004-11-04 10:49:00 +000018416 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18417 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18418 mem_base = xmlMemBlocks();
18419 buf = gen_xmlBufferPtr(n_buf, 0);
18420 len = gen_unsigned_int(n_len, 1);
18421
18422 ret_val = xmlBufferShrink(buf, len);
18423 desret_int(ret_val);
18424 call_tests++;
18425 des_xmlBufferPtr(n_buf, buf, 0);
18426 des_unsigned_int(n_len, len, 1);
18427 xmlResetLastError();
18428 if (mem_base != xmlMemBlocks()) {
18429 printf("Leak of %d blocks found in xmlBufferShrink",
18430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018431 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018432 printf(" %d", n_buf);
18433 printf(" %d", n_len);
18434 printf("\n");
18435 }
18436 }
18437 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018438 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018439
Daniel Veillard42595322004-11-08 10:52:06 +000018440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018441}
18442
18443
18444static int
18445test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018447
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018448 int mem_base;
18449 xmlBufferPtr buf; /* the XML buffer */
18450 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018451 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018452 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018453
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018454 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18455 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18456 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018457 buf = gen_xmlBufferPtr(n_buf, 0);
18458 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018459
William M. Brackf13f77f2004-11-12 16:03:48 +000018460 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018462 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018463 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018464 xmlResetLastError();
18465 if (mem_base != xmlMemBlocks()) {
18466 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018468 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018469 printf(" %d", n_buf);
18470 printf(" %d", n_string);
18471 printf("\n");
18472 }
18473 }
18474 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018475 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018476
Daniel Veillard42595322004-11-08 10:52:06 +000018477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018478}
18479
18480
18481static int
18482test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018484
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018485 int mem_base;
18486 xmlBufferPtr buf; /* the XML buffer output */
18487 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018488 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018489 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018490
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018491 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18492 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18493 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018494 buf = gen_xmlBufferPtr(n_buf, 0);
18495 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018496
William M. Brackf13f77f2004-11-12 16:03:48 +000018497 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018498 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018499 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018500 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018501 xmlResetLastError();
18502 if (mem_base != xmlMemBlocks()) {
18503 printf("Leak of %d blocks found in xmlBufferWriteChar",
18504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018505 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018506 printf(" %d", n_buf);
18507 printf(" %d", n_string);
18508 printf("\n");
18509 }
18510 }
18511 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018513
Daniel Veillard42595322004-11-08 10:52:06 +000018514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018515}
18516
18517
18518static int
18519test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018521
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018522 int mem_base;
18523 xmlBufferPtr buf; /* the XML buffer output */
18524 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018525 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018526 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018527
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018528 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18529 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18530 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018531 buf = gen_xmlBufferPtr(n_buf, 0);
18532 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018533
William M. Brackf13f77f2004-11-12 16:03:48 +000018534 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018535 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018536 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018537 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018538 xmlResetLastError();
18539 if (mem_base != xmlMemBlocks()) {
18540 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018542 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018543 printf(" %d", n_buf);
18544 printf(" %d", n_string);
18545 printf("\n");
18546 }
18547 }
18548 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018549 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018550
Daniel Veillard42595322004-11-08 10:52:06 +000018551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018552}
18553
18554
18555static int
18556test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018558
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018559 int mem_base;
18560 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018561 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018562 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018563 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018564 int n_prefix;
18565 xmlChar * memory; /* preallocated memory */
18566 int n_memory;
18567 int len; /* preallocated memory length */
18568 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018569
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018570 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18571 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18572 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18573 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18574 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018575 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18576 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18577 memory = gen_xmlChar_ptr(n_memory, 2);
18578 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018579
William M. Brackf13f77f2004-11-12 16:03:48 +000018580 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018581 if ((ret_val != NULL) && (ret_val != ncname) &&
18582 (ret_val != prefix) && (ret_val != memory))
18583 xmlFree(ret_val);
18584 ret_val = NULL;
18585 desret_xmlChar_ptr(ret_val);
18586 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018587 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18588 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018589 des_xmlChar_ptr(n_memory, memory, 2);
18590 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018591 xmlResetLastError();
18592 if (mem_base != xmlMemBlocks()) {
18593 printf("Leak of %d blocks found in xmlBuildQName",
18594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018595 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018596 printf(" %d", n_ncname);
18597 printf(" %d", n_prefix);
18598 printf(" %d", n_memory);
18599 printf(" %d", n_len);
18600 printf("\n");
18601 }
18602 }
18603 }
18604 }
18605 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018606 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018607
Daniel Veillard42595322004-11-08 10:52:06 +000018608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018609}
18610
18611
18612static int
18613test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018615
18616#ifdef LIBXML_TREE_ENABLED
18617 int mem_base;
18618 xmlDocPtr ret_val;
18619 xmlDocPtr doc; /* the document */
18620 int n_doc;
18621 int recursive; /* if not zero do a recursive copy. */
18622 int n_recursive;
18623
18624 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18625 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018627 doc = gen_xmlDocPtr(n_doc, 0);
18628 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018629
18630 ret_val = xmlCopyDoc(doc, recursive);
18631 desret_xmlDocPtr(ret_val);
18632 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018633 des_xmlDocPtr(n_doc, doc, 0);
18634 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018635 xmlResetLastError();
18636 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018637 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018639 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018640 printf(" %d", n_doc);
18641 printf(" %d", n_recursive);
18642 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018643 }
18644 }
18645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018646 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018647#endif
18648
Daniel Veillard42595322004-11-08 10:52:06 +000018649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018650}
18651
18652
18653static int
18654test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018656
Daniel Veillard27f20102004-11-05 11:50:11 +000018657#ifdef LIBXML_TREE_ENABLED
18658 int mem_base;
18659 xmlDtdPtr ret_val;
18660 xmlDtdPtr dtd; /* the dtd */
18661 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018662
Daniel Veillard27f20102004-11-05 11:50:11 +000018663 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18664 mem_base = xmlMemBlocks();
18665 dtd = gen_xmlDtdPtr(n_dtd, 0);
18666
18667 ret_val = xmlCopyDtd(dtd);
18668 desret_xmlDtdPtr(ret_val);
18669 call_tests++;
18670 des_xmlDtdPtr(n_dtd, dtd, 0);
18671 xmlResetLastError();
18672 if (mem_base != xmlMemBlocks()) {
18673 printf("Leak of %d blocks found in xmlCopyDtd",
18674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018675 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018676 printf(" %d", n_dtd);
18677 printf("\n");
18678 }
18679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018680 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018681#endif
18682
Daniel Veillard42595322004-11-08 10:52:06 +000018683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018684}
18685
18686
18687static int
18688test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018690
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018691 int mem_base;
18692 xmlNsPtr ret_val;
18693 xmlNsPtr cur; /* the namespace */
18694 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018695
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018696 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18697 mem_base = xmlMemBlocks();
18698 cur = gen_xmlNsPtr(n_cur, 0);
18699
18700 ret_val = xmlCopyNamespace(cur);
18701 if (ret_val != NULL) xmlFreeNs(ret_val);
18702 desret_xmlNsPtr(ret_val);
18703 call_tests++;
18704 des_xmlNsPtr(n_cur, cur, 0);
18705 xmlResetLastError();
18706 if (mem_base != xmlMemBlocks()) {
18707 printf("Leak of %d blocks found in xmlCopyNamespace",
18708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018709 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018710 printf(" %d", n_cur);
18711 printf("\n");
18712 }
18713 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018714 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018715
Daniel Veillard42595322004-11-08 10:52:06 +000018716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018717}
18718
18719
18720static int
18721test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018723
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018724 int mem_base;
18725 xmlNsPtr ret_val;
18726 xmlNsPtr cur; /* the first namespace */
18727 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018728
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018729 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18730 mem_base = xmlMemBlocks();
18731 cur = gen_xmlNsPtr(n_cur, 0);
18732
18733 ret_val = xmlCopyNamespaceList(cur);
18734 if (ret_val != NULL) xmlFreeNsList(ret_val);
18735 desret_xmlNsPtr(ret_val);
18736 call_tests++;
18737 des_xmlNsPtr(n_cur, cur, 0);
18738 xmlResetLastError();
18739 if (mem_base != xmlMemBlocks()) {
18740 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018742 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018743 printf(" %d", n_cur);
18744 printf("\n");
18745 }
18746 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018747 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018748
Daniel Veillard42595322004-11-08 10:52:06 +000018749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018750}
18751
18752
18753static int
18754test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018756
Daniel Veillardce682bc2004-11-05 17:22:25 +000018757 int mem_base;
18758 xmlNodePtr ret_val;
18759 xmlNodePtr node; /* the node */
18760 int n_node;
18761 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18762 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018763
Daniel Veillardce682bc2004-11-05 17:22:25 +000018764 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18765 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18766 mem_base = xmlMemBlocks();
18767 node = gen_const_xmlNodePtr(n_node, 0);
18768 extended = gen_int(n_extended, 1);
18769
William M. Brackf13f77f2004-11-12 16:03:48 +000018770 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018771 desret_xmlNodePtr(ret_val);
18772 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018773 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018774 des_int(n_extended, extended, 1);
18775 xmlResetLastError();
18776 if (mem_base != xmlMemBlocks()) {
18777 printf("Leak of %d blocks found in xmlCopyNode",
18778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018779 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018780 printf(" %d", n_node);
18781 printf(" %d", n_extended);
18782 printf("\n");
18783 }
18784 }
18785 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018786 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018787
Daniel Veillard42595322004-11-08 10:52:06 +000018788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018789}
18790
18791
18792static int
18793test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018795
Daniel Veillardce682bc2004-11-05 17:22:25 +000018796 int mem_base;
18797 xmlNodePtr ret_val;
18798 xmlNodePtr node; /* the first node in the list. */
18799 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018800
Daniel Veillardce682bc2004-11-05 17:22:25 +000018801 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18802 mem_base = xmlMemBlocks();
18803 node = gen_const_xmlNodePtr(n_node, 0);
18804
William M. Brackf13f77f2004-11-12 16:03:48 +000018805 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018806 desret_xmlNodePtr(ret_val);
18807 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018808 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018809 xmlResetLastError();
18810 if (mem_base != xmlMemBlocks()) {
18811 printf("Leak of %d blocks found in xmlCopyNodeList",
18812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018813 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018814 printf(" %d", n_node);
18815 printf("\n");
18816 }
18817 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018818 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018819
Daniel Veillard42595322004-11-08 10:52:06 +000018820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018821}
18822
18823
18824static int
18825test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018827
Daniel Veillard57b25162004-11-06 14:50:18 +000018828 int mem_base;
18829 xmlAttrPtr ret_val;
18830 xmlNodePtr target; /* the element where the attribute will be grafted */
18831 int n_target;
18832 xmlAttrPtr cur; /* the attribute */
18833 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018834
Daniel Veillard57b25162004-11-06 14:50:18 +000018835 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18836 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18837 mem_base = xmlMemBlocks();
18838 target = gen_xmlNodePtr(n_target, 0);
18839 cur = gen_xmlAttrPtr(n_cur, 1);
18840
18841 ret_val = xmlCopyProp(target, cur);
18842 desret_xmlAttrPtr(ret_val);
18843 call_tests++;
18844 des_xmlNodePtr(n_target, target, 0);
18845 des_xmlAttrPtr(n_cur, cur, 1);
18846 xmlResetLastError();
18847 if (mem_base != xmlMemBlocks()) {
18848 printf("Leak of %d blocks found in xmlCopyProp",
18849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018850 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018851 printf(" %d", n_target);
18852 printf(" %d", n_cur);
18853 printf("\n");
18854 }
18855 }
18856 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018857 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018858
Daniel Veillard42595322004-11-08 10:52:06 +000018859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018860}
18861
18862
18863static int
18864test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018866
Daniel Veillard57b25162004-11-06 14:50:18 +000018867 int mem_base;
18868 xmlAttrPtr ret_val;
18869 xmlNodePtr target; /* the element where the attributes will be grafted */
18870 int n_target;
18871 xmlAttrPtr cur; /* the first attribute */
18872 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018873
Daniel Veillard57b25162004-11-06 14:50:18 +000018874 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18875 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18876 mem_base = xmlMemBlocks();
18877 target = gen_xmlNodePtr(n_target, 0);
18878 cur = gen_xmlAttrPtr(n_cur, 1);
18879
18880 ret_val = xmlCopyPropList(target, cur);
18881 desret_xmlAttrPtr(ret_val);
18882 call_tests++;
18883 des_xmlNodePtr(n_target, target, 0);
18884 des_xmlAttrPtr(n_cur, cur, 1);
18885 xmlResetLastError();
18886 if (mem_base != xmlMemBlocks()) {
18887 printf("Leak of %d blocks found in xmlCopyPropList",
18888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018889 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018890 printf(" %d", n_target);
18891 printf(" %d", n_cur);
18892 printf("\n");
18893 }
18894 }
18895 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018897
Daniel Veillard42595322004-11-08 10:52:06 +000018898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018899}
18900
18901
18902static int
18903test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018905
Daniel Veillard34099b42004-11-04 17:34:35 +000018906 int mem_base;
18907 xmlDtdPtr ret_val;
18908 xmlDocPtr doc; /* the document pointer */
18909 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018910 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018911 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018912 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018913 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018914 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018915 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018916
Daniel Veillard34099b42004-11-04 17:34:35 +000018917 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18918 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18919 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18920 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18921 mem_base = xmlMemBlocks();
18922 doc = gen_xmlDocPtr(n_doc, 0);
18923 name = gen_const_xmlChar_ptr(n_name, 1);
18924 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18925 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18926
William M. Brackf13f77f2004-11-12 16:03:48 +000018927 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018928 desret_xmlDtdPtr(ret_val);
18929 call_tests++;
18930 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018931 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18932 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18933 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018934 xmlResetLastError();
18935 if (mem_base != xmlMemBlocks()) {
18936 printf("Leak of %d blocks found in xmlCreateIntSubset",
18937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018938 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018939 printf(" %d", n_doc);
18940 printf(" %d", n_name);
18941 printf(" %d", n_ExternalID);
18942 printf(" %d", n_SystemID);
18943 printf("\n");
18944 }
18945 }
18946 }
18947 }
18948 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018950
Daniel Veillard42595322004-11-08 10:52:06 +000018951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018952}
18953
18954
18955static int
18956test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018958
Daniel Veillardce682bc2004-11-05 17:22:25 +000018959 int mem_base;
18960 xmlNodePtr ret_val;
18961 xmlNodePtr node; /* the node */
18962 int n_node;
18963 xmlDocPtr doc; /* the document */
18964 int n_doc;
18965 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18966 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018967
Daniel Veillardce682bc2004-11-05 17:22:25 +000018968 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18969 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18970 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18971 mem_base = xmlMemBlocks();
18972 node = gen_const_xmlNodePtr(n_node, 0);
18973 doc = gen_xmlDocPtr(n_doc, 1);
18974 extended = gen_int(n_extended, 2);
18975
William M. Brackf13f77f2004-11-12 16:03:48 +000018976 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018977 desret_xmlNodePtr(ret_val);
18978 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018979 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018980 des_xmlDocPtr(n_doc, doc, 1);
18981 des_int(n_extended, extended, 2);
18982 xmlResetLastError();
18983 if (mem_base != xmlMemBlocks()) {
18984 printf("Leak of %d blocks found in xmlDocCopyNode",
18985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018986 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018987 printf(" %d", n_node);
18988 printf(" %d", n_doc);
18989 printf(" %d", n_extended);
18990 printf("\n");
18991 }
18992 }
18993 }
18994 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018996
Daniel Veillard42595322004-11-08 10:52:06 +000018997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018998}
18999
19000
19001static int
19002test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019004
Daniel Veillardce682bc2004-11-05 17:22:25 +000019005 int mem_base;
19006 xmlNodePtr ret_val;
19007 xmlDocPtr doc; /* the target document */
19008 int n_doc;
19009 xmlNodePtr node; /* the first node in the list. */
19010 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019011
Daniel Veillardce682bc2004-11-05 17:22:25 +000019012 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19013 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
19014 mem_base = xmlMemBlocks();
19015 doc = gen_xmlDocPtr(n_doc, 0);
19016 node = gen_const_xmlNodePtr(n_node, 1);
19017
William M. Brackf13f77f2004-11-12 16:03:48 +000019018 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000019019 desret_xmlNodePtr(ret_val);
19020 call_tests++;
19021 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019022 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000019023 xmlResetLastError();
19024 if (mem_base != xmlMemBlocks()) {
19025 printf("Leak of %d blocks found in xmlDocCopyNodeList",
19026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019027 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019028 printf(" %d", n_doc);
19029 printf(" %d", n_node);
19030 printf("\n");
19031 }
19032 }
19033 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000019034 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019035
Daniel Veillard42595322004-11-08 10:52:06 +000019036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019037}
19038
19039
19040static int
19041test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019043
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019044#ifdef LIBXML_OUTPUT_ENABLED
19045 int mem_base;
19046 int ret_val;
19047 FILE * f; /* the FILE* */
19048 int n_f;
19049 xmlDocPtr cur; /* the document */
19050 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019051
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019052 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19053 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19054 mem_base = xmlMemBlocks();
19055 f = gen_FILE_ptr(n_f, 0);
19056 cur = gen_xmlDocPtr(n_cur, 1);
19057
19058 ret_val = xmlDocDump(f, cur);
19059 desret_int(ret_val);
19060 call_tests++;
19061 des_FILE_ptr(n_f, f, 0);
19062 des_xmlDocPtr(n_cur, cur, 1);
19063 xmlResetLastError();
19064 if (mem_base != xmlMemBlocks()) {
19065 printf("Leak of %d blocks found in xmlDocDump",
19066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019067 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019068 printf(" %d", n_f);
19069 printf(" %d", n_cur);
19070 printf("\n");
19071 }
19072 }
19073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019074 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019075#endif
19076
Daniel Veillard42595322004-11-08 10:52:06 +000019077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019078}
19079
19080
19081static int
19082test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019084
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019085#ifdef LIBXML_OUTPUT_ENABLED
19086 int mem_base;
19087 xmlDocPtr cur; /* the document */
19088 int n_cur;
19089 xmlChar ** mem; /* OUT: the memory pointer */
19090 int n_mem;
19091 int * size; /* OUT: the memory length */
19092 int n_size;
19093 int format; /* should formatting spaces been added */
19094 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019095
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019096 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19097 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19098 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19099 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19100 mem_base = xmlMemBlocks();
19101 cur = gen_xmlDocPtr(n_cur, 0);
19102 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19103 size = gen_int_ptr(n_size, 2);
19104 format = gen_int(n_format, 3);
19105
19106 xmlDocDumpFormatMemory(cur, mem, size, format);
19107 call_tests++;
19108 des_xmlDocPtr(n_cur, cur, 0);
19109 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19110 des_int_ptr(n_size, size, 2);
19111 des_int(n_format, format, 3);
19112 xmlResetLastError();
19113 if (mem_base != xmlMemBlocks()) {
19114 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019116 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019117 printf(" %d", n_cur);
19118 printf(" %d", n_mem);
19119 printf(" %d", n_size);
19120 printf(" %d", n_format);
19121 printf("\n");
19122 }
19123 }
19124 }
19125 }
19126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019127 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019128#endif
19129
Daniel Veillard42595322004-11-08 10:52:06 +000019130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131}
19132
19133
19134static int
19135test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019137
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019138#ifdef LIBXML_OUTPUT_ENABLED
19139 int mem_base;
19140 xmlDocPtr out_doc; /* Document to generate XML text from */
19141 int n_out_doc;
19142 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19143 int n_doc_txt_ptr;
19144 int * doc_txt_len; /* Length of the generated XML text */
19145 int n_doc_txt_len;
19146 char * txt_encoding; /* Character encoding to use when generating XML text */
19147 int n_txt_encoding;
19148 int format; /* should formatting spaces been added */
19149 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019150
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019151 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19152 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19153 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19154 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19155 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19156 mem_base = xmlMemBlocks();
19157 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19158 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19159 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19160 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19161 format = gen_int(n_format, 4);
19162
William M. Brackf13f77f2004-11-12 16:03:48 +000019163 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019164 call_tests++;
19165 des_xmlDocPtr(n_out_doc, out_doc, 0);
19166 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19167 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019168 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019169 des_int(n_format, format, 4);
19170 xmlResetLastError();
19171 if (mem_base != xmlMemBlocks()) {
19172 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019174 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019175 printf(" %d", n_out_doc);
19176 printf(" %d", n_doc_txt_ptr);
19177 printf(" %d", n_doc_txt_len);
19178 printf(" %d", n_txt_encoding);
19179 printf(" %d", n_format);
19180 printf("\n");
19181 }
19182 }
19183 }
19184 }
19185 }
19186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019187 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019188#endif
19189
Daniel Veillard42595322004-11-08 10:52:06 +000019190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019191}
19192
19193
19194static int
19195test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019197
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019198#ifdef LIBXML_OUTPUT_ENABLED
19199 int mem_base;
19200 xmlDocPtr cur; /* the document */
19201 int n_cur;
19202 xmlChar ** mem; /* OUT: the memory pointer */
19203 int n_mem;
19204 int * size; /* OUT: the memory length */
19205 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019206
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019207 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19208 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19209 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19210 mem_base = xmlMemBlocks();
19211 cur = gen_xmlDocPtr(n_cur, 0);
19212 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19213 size = gen_int_ptr(n_size, 2);
19214
19215 xmlDocDumpMemory(cur, mem, size);
19216 call_tests++;
19217 des_xmlDocPtr(n_cur, cur, 0);
19218 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19219 des_int_ptr(n_size, size, 2);
19220 xmlResetLastError();
19221 if (mem_base != xmlMemBlocks()) {
19222 printf("Leak of %d blocks found in xmlDocDumpMemory",
19223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019224 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019225 printf(" %d", n_cur);
19226 printf(" %d", n_mem);
19227 printf(" %d", n_size);
19228 printf("\n");
19229 }
19230 }
19231 }
19232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019233 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019234#endif
19235
Daniel Veillard42595322004-11-08 10:52:06 +000019236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019237}
19238
19239
19240static int
19241test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019243
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019244#ifdef LIBXML_OUTPUT_ENABLED
19245 int mem_base;
19246 xmlDocPtr out_doc; /* Document to generate XML text from */
19247 int n_out_doc;
19248 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19249 int n_doc_txt_ptr;
19250 int * doc_txt_len; /* Length of the generated XML text */
19251 int n_doc_txt_len;
19252 char * txt_encoding; /* Character encoding to use when generating XML text */
19253 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019254
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019255 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19256 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19257 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19258 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19259 mem_base = xmlMemBlocks();
19260 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19261 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19262 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19263 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19264
William M. Brackf13f77f2004-11-12 16:03:48 +000019265 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019266 call_tests++;
19267 des_xmlDocPtr(n_out_doc, out_doc, 0);
19268 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19269 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019270 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019271 xmlResetLastError();
19272 if (mem_base != xmlMemBlocks()) {
19273 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019275 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019276 printf(" %d", n_out_doc);
19277 printf(" %d", n_doc_txt_ptr);
19278 printf(" %d", n_doc_txt_len);
19279 printf(" %d", n_txt_encoding);
19280 printf("\n");
19281 }
19282 }
19283 }
19284 }
19285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019286 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019287#endif
19288
Daniel Veillard42595322004-11-08 10:52:06 +000019289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019290}
19291
19292
19293static int
19294test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019296
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019297#ifdef LIBXML_OUTPUT_ENABLED
19298 int mem_base;
19299 int ret_val;
19300 FILE * f; /* the FILE* */
19301 int n_f;
19302 xmlDocPtr cur; /* the document */
19303 int n_cur;
19304 int format; /* should formatting spaces been added */
19305 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019306
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019307 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19308 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19309 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19310 mem_base = xmlMemBlocks();
19311 f = gen_FILE_ptr(n_f, 0);
19312 cur = gen_xmlDocPtr(n_cur, 1);
19313 format = gen_int(n_format, 2);
19314
19315 ret_val = xmlDocFormatDump(f, cur, format);
19316 desret_int(ret_val);
19317 call_tests++;
19318 des_FILE_ptr(n_f, f, 0);
19319 des_xmlDocPtr(n_cur, cur, 1);
19320 des_int(n_format, format, 2);
19321 xmlResetLastError();
19322 if (mem_base != xmlMemBlocks()) {
19323 printf("Leak of %d blocks found in xmlDocFormatDump",
19324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019325 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019326 printf(" %d", n_f);
19327 printf(" %d", n_cur);
19328 printf(" %d", n_format);
19329 printf("\n");
19330 }
19331 }
19332 }
19333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019334 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019335#endif
19336
Daniel Veillard42595322004-11-08 10:52:06 +000019337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019338}
19339
19340
19341static int
19342test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019344
19345 int mem_base;
19346 xmlNodePtr ret_val;
19347 xmlDocPtr doc; /* the document */
19348 int n_doc;
19349
19350 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19351 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019352 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019353
19354 ret_val = xmlDocGetRootElement(doc);
19355 desret_xmlNodePtr(ret_val);
19356 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019357 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019358 xmlResetLastError();
19359 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019360 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019362 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019363 printf(" %d", n_doc);
19364 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019365 }
19366 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019368
Daniel Veillard42595322004-11-08 10:52:06 +000019369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019370}
19371
19372
19373static int
19374test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019376
19377#ifdef LIBXML_TREE_ENABLED
19378 int mem_base;
19379 xmlNodePtr ret_val;
19380 xmlDocPtr doc; /* the document */
19381 int n_doc;
19382 xmlNodePtr root; /* the new document root element */
19383 int n_root;
19384
19385 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019386 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019388 doc = gen_xmlDocPtr(n_doc, 0);
19389 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019390
19391 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019392 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019393 desret_xmlNodePtr(ret_val);
19394 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019395 des_xmlDocPtr(n_doc, doc, 0);
19396 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019397 xmlResetLastError();
19398 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019399 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019401 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019402 printf(" %d", n_doc);
19403 printf(" %d", n_root);
19404 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019405 }
19406 }
19407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019408 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019409#endif
19410
Daniel Veillard42595322004-11-08 10:52:06 +000019411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019412}
19413
19414
19415static int
19416test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019418
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019419#ifdef LIBXML_OUTPUT_ENABLED
19420 int mem_base;
19421 FILE * f; /* the FILE * for the output */
19422 int n_f;
19423 xmlDocPtr doc; /* the document */
19424 int n_doc;
19425 xmlNodePtr cur; /* the current node */
19426 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019427
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019428 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19429 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19430 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19431 mem_base = xmlMemBlocks();
19432 f = gen_FILE_ptr(n_f, 0);
19433 doc = gen_xmlDocPtr(n_doc, 1);
19434 cur = gen_xmlNodePtr(n_cur, 2);
19435
19436 xmlElemDump(f, doc, cur);
19437 call_tests++;
19438 des_FILE_ptr(n_f, f, 0);
19439 des_xmlDocPtr(n_doc, doc, 1);
19440 des_xmlNodePtr(n_cur, cur, 2);
19441 xmlResetLastError();
19442 if (mem_base != xmlMemBlocks()) {
19443 printf("Leak of %d blocks found in xmlElemDump",
19444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019445 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019446 printf(" %d", n_f);
19447 printf(" %d", n_doc);
19448 printf(" %d", n_cur);
19449 printf("\n");
19450 }
19451 }
19452 }
19453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019454 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019455#endif
19456
Daniel Veillard42595322004-11-08 10:52:06 +000019457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019458}
19459
19460
19461static int
19462test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019464
Daniel Veillard57b25162004-11-06 14:50:18 +000019465 int mem_base;
19466 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019467
Daniel Veillard57b25162004-11-06 14:50:18 +000019468 mem_base = xmlMemBlocks();
19469
19470 ret_val = xmlGetBufferAllocationScheme();
19471 desret_xmlBufferAllocationScheme(ret_val);
19472 call_tests++;
19473 xmlResetLastError();
19474 if (mem_base != xmlMemBlocks()) {
19475 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019477 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019478 printf("\n");
19479 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019481
Daniel Veillard42595322004-11-08 10:52:06 +000019482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019483}
19484
19485
19486static int
19487test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019489
19490 int mem_base;
19491 int ret_val;
19492
19493 mem_base = xmlMemBlocks();
19494
19495 ret_val = xmlGetCompressMode();
19496 desret_int(ret_val);
19497 call_tests++;
19498 xmlResetLastError();
19499 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019500 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019502 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019503 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019504 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019505 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019506
Daniel Veillard42595322004-11-08 10:52:06 +000019507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019508}
19509
19510
19511static int
19512test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019514
19515 int mem_base;
19516 int ret_val;
19517 xmlDocPtr doc; /* the document */
19518 int n_doc;
19519
19520 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019522 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019523
19524 ret_val = xmlGetDocCompressMode(doc);
19525 desret_int(ret_val);
19526 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019527 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019528 xmlResetLastError();
19529 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019530 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019532 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019533 printf(" %d", n_doc);
19534 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019535 }
19536 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019537 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019538
Daniel Veillard42595322004-11-08 10:52:06 +000019539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019540}
19541
19542
19543static int
19544test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019546
Daniel Veillard34099b42004-11-04 17:34:35 +000019547 int mem_base;
19548 xmlDtdPtr ret_val;
19549 xmlDocPtr doc; /* the document pointer */
19550 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019551
Daniel Veillard34099b42004-11-04 17:34:35 +000019552 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19553 mem_base = xmlMemBlocks();
19554 doc = gen_xmlDocPtr(n_doc, 0);
19555
19556 ret_val = xmlGetIntSubset(doc);
19557 desret_xmlDtdPtr(ret_val);
19558 call_tests++;
19559 des_xmlDocPtr(n_doc, doc, 0);
19560 xmlResetLastError();
19561 if (mem_base != xmlMemBlocks()) {
19562 printf("Leak of %d blocks found in xmlGetIntSubset",
19563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019564 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019565 printf(" %d", n_doc);
19566 printf("\n");
19567 }
19568 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019569 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019570
Daniel Veillard42595322004-11-08 10:52:06 +000019571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019572}
19573
19574
19575static int
19576test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019578
19579 int mem_base;
19580 xmlNodePtr ret_val;
19581 xmlNodePtr parent; /* the parent node */
19582 int n_parent;
19583
19584 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19585 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019586 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019587
19588 ret_val = xmlGetLastChild(parent);
19589 desret_xmlNodePtr(ret_val);
19590 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019591 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019592 xmlResetLastError();
19593 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019594 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019596 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019597 printf(" %d", n_parent);
19598 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019599 }
19600 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019602
Daniel Veillard42595322004-11-08 10:52:06 +000019603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019604}
19605
19606
19607static int
19608test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019610
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019611 int mem_base;
19612 long ret_val;
19613 xmlNodePtr node; /* valid node */
19614 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019615
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019616 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19617 mem_base = xmlMemBlocks();
19618 node = gen_xmlNodePtr(n_node, 0);
19619
19620 ret_val = xmlGetLineNo(node);
19621 desret_long(ret_val);
19622 call_tests++;
19623 des_xmlNodePtr(n_node, node, 0);
19624 xmlResetLastError();
19625 if (mem_base != xmlMemBlocks()) {
19626 printf("Leak of %d blocks found in xmlGetLineNo",
19627 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019628 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019629 printf(" %d", n_node);
19630 printf("\n");
19631 }
19632 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019633 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019634
Daniel Veillard42595322004-11-08 10:52:06 +000019635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019636}
19637
19638
19639static int
19640test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019642
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019643 int mem_base;
19644 xmlChar * ret_val;
19645 xmlNodePtr node; /* the node */
19646 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019647 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019648 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019649
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019650 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19651 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19652 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019653 node = gen_xmlNodePtr(n_node, 0);
19654 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019655
William M. Brackf13f77f2004-11-12 16:03:48 +000019656 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019657 desret_xmlChar_ptr(ret_val);
19658 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019659 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019660 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019661 xmlResetLastError();
19662 if (mem_base != xmlMemBlocks()) {
19663 printf("Leak of %d blocks found in xmlGetNoNsProp",
19664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019665 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019666 printf(" %d", n_node);
19667 printf(" %d", n_name);
19668 printf("\n");
19669 }
19670 }
19671 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019673
Daniel Veillard42595322004-11-08 10:52:06 +000019674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019675}
19676
19677
19678static int
19679test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019681
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019682#ifdef LIBXML_TREE_ENABLED
19683 int mem_base;
19684 xmlChar * ret_val;
19685 xmlNodePtr node; /* a node */
19686 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019687
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019688 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19689 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019690 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019691
19692 ret_val = xmlGetNodePath(node);
19693 desret_xmlChar_ptr(ret_val);
19694 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019695 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019696 xmlResetLastError();
19697 if (mem_base != xmlMemBlocks()) {
19698 printf("Leak of %d blocks found in xmlGetNodePath",
19699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019700 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019701 printf(" %d", n_node);
19702 printf("\n");
19703 }
19704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019705 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019706#endif
19707
Daniel Veillard42595322004-11-08 10:52:06 +000019708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019709}
19710
19711
19712static int
19713test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019715
19716
19717 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019719}
19720
19721
19722static int
19723test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019725
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019726 int mem_base;
19727 xmlChar * ret_val;
19728 xmlNodePtr node; /* the node */
19729 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019730 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019731 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019732 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019733 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019735 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19736 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19737 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019739 node = gen_xmlNodePtr(n_node, 0);
19740 name = gen_const_xmlChar_ptr(n_name, 1);
19741 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019742
William M. Brackf13f77f2004-11-12 16:03:48 +000019743 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019744 desret_xmlChar_ptr(ret_val);
19745 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019746 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019747 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19748 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019749 xmlResetLastError();
19750 if (mem_base != xmlMemBlocks()) {
19751 printf("Leak of %d blocks found in xmlGetNsProp",
19752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019753 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019754 printf(" %d", n_node);
19755 printf(" %d", n_name);
19756 printf(" %d", n_nameSpace);
19757 printf("\n");
19758 }
19759 }
19760 }
19761 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019762 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019763
Daniel Veillard42595322004-11-08 10:52:06 +000019764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019765}
19766
19767
19768static int
19769test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019771
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019772 int mem_base;
19773 xmlChar * ret_val;
19774 xmlNodePtr node; /* the node */
19775 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019776 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019777 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019778
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019779 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19780 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19781 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019782 node = gen_xmlNodePtr(n_node, 0);
19783 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019784
William M. Brackf13f77f2004-11-12 16:03:48 +000019785 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019786 desret_xmlChar_ptr(ret_val);
19787 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019788 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019789 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019790 xmlResetLastError();
19791 if (mem_base != xmlMemBlocks()) {
19792 printf("Leak of %d blocks found in xmlGetProp",
19793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019794 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019795 printf(" %d", n_node);
19796 printf(" %d", n_name);
19797 printf("\n");
19798 }
19799 }
19800 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019801 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019802
Daniel Veillard42595322004-11-08 10:52:06 +000019803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019804}
19805
19806
19807static int
19808test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019810
Daniel Veillard57b25162004-11-06 14:50:18 +000019811 int mem_base;
19812 xmlAttrPtr ret_val;
19813 xmlNodePtr node; /* the node */
19814 int n_node;
19815 xmlChar * name; /* the attribute name */
19816 int n_name;
19817 xmlChar * nameSpace; /* the URI of the namespace */
19818 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019819
Daniel Veillard57b25162004-11-06 14:50:18 +000019820 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19821 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19822 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19823 mem_base = xmlMemBlocks();
19824 node = gen_xmlNodePtr(n_node, 0);
19825 name = gen_const_xmlChar_ptr(n_name, 1);
19826 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19827
William M. Brackf13f77f2004-11-12 16:03:48 +000019828 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019829 desret_xmlAttrPtr(ret_val);
19830 call_tests++;
19831 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019832 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19833 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019834 xmlResetLastError();
19835 if (mem_base != xmlMemBlocks()) {
19836 printf("Leak of %d blocks found in xmlHasNsProp",
19837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019838 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019839 printf(" %d", n_node);
19840 printf(" %d", n_name);
19841 printf(" %d", n_nameSpace);
19842 printf("\n");
19843 }
19844 }
19845 }
19846 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019847 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019848
Daniel Veillard42595322004-11-08 10:52:06 +000019849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019850}
19851
19852
19853static int
19854test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019856
Daniel Veillard57b25162004-11-06 14:50:18 +000019857 int mem_base;
19858 xmlAttrPtr ret_val;
19859 xmlNodePtr node; /* the node */
19860 int n_node;
19861 xmlChar * name; /* the attribute name */
19862 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019863
Daniel Veillard57b25162004-11-06 14:50:18 +000019864 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19865 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19866 mem_base = xmlMemBlocks();
19867 node = gen_xmlNodePtr(n_node, 0);
19868 name = gen_const_xmlChar_ptr(n_name, 1);
19869
William M. Brackf13f77f2004-11-12 16:03:48 +000019870 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019871 desret_xmlAttrPtr(ret_val);
19872 call_tests++;
19873 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019874 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019875 xmlResetLastError();
19876 if (mem_base != xmlMemBlocks()) {
19877 printf("Leak of %d blocks found in xmlHasProp",
19878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019879 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019880 printf(" %d", n_node);
19881 printf(" %d", n_name);
19882 printf("\n");
19883 }
19884 }
19885 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019886 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019887
Daniel Veillard42595322004-11-08 10:52:06 +000019888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019889}
19890
19891
19892static int
19893test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895
19896 int mem_base;
19897 int ret_val;
19898 xmlNodePtr node; /* the node */
19899 int n_node;
19900
19901 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19902 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019903 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019904
19905 ret_val = xmlIsBlankNode(node);
19906 desret_int(ret_val);
19907 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019908 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019909 xmlResetLastError();
19910 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019911 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019913 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019914 printf(" %d", n_node);
19915 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019916 }
19917 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019919
Daniel Veillard42595322004-11-08 10:52:06 +000019920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019921}
19922
19923
19924static int
19925test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927
19928 int mem_base;
19929 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019930 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019931 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019932 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019933 int n_publicID;
19934
19935 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19936 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19937 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019938 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19939 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019940
William M. Brackf13f77f2004-11-12 16:03:48 +000019941 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019942 desret_int(ret_val);
19943 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019944 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19945 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946 xmlResetLastError();
19947 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019948 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019950 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019951 printf(" %d", n_systemID);
19952 printf(" %d", n_publicID);
19953 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954 }
19955 }
19956 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019957 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019958
Daniel Veillard42595322004-11-08 10:52:06 +000019959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019960}
19961
19962
19963static int
19964test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019966
19967 int mem_base;
19968 xmlNodePtr ret_val;
19969 xmlDocPtr doc; /* the document */
19970 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019971 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019972 int n_content;
19973 int len; /* the length of the block */
19974 int n_len;
19975
19976 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19977 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19978 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19979 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019980 doc = gen_xmlDocPtr(n_doc, 0);
19981 content = gen_const_xmlChar_ptr(n_content, 1);
19982 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019983
William M. Brackf13f77f2004-11-12 16:03:48 +000019984 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019985 desret_xmlNodePtr(ret_val);
19986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019987 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019988 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019989 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019990 xmlResetLastError();
19991 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019992 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019994 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019995 printf(" %d", n_doc);
19996 printf(" %d", n_content);
19997 printf(" %d", n_len);
19998 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019999 }
20000 }
20001 }
20002 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020003 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020004
Daniel Veillard42595322004-11-08 10:52:06 +000020005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020006}
20007
20008
20009static int
20010test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020012
20013 int mem_base;
20014 xmlNodePtr ret_val;
20015 xmlDocPtr doc; /* the document */
20016 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020017 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020018 int n_name;
20019
20020 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20021 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20022 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020023 doc = gen_xmlDocPtr(n_doc, 0);
20024 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020025
William M. Brackf13f77f2004-11-12 16:03:48 +000020026 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020027 desret_xmlNodePtr(ret_val);
20028 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020029 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020030 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020031 xmlResetLastError();
20032 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020033 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020035 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020036 printf(" %d", n_doc);
20037 printf(" %d", n_name);
20038 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020039 }
20040 }
20041 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020042 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020043
Daniel Veillard42595322004-11-08 10:52:06 +000020044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020045}
20046
20047
20048static int
20049test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020051
Daniel Veillarda521d282004-11-09 14:59:59 +000020052#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020053 int mem_base;
20054 xmlNodePtr ret_val;
20055 xmlNodePtr parent; /* the parent node */
20056 int n_parent;
20057 xmlNsPtr ns; /* a namespace if any */
20058 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020059 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020060 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020061 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020062 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020063
Daniel Veillard27f20102004-11-05 11:50:11 +000020064 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20065 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20066 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20067 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20068 mem_base = xmlMemBlocks();
20069 parent = gen_xmlNodePtr(n_parent, 0);
20070 ns = gen_xmlNsPtr(n_ns, 1);
20071 name = gen_const_xmlChar_ptr(n_name, 2);
20072 content = gen_const_xmlChar_ptr(n_content, 3);
20073
William M. Brackf13f77f2004-11-12 16:03:48 +000020074 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020075 desret_xmlNodePtr(ret_val);
20076 call_tests++;
20077 des_xmlNodePtr(n_parent, parent, 0);
20078 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020079 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20080 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020081 xmlResetLastError();
20082 if (mem_base != xmlMemBlocks()) {
20083 printf("Leak of %d blocks found in xmlNewChild",
20084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020085 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020086 printf(" %d", n_parent);
20087 printf(" %d", n_ns);
20088 printf(" %d", n_name);
20089 printf(" %d", n_content);
20090 printf("\n");
20091 }
20092 }
20093 }
20094 }
20095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020096 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020097#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020098
Daniel Veillard42595322004-11-08 10:52:06 +000020099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020100}
20101
20102
20103static int
20104test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020106
20107 int mem_base;
20108 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020109 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020110 int n_content;
20111
20112 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020114 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020115
William M. Brackf13f77f2004-11-12 16:03:48 +000020116 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020117 desret_xmlNodePtr(ret_val);
20118 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020119 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020120 xmlResetLastError();
20121 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020122 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020124 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020125 printf(" %d", n_content);
20126 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020127 }
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_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020138
20139 int mem_base;
20140 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020141 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020142 int n_version;
20143
20144 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20145 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020146 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020147
William M. Brackf13f77f2004-11-12 16:03:48 +000020148 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020149 desret_xmlDocPtr(ret_val);
20150 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020151 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020152 xmlResetLastError();
20153 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020154 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020156 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020157 printf(" %d", n_version);
20158 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020159 }
20160 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020162
Daniel Veillard42595322004-11-08 10:52:06 +000020163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020164}
20165
20166
20167static int
20168test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020170
20171 int mem_base;
20172 xmlNodePtr ret_val;
20173 xmlDocPtr doc; /* the document */
20174 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020175 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020176 int n_content;
20177
20178 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20179 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020181 doc = gen_xmlDocPtr(n_doc, 0);
20182 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020183
William M. Brackf13f77f2004-11-12 16:03:48 +000020184 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020185 desret_xmlNodePtr(ret_val);
20186 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020187 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020188 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020189 xmlResetLastError();
20190 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020191 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020193 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020194 printf(" %d", n_doc);
20195 printf(" %d", n_content);
20196 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020197 }
20198 }
20199 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020200 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020201
Daniel Veillard42595322004-11-08 10:52:06 +000020202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020203}
20204
20205
20206static int
20207test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020209
20210#ifdef LIBXML_TREE_ENABLED
20211 int mem_base;
20212 xmlNodePtr ret_val;
20213 xmlDocPtr doc; /* the document owning the fragment */
20214 int n_doc;
20215
20216 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020218 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020219
20220 ret_val = xmlNewDocFragment(doc);
20221 desret_xmlNodePtr(ret_val);
20222 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020223 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020224 xmlResetLastError();
20225 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020226 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020228 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020229 printf(" %d", n_doc);
20230 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020231 }
20232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020233 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020234#endif
20235
Daniel Veillard42595322004-11-08 10:52:06 +000020236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020237}
20238
20239
20240static int
20241test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020243
Daniel Veillard27f20102004-11-05 11:50:11 +000020244 int mem_base;
20245 xmlNodePtr ret_val;
20246 xmlDocPtr doc; /* the document */
20247 int n_doc;
20248 xmlNsPtr ns; /* namespace if any */
20249 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020250 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020251 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020252 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020253 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020254
Daniel Veillard27f20102004-11-05 11:50:11 +000020255 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20256 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20257 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20258 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20259 mem_base = xmlMemBlocks();
20260 doc = gen_xmlDocPtr(n_doc, 0);
20261 ns = gen_xmlNsPtr(n_ns, 1);
20262 name = gen_const_xmlChar_ptr(n_name, 2);
20263 content = gen_const_xmlChar_ptr(n_content, 3);
20264
William M. Brackf13f77f2004-11-12 16:03:48 +000020265 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020266 desret_xmlNodePtr(ret_val);
20267 call_tests++;
20268 des_xmlDocPtr(n_doc, doc, 0);
20269 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020270 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20271 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020272 xmlResetLastError();
20273 if (mem_base != xmlMemBlocks()) {
20274 printf("Leak of %d blocks found in xmlNewDocNode",
20275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020276 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020277 printf(" %d", n_doc);
20278 printf(" %d", n_ns);
20279 printf(" %d", n_name);
20280 printf(" %d", n_content);
20281 printf("\n");
20282 }
20283 }
20284 }
20285 }
20286 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020287 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020288
Daniel Veillard42595322004-11-08 10:52:06 +000020289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020290}
20291
20292
20293static int
20294test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020296
Daniel Veillard27f20102004-11-05 11:50:11 +000020297 int mem_base;
20298 xmlNodePtr ret_val;
20299 xmlDocPtr doc; /* the document */
20300 int n_doc;
20301 xmlNsPtr ns; /* namespace if any */
20302 int n_ns;
20303 xmlChar * name; /* the node name */
20304 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020305 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020306 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020307
Daniel Veillard27f20102004-11-05 11:50:11 +000020308 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20309 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20310 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20311 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20312 mem_base = xmlMemBlocks();
20313 doc = gen_xmlDocPtr(n_doc, 0);
20314 ns = gen_xmlNsPtr(n_ns, 1);
20315 name = gen_eaten_name(n_name, 2);
20316 content = gen_const_xmlChar_ptr(n_content, 3);
20317
William M. Brackf13f77f2004-11-12 16:03:48 +000020318 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020319 desret_xmlNodePtr(ret_val);
20320 call_tests++;
20321 des_xmlDocPtr(n_doc, doc, 0);
20322 des_xmlNsPtr(n_ns, ns, 1);
20323 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020324 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020325 xmlResetLastError();
20326 if (mem_base != xmlMemBlocks()) {
20327 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020329 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020330 printf(" %d", n_doc);
20331 printf(" %d", n_ns);
20332 printf(" %d", n_name);
20333 printf(" %d", n_content);
20334 printf("\n");
20335 }
20336 }
20337 }
20338 }
20339 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020340 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020341
Daniel Veillard42595322004-11-08 10:52:06 +000020342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020343}
20344
20345
20346static int
20347test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020349
20350 int mem_base;
20351 xmlNodePtr ret_val;
20352 xmlDocPtr doc; /* the target document */
20353 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020354 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020355 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020356 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020357 int n_content;
20358
20359 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20360 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20361 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20362 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020363 doc = gen_xmlDocPtr(n_doc, 0);
20364 name = gen_const_xmlChar_ptr(n_name, 1);
20365 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020366
William M. Brackf13f77f2004-11-12 16:03:48 +000020367 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020368 desret_xmlNodePtr(ret_val);
20369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020370 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020371 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20372 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020373 xmlResetLastError();
20374 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020375 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020377 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020378 printf(" %d", n_doc);
20379 printf(" %d", n_name);
20380 printf(" %d", n_content);
20381 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020382 }
20383 }
20384 }
20385 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020386 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020387
Daniel Veillard42595322004-11-08 10:52:06 +000020388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020389}
20390
20391
20392static int
20393test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020395
Daniel Veillard57b25162004-11-06 14:50:18 +000020396 int mem_base;
20397 xmlAttrPtr ret_val;
20398 xmlDocPtr doc; /* the document */
20399 int n_doc;
20400 xmlChar * name; /* the name of the attribute */
20401 int n_name;
20402 xmlChar * value; /* the value of the attribute */
20403 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020404
Daniel Veillard57b25162004-11-06 14:50:18 +000020405 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20406 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20407 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20408 mem_base = xmlMemBlocks();
20409 doc = gen_xmlDocPtr(n_doc, 0);
20410 name = gen_const_xmlChar_ptr(n_name, 1);
20411 value = gen_const_xmlChar_ptr(n_value, 2);
20412
William M. Brackf13f77f2004-11-12 16:03:48 +000020413 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020414 desret_xmlAttrPtr(ret_val);
20415 call_tests++;
20416 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020417 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20418 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020419 xmlResetLastError();
20420 if (mem_base != xmlMemBlocks()) {
20421 printf("Leak of %d blocks found in xmlNewDocProp",
20422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020423 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020424 printf(" %d", n_doc);
20425 printf(" %d", n_name);
20426 printf(" %d", n_value);
20427 printf("\n");
20428 }
20429 }
20430 }
20431 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020433
Daniel Veillard42595322004-11-08 10:52:06 +000020434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020435}
20436
20437
20438static int
20439test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020441
Daniel Veillarda521d282004-11-09 14:59:59 +000020442#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020443 int mem_base;
20444 xmlNodePtr ret_val;
20445 xmlDocPtr doc; /* the document */
20446 int n_doc;
20447 xmlNsPtr ns; /* namespace if any */
20448 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020449 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020450 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020451 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020452 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020453
Daniel Veillard27f20102004-11-05 11:50:11 +000020454 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20455 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20456 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20457 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20458 mem_base = xmlMemBlocks();
20459 doc = gen_xmlDocPtr(n_doc, 0);
20460 ns = gen_xmlNsPtr(n_ns, 1);
20461 name = gen_const_xmlChar_ptr(n_name, 2);
20462 content = gen_const_xmlChar_ptr(n_content, 3);
20463
William M. Brackf13f77f2004-11-12 16:03:48 +000020464 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020465 desret_xmlNodePtr(ret_val);
20466 call_tests++;
20467 des_xmlDocPtr(n_doc, doc, 0);
20468 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020469 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20470 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020471 xmlResetLastError();
20472 if (mem_base != xmlMemBlocks()) {
20473 printf("Leak of %d blocks found in xmlNewDocRawNode",
20474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020475 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020476 printf(" %d", n_doc);
20477 printf(" %d", n_ns);
20478 printf(" %d", n_name);
20479 printf(" %d", n_content);
20480 printf("\n");
20481 }
20482 }
20483 }
20484 }
20485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020486 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020487#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020488
Daniel Veillard42595322004-11-08 10:52:06 +000020489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020490}
20491
20492
20493static int
20494test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020496
20497 int mem_base;
20498 xmlNodePtr ret_val;
20499 xmlDocPtr doc; /* the document */
20500 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020501 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020502 int n_content;
20503
20504 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20505 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20506 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020507 doc = gen_xmlDocPtr(n_doc, 0);
20508 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020509
William M. Brackf13f77f2004-11-12 16:03:48 +000020510 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020511 desret_xmlNodePtr(ret_val);
20512 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020513 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020514 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020515 xmlResetLastError();
20516 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020517 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020519 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020520 printf(" %d", n_doc);
20521 printf(" %d", n_content);
20522 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020523 }
20524 }
20525 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020526 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020527
Daniel Veillard42595322004-11-08 10:52:06 +000020528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020529}
20530
20531
20532static int
20533test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020535
20536 int mem_base;
20537 xmlNodePtr ret_val;
20538 xmlDocPtr doc; /* the document */
20539 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020540 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020541 int n_content;
20542 int len; /* the text len. */
20543 int n_len;
20544
20545 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20546 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20547 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020549 doc = gen_xmlDocPtr(n_doc, 0);
20550 content = gen_const_xmlChar_ptr(n_content, 1);
20551 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020552
William M. Brackf13f77f2004-11-12 16:03:48 +000020553 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020554 desret_xmlNodePtr(ret_val);
20555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020556 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020557 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020558 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020559 xmlResetLastError();
20560 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020561 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020563 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020564 printf(" %d", n_doc);
20565 printf(" %d", n_content);
20566 printf(" %d", n_len);
20567 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020568 }
20569 }
20570 }
20571 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020573
Daniel Veillard42595322004-11-08 10:52:06 +000020574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020575}
20576
20577
20578static int
20579test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020581
Daniel Veillard34099b42004-11-04 17:34:35 +000020582 int mem_base;
20583 xmlDtdPtr ret_val;
20584 xmlDocPtr doc; /* the document pointer */
20585 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020586 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020587 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020588 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020589 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020590 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020591 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020592
Daniel Veillard34099b42004-11-04 17:34:35 +000020593 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20594 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20595 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20596 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20597 mem_base = xmlMemBlocks();
20598 doc = gen_xmlDocPtr(n_doc, 0);
20599 name = gen_const_xmlChar_ptr(n_name, 1);
20600 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20601 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20602
William M. Brackf13f77f2004-11-12 16:03:48 +000020603 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020604 desret_xmlDtdPtr(ret_val);
20605 call_tests++;
20606 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020607 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20608 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20609 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020610 xmlResetLastError();
20611 if (mem_base != xmlMemBlocks()) {
20612 printf("Leak of %d blocks found in xmlNewDtd",
20613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020614 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020615 printf(" %d", n_doc);
20616 printf(" %d", n_name);
20617 printf(" %d", n_ExternalID);
20618 printf(" %d", n_SystemID);
20619 printf("\n");
20620 }
20621 }
20622 }
20623 }
20624 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020625 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020626
Daniel Veillard42595322004-11-08 10:52:06 +000020627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020628}
20629
20630
20631static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020632test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020634
Daniel Veillard27f20102004-11-05 11:50:11 +000020635 int mem_base;
20636 xmlNodePtr ret_val;
20637 xmlNsPtr ns; /* namespace if any */
20638 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020639 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020640 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020641
Daniel Veillard27f20102004-11-05 11:50:11 +000020642 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20643 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20644 mem_base = xmlMemBlocks();
20645 ns = gen_xmlNsPtr(n_ns, 0);
20646 name = gen_const_xmlChar_ptr(n_name, 1);
20647
William M. Brackf13f77f2004-11-12 16:03:48 +000020648 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020649 desret_xmlNodePtr(ret_val);
20650 call_tests++;
20651 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020652 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020653 xmlResetLastError();
20654 if (mem_base != xmlMemBlocks()) {
20655 printf("Leak of %d blocks found in xmlNewNode",
20656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020657 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020658 printf(" %d", n_ns);
20659 printf(" %d", n_name);
20660 printf("\n");
20661 }
20662 }
20663 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020664 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020665
Daniel Veillard42595322004-11-08 10:52:06 +000020666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020667}
20668
20669
20670static int
20671test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020673
Daniel Veillard27f20102004-11-05 11:50:11 +000020674 int mem_base;
20675 xmlNodePtr ret_val;
20676 xmlNsPtr ns; /* namespace if any */
20677 int n_ns;
20678 xmlChar * name; /* the node name */
20679 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020680
Daniel Veillard27f20102004-11-05 11:50:11 +000020681 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20682 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20683 mem_base = xmlMemBlocks();
20684 ns = gen_xmlNsPtr(n_ns, 0);
20685 name = gen_eaten_name(n_name, 1);
20686
20687 ret_val = xmlNewNodeEatName(ns, name);
20688 desret_xmlNodePtr(ret_val);
20689 call_tests++;
20690 des_xmlNsPtr(n_ns, ns, 0);
20691 des_eaten_name(n_name, name, 1);
20692 xmlResetLastError();
20693 if (mem_base != xmlMemBlocks()) {
20694 printf("Leak of %d blocks found in xmlNewNodeEatName",
20695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020696 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020697 printf(" %d", n_ns);
20698 printf(" %d", n_name);
20699 printf("\n");
20700 }
20701 }
20702 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020703 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020704
Daniel Veillard42595322004-11-08 10:52:06 +000020705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020706}
20707
20708
20709static int
20710test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020712
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020713 int mem_base;
20714 xmlNsPtr ret_val;
20715 xmlNodePtr node; /* the element carrying the namespace */
20716 int n_node;
20717 xmlChar * href; /* the URI associated */
20718 int n_href;
20719 xmlChar * prefix; /* the prefix for the namespace */
20720 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020721
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020722 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20723 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20724 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20725 mem_base = xmlMemBlocks();
20726 node = gen_xmlNodePtr(n_node, 0);
20727 href = gen_const_xmlChar_ptr(n_href, 1);
20728 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20729
William M. Brackf13f77f2004-11-12 16:03:48 +000020730 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020731 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20732 desret_xmlNsPtr(ret_val);
20733 call_tests++;
20734 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020735 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20736 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020737 xmlResetLastError();
20738 if (mem_base != xmlMemBlocks()) {
20739 printf("Leak of %d blocks found in xmlNewNs",
20740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020741 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020742 printf(" %d", n_node);
20743 printf(" %d", n_href);
20744 printf(" %d", n_prefix);
20745 printf("\n");
20746 }
20747 }
20748 }
20749 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020750 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020751
Daniel Veillard42595322004-11-08 10:52:06 +000020752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020753}
20754
20755
20756static int
20757test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020759
Daniel Veillard57b25162004-11-06 14:50:18 +000020760 int mem_base;
20761 xmlAttrPtr ret_val;
20762 xmlNodePtr node; /* the holding node */
20763 int n_node;
20764 xmlNsPtr ns; /* the namespace */
20765 int n_ns;
20766 xmlChar * name; /* the name of the attribute */
20767 int n_name;
20768 xmlChar * value; /* the value of the attribute */
20769 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020770
Daniel Veillard57b25162004-11-06 14:50:18 +000020771 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20772 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20773 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20774 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20775 mem_base = xmlMemBlocks();
20776 node = gen_xmlNodePtr(n_node, 0);
20777 ns = gen_xmlNsPtr(n_ns, 1);
20778 name = gen_const_xmlChar_ptr(n_name, 2);
20779 value = gen_const_xmlChar_ptr(n_value, 3);
20780
William M. Brackf13f77f2004-11-12 16:03:48 +000020781 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020782 desret_xmlAttrPtr(ret_val);
20783 call_tests++;
20784 des_xmlNodePtr(n_node, node, 0);
20785 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020786 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20787 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020788 xmlResetLastError();
20789 if (mem_base != xmlMemBlocks()) {
20790 printf("Leak of %d blocks found in xmlNewNsProp",
20791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020792 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020793 printf(" %d", n_node);
20794 printf(" %d", n_ns);
20795 printf(" %d", n_name);
20796 printf(" %d", n_value);
20797 printf("\n");
20798 }
20799 }
20800 }
20801 }
20802 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020803 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020804
Daniel Veillard42595322004-11-08 10:52:06 +000020805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020806}
20807
20808
20809static int
20810test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020812
Daniel Veillard57b25162004-11-06 14:50:18 +000020813 int mem_base;
20814 xmlAttrPtr ret_val;
20815 xmlNodePtr node; /* the holding node */
20816 int n_node;
20817 xmlNsPtr ns; /* the namespace */
20818 int n_ns;
20819 xmlChar * name; /* the name of the attribute */
20820 int n_name;
20821 xmlChar * value; /* the value of the attribute */
20822 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020823
Daniel Veillard57b25162004-11-06 14:50:18 +000020824 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20825 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20826 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20827 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20828 mem_base = xmlMemBlocks();
20829 node = gen_xmlNodePtr(n_node, 0);
20830 ns = gen_xmlNsPtr(n_ns, 1);
20831 name = gen_eaten_name(n_name, 2);
20832 value = gen_const_xmlChar_ptr(n_value, 3);
20833
William M. Brackf13f77f2004-11-12 16:03:48 +000020834 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020835 desret_xmlAttrPtr(ret_val);
20836 call_tests++;
20837 des_xmlNodePtr(n_node, node, 0);
20838 des_xmlNsPtr(n_ns, ns, 1);
20839 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020840 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020841 xmlResetLastError();
20842 if (mem_base != xmlMemBlocks()) {
20843 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020845 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020846 printf(" %d", n_node);
20847 printf(" %d", n_ns);
20848 printf(" %d", n_name);
20849 printf(" %d", n_value);
20850 printf("\n");
20851 }
20852 }
20853 }
20854 }
20855 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020856 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020857
Daniel Veillard42595322004-11-08 10:52:06 +000020858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020859}
20860
20861
20862static int
20863test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020865
20866 int mem_base;
20867 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020868 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020869 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020870 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020871 int n_content;
20872
20873 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
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 name = gen_const_xmlChar_ptr(n_name, 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 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020880 desret_xmlNodePtr(ret_val);
20881 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020882 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20883 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020884 xmlResetLastError();
20885 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020886 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020888 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020889 printf(" %d", n_name);
20890 printf(" %d", n_content);
20891 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020892 }
20893 }
20894 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020895 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020896
Daniel Veillard42595322004-11-08 10:52:06 +000020897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020898}
20899
20900
20901static int
20902test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020904
Daniel Veillarda521d282004-11-09 14:59:59 +000020905#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020906 int mem_base;
20907 xmlAttrPtr ret_val;
20908 xmlNodePtr node; /* the holding node */
20909 int n_node;
20910 xmlChar * name; /* the name of the attribute */
20911 int n_name;
20912 xmlChar * value; /* the value of the attribute */
20913 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020914
Daniel Veillard57b25162004-11-06 14:50:18 +000020915 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20916 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20917 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20918 mem_base = xmlMemBlocks();
20919 node = gen_xmlNodePtr(n_node, 0);
20920 name = gen_const_xmlChar_ptr(n_name, 1);
20921 value = gen_const_xmlChar_ptr(n_value, 2);
20922
William M. Brackf13f77f2004-11-12 16:03:48 +000020923 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020924 desret_xmlAttrPtr(ret_val);
20925 call_tests++;
20926 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020927 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20928 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020929 xmlResetLastError();
20930 if (mem_base != xmlMemBlocks()) {
20931 printf("Leak of %d blocks found in xmlNewProp",
20932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020933 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020934 printf(" %d", n_node);
20935 printf(" %d", n_name);
20936 printf(" %d", n_value);
20937 printf("\n");
20938 }
20939 }
20940 }
20941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020942 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020943#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020944
Daniel Veillard42595322004-11-08 10:52:06 +000020945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020946}
20947
20948
20949static int
20950test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020952
20953 int mem_base;
20954 xmlNodePtr ret_val;
20955 xmlDocPtr doc; /* the document */
20956 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020957 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020958 int n_name;
20959
20960 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20961 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20962 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020963 doc = gen_xmlDocPtr(n_doc, 0);
20964 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020965
William M. Brackf13f77f2004-11-12 16:03:48 +000020966 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020967 desret_xmlNodePtr(ret_val);
20968 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020969 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020970 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020971 xmlResetLastError();
20972 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020973 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020975 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020976 printf(" %d", n_doc);
20977 printf(" %d", n_name);
20978 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020979 }
20980 }
20981 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020982 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020983
Daniel Veillard42595322004-11-08 10:52:06 +000020984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020985}
20986
20987
20988static int
20989test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020991
20992 int mem_base;
20993 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020994 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020995 int n_content;
20996
20997 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20998 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020999 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021000
William M. Brackf13f77f2004-11-12 16:03:48 +000021001 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021002 desret_xmlNodePtr(ret_val);
21003 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021004 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021005 xmlResetLastError();
21006 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021007 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021009 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021010 printf(" %d", n_content);
21011 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021012 }
21013 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021015
Daniel Veillard42595322004-11-08 10:52:06 +000021016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021017}
21018
21019
21020static int
21021test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021023
Daniel Veillarda521d282004-11-09 14:59:59 +000021024#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000021025 int mem_base;
21026 xmlNodePtr ret_val;
21027 xmlNodePtr parent; /* the parent node */
21028 int n_parent;
21029 xmlNsPtr ns; /* a namespace if any */
21030 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021031 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000021032 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021033 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000021034 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021035
Daniel Veillard27f20102004-11-05 11:50:11 +000021036 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
21037 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21038 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21039 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21040 mem_base = xmlMemBlocks();
21041 parent = gen_xmlNodePtr(n_parent, 0);
21042 ns = gen_xmlNsPtr(n_ns, 1);
21043 name = gen_const_xmlChar_ptr(n_name, 2);
21044 content = gen_const_xmlChar_ptr(n_content, 3);
21045
William M. Brackf13f77f2004-11-12 16:03:48 +000021046 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000021047 desret_xmlNodePtr(ret_val);
21048 call_tests++;
21049 des_xmlNodePtr(n_parent, parent, 0);
21050 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021051 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
21052 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000021053 xmlResetLastError();
21054 if (mem_base != xmlMemBlocks()) {
21055 printf("Leak of %d blocks found in xmlNewTextChild",
21056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021057 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000021058 printf(" %d", n_parent);
21059 printf(" %d", n_ns);
21060 printf(" %d", n_name);
21061 printf(" %d", n_content);
21062 printf("\n");
21063 }
21064 }
21065 }
21066 }
21067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021068 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021069#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000021070
Daniel Veillard42595322004-11-08 10:52:06 +000021071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021072}
21073
21074
21075static int
21076test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021078
21079 int mem_base;
21080 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021081 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021082 int n_content;
21083 int len; /* the text len. */
21084 int n_len;
21085
21086 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21087 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21088 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021089 content = gen_const_xmlChar_ptr(n_content, 0);
21090 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021091
William M. Brackf13f77f2004-11-12 16:03:48 +000021092 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021093 desret_xmlNodePtr(ret_val);
21094 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021095 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021096 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021097 xmlResetLastError();
21098 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021099 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021101 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021102 printf(" %d", n_content);
21103 printf(" %d", n_len);
21104 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021105 }
21106 }
21107 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021109
Daniel Veillard42595322004-11-08 10:52:06 +000021110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021111}
21112
21113
21114static int
21115test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021117
21118 int mem_base;
21119 xmlNodePtr cur; /* the node being modified */
21120 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021121 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021122 int n_content;
21123
21124 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21125 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21126 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021127 cur = gen_xmlNodePtr(n_cur, 0);
21128 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021129
William M. Brackf13f77f2004-11-12 16:03:48 +000021130 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021131 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021132 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021133 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021134 xmlResetLastError();
21135 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021136 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021138 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021139 printf(" %d", n_cur);
21140 printf(" %d", n_content);
21141 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021142 }
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_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021154
21155 int mem_base;
21156 xmlNodePtr cur; /* the node being modified */
21157 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021158 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021159 int n_content;
21160 int len; /* the size of @content */
21161 int n_len;
21162
21163 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21164 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21165 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021167 cur = gen_xmlNodePtr(n_cur, 0);
21168 content = gen_const_xmlChar_ptr(n_content, 1);
21169 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021170
William M. Brackf13f77f2004-11-12 16:03:48 +000021171 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021172 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021173 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021174 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021175 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021176 xmlResetLastError();
21177 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021178 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021180 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021181 printf(" %d", n_cur);
21182 printf(" %d", n_content);
21183 printf(" %d", n_len);
21184 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021185 }
21186 }
21187 }
21188 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021189 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021190
Daniel Veillard42595322004-11-08 10:52:06 +000021191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021192}
21193
21194
21195static int
21196test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021198
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021199 int mem_base;
21200 int ret_val;
21201 xmlBufferPtr buffer; /* a buffer */
21202 int n_buffer;
21203 xmlNodePtr cur; /* the node being read */
21204 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021205
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021206 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21207 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021209 buffer = gen_xmlBufferPtr(n_buffer, 0);
21210 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021211
21212 ret_val = xmlNodeBufGetContent(buffer, cur);
21213 desret_int(ret_val);
21214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021215 des_xmlBufferPtr(n_buffer, buffer, 0);
21216 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021217 xmlResetLastError();
21218 if (mem_base != xmlMemBlocks()) {
21219 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021221 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021222 printf(" %d", n_buffer);
21223 printf(" %d", n_cur);
21224 printf("\n");
21225 }
21226 }
21227 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021228 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021229
Daniel Veillard42595322004-11-08 10:52:06 +000021230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021231}
21232
21233
21234static int
21235test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021237
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021238#ifdef LIBXML_OUTPUT_ENABLED
21239 int mem_base;
21240 int ret_val;
21241 xmlBufferPtr buf; /* the XML buffer output */
21242 int n_buf;
21243 xmlDocPtr doc; /* the document */
21244 int n_doc;
21245 xmlNodePtr cur; /* the current node */
21246 int n_cur;
21247 int level; /* the imbrication level for indenting */
21248 int n_level;
21249 int format; /* is formatting allowed */
21250 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021251
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021252 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21253 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21254 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21255 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21256 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021258 buf = gen_xmlBufferPtr(n_buf, 0);
21259 doc = gen_xmlDocPtr(n_doc, 1);
21260 cur = gen_xmlNodePtr(n_cur, 2);
21261 level = gen_int(n_level, 3);
21262 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021263
21264 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21265 desret_int(ret_val);
21266 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021267 des_xmlBufferPtr(n_buf, buf, 0);
21268 des_xmlDocPtr(n_doc, doc, 1);
21269 des_xmlNodePtr(n_cur, cur, 2);
21270 des_int(n_level, level, 3);
21271 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021272 xmlResetLastError();
21273 if (mem_base != xmlMemBlocks()) {
21274 printf("Leak of %d blocks found in xmlNodeDump",
21275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021276 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021277 printf(" %d", n_buf);
21278 printf(" %d", n_doc);
21279 printf(" %d", n_cur);
21280 printf(" %d", n_level);
21281 printf(" %d", n_format);
21282 printf("\n");
21283 }
21284 }
21285 }
21286 }
21287 }
21288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021289 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021290#endif
21291
Daniel Veillard42595322004-11-08 10:52:06 +000021292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021293}
21294
21295
21296static int
21297test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021299
Daniel Veillard3d97e662004-11-04 10:49:00 +000021300#ifdef LIBXML_OUTPUT_ENABLED
21301 int mem_base;
21302 xmlOutputBufferPtr buf; /* the XML buffer output */
21303 int n_buf;
21304 xmlDocPtr doc; /* the document */
21305 int n_doc;
21306 xmlNodePtr cur; /* the current node */
21307 int n_cur;
21308 int level; /* the imbrication level for indenting */
21309 int n_level;
21310 int format; /* is formatting allowed */
21311 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021312 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021313 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021314
Daniel Veillard3d97e662004-11-04 10:49:00 +000021315 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21316 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21317 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21318 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21319 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21320 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21321 mem_base = xmlMemBlocks();
21322 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21323 doc = gen_xmlDocPtr(n_doc, 1);
21324 cur = gen_xmlNodePtr(n_cur, 2);
21325 level = gen_int(n_level, 3);
21326 format = gen_int(n_format, 4);
21327 encoding = gen_const_char_ptr(n_encoding, 5);
21328
William M. Brackf13f77f2004-11-12 16:03:48 +000021329 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021330 call_tests++;
21331 des_xmlOutputBufferPtr(n_buf, buf, 0);
21332 des_xmlDocPtr(n_doc, doc, 1);
21333 des_xmlNodePtr(n_cur, cur, 2);
21334 des_int(n_level, level, 3);
21335 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021336 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021337 xmlResetLastError();
21338 if (mem_base != xmlMemBlocks()) {
21339 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021341 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021342 printf(" %d", n_buf);
21343 printf(" %d", n_doc);
21344 printf(" %d", n_cur);
21345 printf(" %d", n_level);
21346 printf(" %d", n_format);
21347 printf(" %d", n_encoding);
21348 printf("\n");
21349 }
21350 }
21351 }
21352 }
21353 }
21354 }
21355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021356 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021357#endif
21358
Daniel Veillard42595322004-11-08 10:52:06 +000021359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021360}
21361
21362
21363static int
21364test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021366
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021367 int mem_base;
21368 xmlChar * ret_val;
21369 xmlDocPtr doc; /* the document the node pertains to */
21370 int n_doc;
21371 xmlNodePtr cur; /* the node being checked */
21372 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021373
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021374 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21375 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21376 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021377 doc = gen_xmlDocPtr(n_doc, 0);
21378 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021379
21380 ret_val = xmlNodeGetBase(doc, cur);
21381 desret_xmlChar_ptr(ret_val);
21382 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021383 des_xmlDocPtr(n_doc, doc, 0);
21384 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021385 xmlResetLastError();
21386 if (mem_base != xmlMemBlocks()) {
21387 printf("Leak of %d blocks found in xmlNodeGetBase",
21388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021389 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021390 printf(" %d", n_doc);
21391 printf(" %d", n_cur);
21392 printf("\n");
21393 }
21394 }
21395 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021396 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021397
Daniel Veillard42595322004-11-08 10:52:06 +000021398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021399}
21400
21401
21402static int
21403test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021405
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021406 int mem_base;
21407 xmlChar * ret_val;
21408 xmlNodePtr cur; /* the node being read */
21409 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021410
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021411 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21412 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021413 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021414
21415 ret_val = xmlNodeGetContent(cur);
21416 desret_xmlChar_ptr(ret_val);
21417 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021418 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021419 xmlResetLastError();
21420 if (mem_base != xmlMemBlocks()) {
21421 printf("Leak of %d blocks found in xmlNodeGetContent",
21422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021423 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021424 printf(" %d", n_cur);
21425 printf("\n");
21426 }
21427 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021428 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021429
Daniel Veillard42595322004-11-08 10:52:06 +000021430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021431}
21432
21433
21434static int
21435test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021437
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021438 int mem_base;
21439 xmlChar * ret_val;
21440 xmlNodePtr cur; /* the node being checked */
21441 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021442
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021443 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21444 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021445 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021446
21447 ret_val = xmlNodeGetLang(cur);
21448 desret_xmlChar_ptr(ret_val);
21449 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021450 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021451 xmlResetLastError();
21452 if (mem_base != xmlMemBlocks()) {
21453 printf("Leak of %d blocks found in xmlNodeGetLang",
21454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021455 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021456 printf(" %d", n_cur);
21457 printf("\n");
21458 }
21459 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021460 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021461
Daniel Veillard42595322004-11-08 10:52:06 +000021462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021463}
21464
21465
21466static int
21467test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021469
21470 int mem_base;
21471 int ret_val;
21472 xmlNodePtr cur; /* the node being checked */
21473 int n_cur;
21474
21475 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021477 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021478
21479 ret_val = xmlNodeGetSpacePreserve(cur);
21480 desret_int(ret_val);
21481 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021482 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021483 xmlResetLastError();
21484 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021485 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021487 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021488 printf(" %d", n_cur);
21489 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021490 }
21491 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021493
Daniel Veillard42595322004-11-08 10:52:06 +000021494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021495}
21496
21497
21498static int
21499test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021501
21502 int mem_base;
21503 int ret_val;
21504 xmlNodePtr node; /* the node */
21505 int n_node;
21506
21507 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021509 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021510
21511 ret_val = xmlNodeIsText(node);
21512 desret_int(ret_val);
21513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021514 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021515 xmlResetLastError();
21516 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021517 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021519 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021520 printf(" %d", n_node);
21521 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021522 }
21523 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021525
Daniel Veillard42595322004-11-08 10:52:06 +000021526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021527}
21528
21529
21530static int
21531test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021533
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021534#ifdef LIBXML_TREE_ENABLED
21535 int mem_base;
21536 xmlChar * ret_val;
21537 xmlDocPtr doc; /* the document */
21538 int n_doc;
21539 xmlNodePtr list; /* a Node list */
21540 int n_list;
21541 int inLine; /* should we replace entity contents or show their external form */
21542 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021543
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021544 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21545 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21546 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21547 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021548 doc = gen_xmlDocPtr(n_doc, 0);
21549 list = gen_xmlNodePtr(n_list, 1);
21550 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021551
21552 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21553 desret_xmlChar_ptr(ret_val);
21554 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021555 des_xmlDocPtr(n_doc, doc, 0);
21556 des_xmlNodePtr(n_list, list, 1);
21557 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021558 xmlResetLastError();
21559 if (mem_base != xmlMemBlocks()) {
21560 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021562 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021563 printf(" %d", n_doc);
21564 printf(" %d", n_list);
21565 printf(" %d", n_inLine);
21566 printf("\n");
21567 }
21568 }
21569 }
21570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021571 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021572#endif
21573
Daniel Veillard42595322004-11-08 10:52:06 +000021574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021575}
21576
21577
21578static int
21579test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021581
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021582 int mem_base;
21583 xmlChar * ret_val;
21584 xmlDocPtr doc; /* the document */
21585 int n_doc;
21586 xmlNodePtr list; /* a Node list */
21587 int n_list;
21588 int inLine; /* should we replace entity contents or show their external form */
21589 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021590
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021591 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21592 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21593 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21594 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021595 doc = gen_xmlDocPtr(n_doc, 0);
21596 list = gen_xmlNodePtr(n_list, 1);
21597 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021598
21599 ret_val = xmlNodeListGetString(doc, list, inLine);
21600 desret_xmlChar_ptr(ret_val);
21601 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021602 des_xmlDocPtr(n_doc, doc, 0);
21603 des_xmlNodePtr(n_list, list, 1);
21604 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021605 xmlResetLastError();
21606 if (mem_base != xmlMemBlocks()) {
21607 printf("Leak of %d blocks found in xmlNodeListGetString",
21608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021609 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021610 printf(" %d", n_doc);
21611 printf(" %d", n_list);
21612 printf(" %d", n_inLine);
21613 printf("\n");
21614 }
21615 }
21616 }
21617 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021618 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021619
Daniel Veillard42595322004-11-08 10:52:06 +000021620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021621}
21622
21623
21624static int
21625test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021627
21628#ifdef LIBXML_TREE_ENABLED
21629 int mem_base;
21630 xmlNodePtr cur; /* the node being changed */
21631 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021632 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021633 int n_uri;
21634
21635 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21636 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21637 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021638 cur = gen_xmlNodePtr(n_cur, 0);
21639 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021640
William M. Brackf13f77f2004-11-12 16:03:48 +000021641 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021642 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021643 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021644 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021645 xmlResetLastError();
21646 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021647 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021649 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021650 printf(" %d", n_cur);
21651 printf(" %d", n_uri);
21652 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021653 }
21654 }
21655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021656 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021657#endif
21658
Daniel Veillard42595322004-11-08 10:52:06 +000021659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021660}
21661
21662
21663static int
21664test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021666
21667 int mem_base;
21668 xmlNodePtr cur; /* the node being modified */
21669 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021670 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021671 int n_content;
21672
21673 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21674 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21675 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021676 cur = gen_xmlNodePtr(n_cur, 0);
21677 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021678
William M. Brackf13f77f2004-11-12 16:03:48 +000021679 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021680 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021681 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021682 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021683 xmlResetLastError();
21684 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021685 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021687 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021688 printf(" %d", n_cur);
21689 printf(" %d", n_content);
21690 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021691 }
21692 }
21693 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021694 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021695
Daniel Veillard42595322004-11-08 10:52:06 +000021696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021697}
21698
21699
21700static int
21701test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021703
21704#ifdef LIBXML_TREE_ENABLED
21705 int mem_base;
21706 xmlNodePtr cur; /* the node being modified */
21707 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021708 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021709 int n_content;
21710 int len; /* the size of @content */
21711 int n_len;
21712
21713 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21714 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21715 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021717 cur = gen_xmlNodePtr(n_cur, 0);
21718 content = gen_const_xmlChar_ptr(n_content, 1);
21719 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021720
William M. Brackf13f77f2004-11-12 16:03:48 +000021721 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021723 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021724 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021725 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021726 xmlResetLastError();
21727 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021728 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021730 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021731 printf(" %d", n_cur);
21732 printf(" %d", n_content);
21733 printf(" %d", n_len);
21734 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021735 }
21736 }
21737 }
21738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021739 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021740#endif
21741
Daniel Veillard42595322004-11-08 10:52:06 +000021742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021743}
21744
21745
21746static int
21747test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021749
21750#ifdef LIBXML_TREE_ENABLED
21751 int mem_base;
21752 xmlNodePtr cur; /* the node being changed */
21753 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021754 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021755 int n_lang;
21756
21757 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21758 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021760 cur = gen_xmlNodePtr(n_cur, 0);
21761 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021762
William M. Brackf13f77f2004-11-12 16:03:48 +000021763 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021764 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021765 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021766 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021767 xmlResetLastError();
21768 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021769 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021771 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021772 printf(" %d", n_cur);
21773 printf(" %d", n_lang);
21774 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021775 }
21776 }
21777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021778 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021779#endif
21780
Daniel Veillard42595322004-11-08 10:52:06 +000021781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021782}
21783
21784
21785static int
21786test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021788
21789#ifdef LIBXML_TREE_ENABLED
21790 int mem_base;
21791 xmlNodePtr cur; /* the node being changed */
21792 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021793 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021794 int n_name;
21795
21796 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21797 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021799 cur = gen_xmlNodePtr(n_cur, 0);
21800 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021801
William M. Brackf13f77f2004-11-12 16:03:48 +000021802 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021803 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021804 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021805 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021806 xmlResetLastError();
21807 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021808 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021810 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021811 printf(" %d", n_cur);
21812 printf(" %d", n_name);
21813 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021814 }
21815 }
21816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021817 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021818#endif
21819
Daniel Veillard42595322004-11-08 10:52:06 +000021820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021821}
21822
21823
21824static int
21825test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021827
21828#ifdef LIBXML_TREE_ENABLED
21829 int mem_base;
21830 xmlNodePtr cur; /* the node being changed */
21831 int n_cur;
21832 int val; /* the xml:space value ("0": default, 1: "preserve") */
21833 int n_val;
21834
21835 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21836 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021838 cur = gen_xmlNodePtr(n_cur, 0);
21839 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021840
21841 xmlNodeSetSpacePreserve(cur, val);
21842 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021843 des_xmlNodePtr(n_cur, cur, 0);
21844 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021845 xmlResetLastError();
21846 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021847 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021849 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021850 printf(" %d", n_cur);
21851 printf(" %d", n_val);
21852 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021853 }
21854 }
21855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021856 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021857#endif
21858
Daniel Veillard42595322004-11-08 10:52:06 +000021859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021860}
21861
21862
21863static int
21864test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021866
Daniel Veillarda521d282004-11-09 14:59:59 +000021867#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021868 int mem_base;
21869 int ret_val;
21870 xmlDocPtr doc; /* the document */
21871 int n_doc;
21872 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21873 int n_tree;
21874
21875 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21876 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21877 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021878 doc = gen_xmlDocPtr(n_doc, 0);
21879 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021880
21881 ret_val = xmlReconciliateNs(doc, tree);
21882 desret_int(ret_val);
21883 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021884 des_xmlDocPtr(n_doc, doc, 0);
21885 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021886 xmlResetLastError();
21887 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021888 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021890 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021891 printf(" %d", n_doc);
21892 printf(" %d", n_tree);
21893 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021894 }
21895 }
21896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021897 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021898#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021899
Daniel Veillard42595322004-11-08 10:52:06 +000021900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021901}
21902
21903
21904static int
21905test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021907
Daniel Veillardce244ad2004-11-05 10:03:46 +000021908#ifdef LIBXML_TREE_ENABLED
21909 int mem_base;
21910 int ret_val;
21911 xmlAttrPtr cur; /* an attribute */
21912 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021913
Daniel Veillardce244ad2004-11-05 10:03:46 +000021914 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21915 mem_base = xmlMemBlocks();
21916 cur = gen_xmlAttrPtr(n_cur, 0);
21917
21918 ret_val = xmlRemoveProp(cur);
21919 cur = NULL;
21920 desret_int(ret_val);
21921 call_tests++;
21922 des_xmlAttrPtr(n_cur, cur, 0);
21923 xmlResetLastError();
21924 if (mem_base != xmlMemBlocks()) {
21925 printf("Leak of %d blocks found in xmlRemoveProp",
21926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021927 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021928 printf(" %d", n_cur);
21929 printf("\n");
21930 }
21931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021932 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021933#endif
21934
Daniel Veillard42595322004-11-08 10:52:06 +000021935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021936}
21937
21938
21939static int
21940test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021942
21943#ifdef LIBXML_TREE_ENABLED
21944 int mem_base;
21945 xmlNodePtr ret_val;
21946 xmlNodePtr old; /* the old node */
21947 int n_old;
21948 xmlNodePtr cur; /* the node */
21949 int n_cur;
21950
21951 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021952 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021953 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021954 old = gen_xmlNodePtr(n_old, 0);
21955 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021956
21957 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021958 if (cur != NULL) {
21959 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021960 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021961 if (old != NULL) {
21962 xmlUnlinkNode(old);
21963 xmlFreeNode(old) ; old = NULL ; }
21964 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021965 desret_xmlNodePtr(ret_val);
21966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021967 des_xmlNodePtr(n_old, old, 0);
21968 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021969 xmlResetLastError();
21970 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021971 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021973 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021974 printf(" %d", n_old);
21975 printf(" %d", n_cur);
21976 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021977 }
21978 }
21979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021980 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021981#endif
21982
Daniel Veillard42595322004-11-08 10:52:06 +000021983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021984}
21985
21986
21987static int
21988test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021990
21991#ifdef LIBXML_OUTPUT_ENABLED
21992 int mem_base;
21993 int ret_val;
21994 const char * filename; /* the filename (or URL) */
21995 int n_filename;
21996 xmlDocPtr cur; /* the document */
21997 int n_cur;
21998
21999 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22000 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22001 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022002 filename = gen_fileoutput(n_filename, 0);
22003 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022004
22005 ret_val = xmlSaveFile(filename, cur);
22006 desret_int(ret_val);
22007 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022008 des_fileoutput(n_filename, filename, 0);
22009 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022010 xmlResetLastError();
22011 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022012 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022014 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022015 printf(" %d", n_filename);
22016 printf(" %d", n_cur);
22017 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022018 }
22019 }
22020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022021 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022022#endif
22023
Daniel Veillard42595322004-11-08 10:52:06 +000022024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022025}
22026
22027
22028static int
22029test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022031
22032#ifdef LIBXML_OUTPUT_ENABLED
22033 int mem_base;
22034 int ret_val;
22035 const char * filename; /* the filename (or URL) */
22036 int n_filename;
22037 xmlDocPtr cur; /* the document */
22038 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022039 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022040 int n_encoding;
22041
22042 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22043 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22044 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22045 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022046 filename = gen_fileoutput(n_filename, 0);
22047 cur = gen_xmlDocPtr(n_cur, 1);
22048 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022049
William M. Brackf13f77f2004-11-12 16:03:48 +000022050 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022051 desret_int(ret_val);
22052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022053 des_fileoutput(n_filename, filename, 0);
22054 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022055 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022056 xmlResetLastError();
22057 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022058 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022060 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022061 printf(" %d", n_filename);
22062 printf(" %d", n_cur);
22063 printf(" %d", n_encoding);
22064 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022065 }
22066 }
22067 }
22068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022069 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022070#endif
22071
Daniel Veillard42595322004-11-08 10:52:06 +000022072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022073}
22074
22075
22076static int
22077test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022079
Daniel Veillard3d97e662004-11-04 10:49:00 +000022080#ifdef LIBXML_OUTPUT_ENABLED
22081 int mem_base;
22082 int ret_val;
22083 xmlOutputBufferPtr buf; /* an output I/O buffer */
22084 int n_buf;
22085 xmlDocPtr cur; /* the document */
22086 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022087 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022088 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022089
Daniel Veillard3d97e662004-11-04 10:49:00 +000022090 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22091 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22092 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22093 mem_base = xmlMemBlocks();
22094 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22095 cur = gen_xmlDocPtr(n_cur, 1);
22096 encoding = gen_const_char_ptr(n_encoding, 2);
22097
William M. Brackf13f77f2004-11-12 16:03:48 +000022098 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022099 buf = NULL;
22100 desret_int(ret_val);
22101 call_tests++;
22102 des_xmlOutputBufferPtr(n_buf, buf, 0);
22103 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022104 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022105 xmlResetLastError();
22106 if (mem_base != xmlMemBlocks()) {
22107 printf("Leak of %d blocks found in xmlSaveFileTo",
22108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022109 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022110 printf(" %d", n_buf);
22111 printf(" %d", n_cur);
22112 printf(" %d", n_encoding);
22113 printf("\n");
22114 }
22115 }
22116 }
22117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022118 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022119#endif
22120
Daniel Veillard42595322004-11-08 10:52:06 +000022121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022122}
22123
22124
22125static int
22126test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022128
22129#ifdef LIBXML_OUTPUT_ENABLED
22130 int mem_base;
22131 int ret_val;
22132 const char * filename; /* the filename (or URL) */
22133 int n_filename;
22134 xmlDocPtr cur; /* the document */
22135 int n_cur;
22136 int format; /* should formatting spaces been added */
22137 int n_format;
22138
22139 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22140 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22141 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22142 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022143 filename = gen_fileoutput(n_filename, 0);
22144 cur = gen_xmlDocPtr(n_cur, 1);
22145 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022146
22147 ret_val = xmlSaveFormatFile(filename, cur, format);
22148 desret_int(ret_val);
22149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022150 des_fileoutput(n_filename, filename, 0);
22151 des_xmlDocPtr(n_cur, cur, 1);
22152 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022153 xmlResetLastError();
22154 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022155 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022157 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022158 printf(" %d", n_filename);
22159 printf(" %d", n_cur);
22160 printf(" %d", n_format);
22161 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022162 }
22163 }
22164 }
22165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022166 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022167#endif
22168
Daniel Veillard42595322004-11-08 10:52:06 +000022169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022170}
22171
22172
22173static int
22174test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022176
22177#ifdef LIBXML_OUTPUT_ENABLED
22178 int mem_base;
22179 int ret_val;
22180 const char * filename; /* the filename or URL to output */
22181 int n_filename;
22182 xmlDocPtr cur; /* the document being saved */
22183 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022184 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022185 int n_encoding;
22186 int format; /* should formatting spaces be added. */
22187 int n_format;
22188
22189 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22190 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22191 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22192 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22193 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022194 filename = gen_fileoutput(n_filename, 0);
22195 cur = gen_xmlDocPtr(n_cur, 1);
22196 encoding = gen_const_char_ptr(n_encoding, 2);
22197 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022198
William M. Brackf13f77f2004-11-12 16:03:48 +000022199 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022200 desret_int(ret_val);
22201 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022202 des_fileoutput(n_filename, filename, 0);
22203 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022204 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022205 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022206 xmlResetLastError();
22207 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022208 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022210 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022211 printf(" %d", n_filename);
22212 printf(" %d", n_cur);
22213 printf(" %d", n_encoding);
22214 printf(" %d", n_format);
22215 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022216 }
22217 }
22218 }
22219 }
22220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022221 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022222#endif
22223
Daniel Veillard42595322004-11-08 10:52:06 +000022224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022225}
22226
22227
22228static int
22229test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022231
Daniel Veillard3d97e662004-11-04 10:49:00 +000022232#ifdef LIBXML_OUTPUT_ENABLED
22233 int mem_base;
22234 int ret_val;
22235 xmlOutputBufferPtr buf; /* an output I/O buffer */
22236 int n_buf;
22237 xmlDocPtr cur; /* the document */
22238 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022239 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022240 int n_encoding;
22241 int format; /* should formatting spaces been added */
22242 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022243
Daniel Veillard3d97e662004-11-04 10:49:00 +000022244 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22245 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22246 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22247 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22248 mem_base = xmlMemBlocks();
22249 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22250 cur = gen_xmlDocPtr(n_cur, 1);
22251 encoding = gen_const_char_ptr(n_encoding, 2);
22252 format = gen_int(n_format, 3);
22253
William M. Brackf13f77f2004-11-12 16:03:48 +000022254 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022255 buf = NULL;
22256 desret_int(ret_val);
22257 call_tests++;
22258 des_xmlOutputBufferPtr(n_buf, buf, 0);
22259 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022260 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022261 des_int(n_format, format, 3);
22262 xmlResetLastError();
22263 if (mem_base != xmlMemBlocks()) {
22264 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022266 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022267 printf(" %d", n_buf);
22268 printf(" %d", n_cur);
22269 printf(" %d", n_encoding);
22270 printf(" %d", n_format);
22271 printf("\n");
22272 }
22273 }
22274 }
22275 }
22276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022277 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022278#endif
22279
Daniel Veillard42595322004-11-08 10:52:06 +000022280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022281}
22282
22283
22284static int
22285test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022287
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022288 int mem_base;
22289 xmlNsPtr ret_val;
22290 xmlDocPtr doc; /* the document */
22291 int n_doc;
22292 xmlNodePtr node; /* the current node */
22293 int n_node;
22294 xmlChar * nameSpace; /* the namespace prefix */
22295 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022296
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022297 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22298 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22299 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22300 mem_base = xmlMemBlocks();
22301 doc = gen_xmlDocPtr(n_doc, 0);
22302 node = gen_xmlNodePtr(n_node, 1);
22303 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22304
William M. Brackf13f77f2004-11-12 16:03:48 +000022305 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022306 desret_xmlNsPtr(ret_val);
22307 call_tests++;
22308 des_xmlDocPtr(n_doc, doc, 0);
22309 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022310 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022311 xmlResetLastError();
22312 if (mem_base != xmlMemBlocks()) {
22313 printf("Leak of %d blocks found in xmlSearchNs",
22314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022315 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022316 printf(" %d", n_doc);
22317 printf(" %d", n_node);
22318 printf(" %d", n_nameSpace);
22319 printf("\n");
22320 }
22321 }
22322 }
22323 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022324 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022325
Daniel Veillard42595322004-11-08 10:52:06 +000022326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022327}
22328
22329
22330static int
22331test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022333
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022334 int mem_base;
22335 xmlNsPtr ret_val;
22336 xmlDocPtr doc; /* the document */
22337 int n_doc;
22338 xmlNodePtr node; /* the current node */
22339 int n_node;
22340 xmlChar * href; /* the namespace value */
22341 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022342
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022343 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22344 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22345 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22346 mem_base = xmlMemBlocks();
22347 doc = gen_xmlDocPtr(n_doc, 0);
22348 node = gen_xmlNodePtr(n_node, 1);
22349 href = gen_const_xmlChar_ptr(n_href, 2);
22350
William M. Brackf13f77f2004-11-12 16:03:48 +000022351 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022352 desret_xmlNsPtr(ret_val);
22353 call_tests++;
22354 des_xmlDocPtr(n_doc, doc, 0);
22355 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022356 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022357 xmlResetLastError();
22358 if (mem_base != xmlMemBlocks()) {
22359 printf("Leak of %d blocks found in xmlSearchNsByHref",
22360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022361 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022362 printf(" %d", n_doc);
22363 printf(" %d", n_node);
22364 printf(" %d", n_href);
22365 printf("\n");
22366 }
22367 }
22368 }
22369 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022371
Daniel Veillard42595322004-11-08 10:52:06 +000022372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022373}
22374
22375
22376static int
22377test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022379
Daniel Veillard57b25162004-11-06 14:50:18 +000022380 int mem_base;
22381 xmlBufferAllocationScheme scheme; /* allocation method to use */
22382 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022383
Daniel Veillard57b25162004-11-06 14:50:18 +000022384 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22385 mem_base = xmlMemBlocks();
22386 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22387
22388 xmlSetBufferAllocationScheme(scheme);
22389 call_tests++;
22390 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22391 xmlResetLastError();
22392 if (mem_base != xmlMemBlocks()) {
22393 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022395 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022396 printf(" %d", n_scheme);
22397 printf("\n");
22398 }
22399 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022400 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022401
Daniel Veillard42595322004-11-08 10:52:06 +000022402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022403}
22404
22405
22406static int
22407test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022409
22410 int mem_base;
22411 int mode; /* the compression ratio */
22412 int n_mode;
22413
22414 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22415 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022416 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022417
22418 xmlSetCompressMode(mode);
22419 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022420 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022421 xmlResetLastError();
22422 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022423 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022425 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022426 printf(" %d", n_mode);
22427 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022428 }
22429 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022431
Daniel Veillard42595322004-11-08 10:52:06 +000022432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022433}
22434
22435
22436static int
22437test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022439
22440 int mem_base;
22441 xmlDocPtr doc; /* the document */
22442 int n_doc;
22443 int mode; /* the compression ratio */
22444 int n_mode;
22445
22446 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22447 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22448 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022449 doc = gen_xmlDocPtr(n_doc, 0);
22450 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022451
22452 xmlSetDocCompressMode(doc, mode);
22453 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022454 des_xmlDocPtr(n_doc, doc, 0);
22455 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022456 xmlResetLastError();
22457 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022458 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022460 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022461 printf(" %d", n_doc);
22462 printf(" %d", n_mode);
22463 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022464 }
22465 }
22466 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022467 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022468
Daniel Veillard42595322004-11-08 10:52:06 +000022469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022470}
22471
22472
22473static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022474test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022476
Daniel Veillard27f20102004-11-05 11:50:11 +000022477 int mem_base;
22478 xmlNodePtr node; /* a node in the document */
22479 int n_node;
22480 xmlNsPtr ns; /* a namespace pointer */
22481 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022482
Daniel Veillard27f20102004-11-05 11:50:11 +000022483 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22484 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22485 mem_base = xmlMemBlocks();
22486 node = gen_xmlNodePtr(n_node, 0);
22487 ns = gen_xmlNsPtr(n_ns, 1);
22488
22489 xmlSetNs(node, ns);
22490 call_tests++;
22491 des_xmlNodePtr(n_node, node, 0);
22492 des_xmlNsPtr(n_ns, ns, 1);
22493 xmlResetLastError();
22494 if (mem_base != xmlMemBlocks()) {
22495 printf("Leak of %d blocks found in xmlSetNs",
22496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022497 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022498 printf(" %d", n_node);
22499 printf(" %d", n_ns);
22500 printf("\n");
22501 }
22502 }
22503 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022505
Daniel Veillard42595322004-11-08 10:52:06 +000022506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022507}
22508
22509
22510static int
22511test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022513
Daniel Veillard57b25162004-11-06 14:50:18 +000022514#ifdef LIBXML_TREE_ENABLED
22515 int mem_base;
22516 xmlAttrPtr ret_val;
22517 xmlNodePtr node; /* the node */
22518 int n_node;
22519 xmlNsPtr ns; /* the namespace definition */
22520 int n_ns;
22521 xmlChar * name; /* the attribute name */
22522 int n_name;
22523 xmlChar * value; /* the attribute value */
22524 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022525
Daniel Veillard57b25162004-11-06 14:50:18 +000022526 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22527 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22528 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22529 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22530 mem_base = xmlMemBlocks();
22531 node = gen_xmlNodePtr(n_node, 0);
22532 ns = gen_xmlNsPtr(n_ns, 1);
22533 name = gen_const_xmlChar_ptr(n_name, 2);
22534 value = gen_const_xmlChar_ptr(n_value, 3);
22535
William M. Brackf13f77f2004-11-12 16:03:48 +000022536 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022537 desret_xmlAttrPtr(ret_val);
22538 call_tests++;
22539 des_xmlNodePtr(n_node, node, 0);
22540 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022541 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22542 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022543 xmlResetLastError();
22544 if (mem_base != xmlMemBlocks()) {
22545 printf("Leak of %d blocks found in xmlSetNsProp",
22546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022547 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022548 printf(" %d", n_node);
22549 printf(" %d", n_ns);
22550 printf(" %d", n_name);
22551 printf(" %d", n_value);
22552 printf("\n");
22553 }
22554 }
22555 }
22556 }
22557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022558 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022559#endif
22560
Daniel Veillard42595322004-11-08 10:52:06 +000022561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022562}
22563
22564
22565static int
22566test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022568
Daniel Veillard57b25162004-11-06 14:50:18 +000022569#ifdef LIBXML_TREE_ENABLED
22570 int mem_base;
22571 xmlAttrPtr ret_val;
22572 xmlNodePtr node; /* the node */
22573 int n_node;
22574 xmlChar * name; /* the attribute name */
22575 int n_name;
22576 xmlChar * value; /* the attribute value */
22577 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022578
Daniel Veillard57b25162004-11-06 14:50:18 +000022579 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22580 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22581 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22582 mem_base = xmlMemBlocks();
22583 node = gen_xmlNodePtr(n_node, 0);
22584 name = gen_const_xmlChar_ptr(n_name, 1);
22585 value = gen_const_xmlChar_ptr(n_value, 2);
22586
William M. Brackf13f77f2004-11-12 16:03:48 +000022587 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022588 desret_xmlAttrPtr(ret_val);
22589 call_tests++;
22590 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022591 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22592 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022593 xmlResetLastError();
22594 if (mem_base != xmlMemBlocks()) {
22595 printf("Leak of %d blocks found in xmlSetProp",
22596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022597 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022598 printf(" %d", n_node);
22599 printf(" %d", n_name);
22600 printf(" %d", n_value);
22601 printf("\n");
22602 }
22603 }
22604 }
22605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022606 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022607#endif
22608
Daniel Veillard42595322004-11-08 10:52:06 +000022609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022610}
22611
22612
22613static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022614test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022616
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022617 int mem_base;
22618 xmlChar * ret_val;
22619 xmlChar * name; /* the full QName */
22620 int n_name;
22621 xmlChar ** prefix; /* a xmlChar ** */
22622 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022623
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022624 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22625 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22626 mem_base = xmlMemBlocks();
22627 name = gen_const_xmlChar_ptr(n_name, 0);
22628 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22629
William M. Brackf13f77f2004-11-12 16:03:48 +000022630 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022631 desret_xmlChar_ptr(ret_val);
22632 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022633 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022634 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22635 xmlResetLastError();
22636 if (mem_base != xmlMemBlocks()) {
22637 printf("Leak of %d blocks found in xmlSplitQName2",
22638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022639 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022640 printf(" %d", n_name);
22641 printf(" %d", n_prefix);
22642 printf("\n");
22643 }
22644 }
22645 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022646 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022647
Daniel Veillard42595322004-11-08 10:52:06 +000022648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022649}
22650
22651
22652static int
22653test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022655
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022656 int mem_base;
22657 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022658 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022659 int n_name;
22660 int * len; /* an int * */
22661 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022662
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022663 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22664 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22665 mem_base = xmlMemBlocks();
22666 name = gen_const_xmlChar_ptr(n_name, 0);
22667 len = gen_int_ptr(n_len, 1);
22668
William M. Brackf13f77f2004-11-12 16:03:48 +000022669 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022670 desret_const_xmlChar_ptr(ret_val);
22671 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022672 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022673 des_int_ptr(n_len, len, 1);
22674 xmlResetLastError();
22675 if (mem_base != xmlMemBlocks()) {
22676 printf("Leak of %d blocks found in xmlSplitQName3",
22677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022678 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022679 printf(" %d", n_name);
22680 printf(" %d", n_len);
22681 printf("\n");
22682 }
22683 }
22684 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022685 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022686
Daniel Veillard42595322004-11-08 10:52:06 +000022687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022688}
22689
22690
22691static int
22692test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694
22695 int mem_base;
22696 xmlNodePtr ret_val;
22697 xmlDocPtr doc; /* the document */
22698 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022699 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022700 int n_value;
22701
22702 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22703 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022705 doc = gen_xmlDocPtr(n_doc, 0);
22706 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707
William M. Brackf13f77f2004-11-12 16:03:48 +000022708 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022709 desret_xmlNodePtr(ret_val);
22710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022711 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022712 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022713 xmlResetLastError();
22714 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022715 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022717 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022718 printf(" %d", n_doc);
22719 printf(" %d", n_value);
22720 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022721 }
22722 }
22723 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022725
Daniel Veillard42595322004-11-08 10:52:06 +000022726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022727}
22728
22729
22730static int
22731test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733
22734 int mem_base;
22735 xmlNodePtr ret_val;
22736 xmlDocPtr doc; /* the document */
22737 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022738 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022739 int n_value;
22740 int len; /* the length of the string value */
22741 int n_len;
22742
22743 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22744 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22745 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022747 doc = gen_xmlDocPtr(n_doc, 0);
22748 value = gen_const_xmlChar_ptr(n_value, 1);
22749 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022750
William M. Brackf13f77f2004-11-12 16:03:48 +000022751 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022752 desret_xmlNodePtr(ret_val);
22753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022754 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022755 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022756 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022757 xmlResetLastError();
22758 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022759 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022761 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022762 printf(" %d", n_doc);
22763 printf(" %d", n_value);
22764 printf(" %d", n_len);
22765 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022766 }
22767 }
22768 }
22769 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022770 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022771
Daniel Veillard42595322004-11-08 10:52:06 +000022772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022773}
22774
22775
22776static int
22777test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022779
22780 int mem_base;
22781 int ret_val;
22782 xmlNodePtr node; /* the node */
22783 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022784 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022785 int n_content;
22786 int len; /* @content length */
22787 int n_len;
22788
22789 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22790 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22791 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022793 node = gen_xmlNodePtr(n_node, 0);
22794 content = gen_const_xmlChar_ptr(n_content, 1);
22795 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022796
William M. Brackf13f77f2004-11-12 16:03:48 +000022797 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022798 desret_int(ret_val);
22799 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022800 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022801 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022802 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022803 xmlResetLastError();
22804 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022805 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022807 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022808 printf(" %d", n_node);
22809 printf(" %d", n_content);
22810 printf(" %d", n_len);
22811 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022812 }
22813 }
22814 }
22815 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022816 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022817
Daniel Veillard42595322004-11-08 10:52:06 +000022818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022819}
22820
22821
22822static int
22823test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022825
22826 int mem_base;
22827 xmlNodePtr ret_val;
22828 xmlNodePtr first; /* the first text node */
22829 int n_first;
22830 xmlNodePtr second; /* the second text node being merged */
22831 int n_second;
22832
Daniel Veillarda03e3652004-11-02 18:45:30 +000022833 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22834 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022836 first = gen_xmlNodePtr_in(n_first, 0);
22837 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022838
22839 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022840 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022841 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022842 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022843 desret_xmlNodePtr(ret_val);
22844 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022845 des_xmlNodePtr_in(n_first, first, 0);
22846 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022847 xmlResetLastError();
22848 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022849 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022851 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022852 printf(" %d", n_first);
22853 printf(" %d", n_second);
22854 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022855 }
22856 }
22857 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022858 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022859
Daniel Veillard42595322004-11-08 10:52:06 +000022860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022861}
22862
22863
22864static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022865test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022867
Daniel Veillard27f20102004-11-05 11:50:11 +000022868#ifdef LIBXML_TREE_ENABLED
22869 int mem_base;
22870 int ret_val;
22871 xmlNodePtr node; /* the node */
22872 int n_node;
22873 xmlNsPtr ns; /* the namespace definition */
22874 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022875 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022876 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022877
Daniel Veillard27f20102004-11-05 11:50:11 +000022878 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22879 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22880 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22881 mem_base = xmlMemBlocks();
22882 node = gen_xmlNodePtr(n_node, 0);
22883 ns = gen_xmlNsPtr(n_ns, 1);
22884 name = gen_const_xmlChar_ptr(n_name, 2);
22885
William M. Brackf13f77f2004-11-12 16:03:48 +000022886 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022887 desret_int(ret_val);
22888 call_tests++;
22889 des_xmlNodePtr(n_node, node, 0);
22890 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022891 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022892 xmlResetLastError();
22893 if (mem_base != xmlMemBlocks()) {
22894 printf("Leak of %d blocks found in xmlUnsetNsProp",
22895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022896 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022897 printf(" %d", n_node);
22898 printf(" %d", n_ns);
22899 printf(" %d", n_name);
22900 printf("\n");
22901 }
22902 }
22903 }
22904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022905 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022906#endif
22907
Daniel Veillard42595322004-11-08 10:52:06 +000022908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022909}
22910
22911
22912static int
22913test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022915
22916#ifdef LIBXML_TREE_ENABLED
22917 int mem_base;
22918 int ret_val;
22919 xmlNodePtr node; /* the node */
22920 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022921 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022922 int n_name;
22923
22924 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22925 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022927 node = gen_xmlNodePtr(n_node, 0);
22928 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022929
William M. Brackf13f77f2004-11-12 16:03:48 +000022930 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022931 desret_int(ret_val);
22932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022933 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022934 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022935 xmlResetLastError();
22936 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022937 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022939 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022940 printf(" %d", n_node);
22941 printf(" %d", n_name);
22942 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022943 }
22944 }
22945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022946 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022947#endif
22948
Daniel Veillard42595322004-11-08 10:52:06 +000022949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022950}
22951
22952
22953static int
22954test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022956
Daniel Veillarda521d282004-11-09 14:59:59 +000022957#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022958 int mem_base;
22959 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022960 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022961 int n_value;
22962 int space; /* allow spaces in front and end of the string */
22963 int n_space;
22964
22965 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22966 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022968 value = gen_const_xmlChar_ptr(n_value, 0);
22969 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022970
William M. Brackf13f77f2004-11-12 16:03:48 +000022971 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022972 desret_int(ret_val);
22973 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022974 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022975 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022976 xmlResetLastError();
22977 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022978 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022980 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022981 printf(" %d", n_value);
22982 printf(" %d", n_space);
22983 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022984 }
22985 }
22986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022987 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022988#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022989
Daniel Veillard42595322004-11-08 10:52:06 +000022990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022991}
22992
22993
22994static int
22995test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022997
Daniel Veillarda521d282004-11-09 14:59:59 +000022998#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022999 int mem_base;
23000 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023001 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023002 int n_value;
23003 int space; /* allow spaces in front and end of the string */
23004 int n_space;
23005
23006 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23007 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23008 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023009 value = gen_const_xmlChar_ptr(n_value, 0);
23010 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023011
William M. Brackf13f77f2004-11-12 16:03:48 +000023012 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023013 desret_int(ret_val);
23014 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023015 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023016 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023017 xmlResetLastError();
23018 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023019 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023021 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023022 printf(" %d", n_value);
23023 printf(" %d", n_space);
23024 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023025 }
23026 }
23027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023028 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023029#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023030
Daniel Veillard42595322004-11-08 10:52:06 +000023031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023032}
23033
23034
23035static int
23036test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023038
Daniel Veillarda521d282004-11-09 14:59:59 +000023039#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023040 int mem_base;
23041 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023042 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023043 int n_value;
23044 int space; /* allow spaces in front and end of the string */
23045 int n_space;
23046
23047 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23048 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023050 value = gen_const_xmlChar_ptr(n_value, 0);
23051 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023052
William M. Brackf13f77f2004-11-12 16:03:48 +000023053 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023054 desret_int(ret_val);
23055 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023056 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023057 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023058 xmlResetLastError();
23059 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023060 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023062 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023063 printf(" %d", n_value);
23064 printf(" %d", n_space);
23065 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023066 }
23067 }
23068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023069 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023070#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023071
Daniel Veillard42595322004-11-08 10:52:06 +000023072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023073}
23074
23075
23076static int
23077test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023079
Daniel Veillarda521d282004-11-09 14:59:59 +000023080#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023081 int mem_base;
23082 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023083 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023084 int n_value;
23085 int space; /* allow spaces in front and end of the string */
23086 int n_space;
23087
23088 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23089 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023091 value = gen_const_xmlChar_ptr(n_value, 0);
23092 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023093
William M. Brackf13f77f2004-11-12 16:03:48 +000023094 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023095 desret_int(ret_val);
23096 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023097 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023098 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023099 xmlResetLastError();
23100 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023101 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023103 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023104 printf(" %d", n_value);
23105 printf(" %d", n_space);
23106 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023107 }
23108 }
23109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023110 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023111#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023112
Daniel Veillard42595322004-11-08 10:52:06 +000023113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023114}
23115
23116static int
23117test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023119
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023120 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023121 test_ret += test_xmlAddChild();
23122 test_ret += test_xmlAddChildList();
23123 test_ret += test_xmlAddNextSibling();
23124 test_ret += test_xmlAddPrevSibling();
23125 test_ret += test_xmlAddSibling();
23126 test_ret += test_xmlAttrSerializeTxtContent();
23127 test_ret += test_xmlBufferAdd();
23128 test_ret += test_xmlBufferAddHead();
23129 test_ret += test_xmlBufferCCat();
23130 test_ret += test_xmlBufferCat();
23131 test_ret += test_xmlBufferContent();
23132 test_ret += test_xmlBufferCreate();
23133 test_ret += test_xmlBufferCreateSize();
23134 test_ret += test_xmlBufferCreateStatic();
23135 test_ret += test_xmlBufferEmpty();
23136 test_ret += test_xmlBufferGrow();
23137 test_ret += test_xmlBufferLength();
23138 test_ret += test_xmlBufferResize();
23139 test_ret += test_xmlBufferSetAllocationScheme();
23140 test_ret += test_xmlBufferShrink();
23141 test_ret += test_xmlBufferWriteCHAR();
23142 test_ret += test_xmlBufferWriteChar();
23143 test_ret += test_xmlBufferWriteQuotedString();
23144 test_ret += test_xmlBuildQName();
23145 test_ret += test_xmlCopyDoc();
23146 test_ret += test_xmlCopyDtd();
23147 test_ret += test_xmlCopyNamespace();
23148 test_ret += test_xmlCopyNamespaceList();
23149 test_ret += test_xmlCopyNode();
23150 test_ret += test_xmlCopyNodeList();
23151 test_ret += test_xmlCopyProp();
23152 test_ret += test_xmlCopyPropList();
23153 test_ret += test_xmlCreateIntSubset();
23154 test_ret += test_xmlDocCopyNode();
23155 test_ret += test_xmlDocCopyNodeList();
23156 test_ret += test_xmlDocDump();
23157 test_ret += test_xmlDocDumpFormatMemory();
23158 test_ret += test_xmlDocDumpFormatMemoryEnc();
23159 test_ret += test_xmlDocDumpMemory();
23160 test_ret += test_xmlDocDumpMemoryEnc();
23161 test_ret += test_xmlDocFormatDump();
23162 test_ret += test_xmlDocGetRootElement();
23163 test_ret += test_xmlDocSetRootElement();
23164 test_ret += test_xmlElemDump();
23165 test_ret += test_xmlGetBufferAllocationScheme();
23166 test_ret += test_xmlGetCompressMode();
23167 test_ret += test_xmlGetDocCompressMode();
23168 test_ret += test_xmlGetIntSubset();
23169 test_ret += test_xmlGetLastChild();
23170 test_ret += test_xmlGetLineNo();
23171 test_ret += test_xmlGetNoNsProp();
23172 test_ret += test_xmlGetNodePath();
23173 test_ret += test_xmlGetNsList();
23174 test_ret += test_xmlGetNsProp();
23175 test_ret += test_xmlGetProp();
23176 test_ret += test_xmlHasNsProp();
23177 test_ret += test_xmlHasProp();
23178 test_ret += test_xmlIsBlankNode();
23179 test_ret += test_xmlIsXHTML();
23180 test_ret += test_xmlNewCDataBlock();
23181 test_ret += test_xmlNewCharRef();
23182 test_ret += test_xmlNewChild();
23183 test_ret += test_xmlNewComment();
23184 test_ret += test_xmlNewDoc();
23185 test_ret += test_xmlNewDocComment();
23186 test_ret += test_xmlNewDocFragment();
23187 test_ret += test_xmlNewDocNode();
23188 test_ret += test_xmlNewDocNodeEatName();
23189 test_ret += test_xmlNewDocPI();
23190 test_ret += test_xmlNewDocProp();
23191 test_ret += test_xmlNewDocRawNode();
23192 test_ret += test_xmlNewDocText();
23193 test_ret += test_xmlNewDocTextLen();
23194 test_ret += test_xmlNewDtd();
23195 test_ret += test_xmlNewNode();
23196 test_ret += test_xmlNewNodeEatName();
23197 test_ret += test_xmlNewNs();
23198 test_ret += test_xmlNewNsProp();
23199 test_ret += test_xmlNewNsPropEatName();
23200 test_ret += test_xmlNewPI();
23201 test_ret += test_xmlNewProp();
23202 test_ret += test_xmlNewReference();
23203 test_ret += test_xmlNewText();
23204 test_ret += test_xmlNewTextChild();
23205 test_ret += test_xmlNewTextLen();
23206 test_ret += test_xmlNodeAddContent();
23207 test_ret += test_xmlNodeAddContentLen();
23208 test_ret += test_xmlNodeBufGetContent();
23209 test_ret += test_xmlNodeDump();
23210 test_ret += test_xmlNodeDumpOutput();
23211 test_ret += test_xmlNodeGetBase();
23212 test_ret += test_xmlNodeGetContent();
23213 test_ret += test_xmlNodeGetLang();
23214 test_ret += test_xmlNodeGetSpacePreserve();
23215 test_ret += test_xmlNodeIsText();
23216 test_ret += test_xmlNodeListGetRawString();
23217 test_ret += test_xmlNodeListGetString();
23218 test_ret += test_xmlNodeSetBase();
23219 test_ret += test_xmlNodeSetContent();
23220 test_ret += test_xmlNodeSetContentLen();
23221 test_ret += test_xmlNodeSetLang();
23222 test_ret += test_xmlNodeSetName();
23223 test_ret += test_xmlNodeSetSpacePreserve();
23224 test_ret += test_xmlReconciliateNs();
23225 test_ret += test_xmlRemoveProp();
23226 test_ret += test_xmlReplaceNode();
23227 test_ret += test_xmlSaveFile();
23228 test_ret += test_xmlSaveFileEnc();
23229 test_ret += test_xmlSaveFileTo();
23230 test_ret += test_xmlSaveFormatFile();
23231 test_ret += test_xmlSaveFormatFileEnc();
23232 test_ret += test_xmlSaveFormatFileTo();
23233 test_ret += test_xmlSearchNs();
23234 test_ret += test_xmlSearchNsByHref();
23235 test_ret += test_xmlSetBufferAllocationScheme();
23236 test_ret += test_xmlSetCompressMode();
23237 test_ret += test_xmlSetDocCompressMode();
23238 test_ret += test_xmlSetNs();
23239 test_ret += test_xmlSetNsProp();
23240 test_ret += test_xmlSetProp();
23241 test_ret += test_xmlSplitQName2();
23242 test_ret += test_xmlSplitQName3();
23243 test_ret += test_xmlStringGetNodeList();
23244 test_ret += test_xmlStringLenGetNodeList();
23245 test_ret += test_xmlTextConcat();
23246 test_ret += test_xmlTextMerge();
23247 test_ret += test_xmlUnsetNsProp();
23248 test_ret += test_xmlUnsetProp();
23249 test_ret += test_xmlValidateNCName();
23250 test_ret += test_xmlValidateNMToken();
23251 test_ret += test_xmlValidateName();
23252 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023253
Daniel Veillard42595322004-11-08 10:52:06 +000023254 if (test_ret != 0)
23255 printf("Module tree: %d errors\n", test_ret);
23256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023257}
23258
23259static int
23260test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023262
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023263 int mem_base;
23264 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023265 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023266 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023267 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023268 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023269
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023270 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23271 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23272 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023273 URI = gen_const_xmlChar_ptr(n_URI, 0);
23274 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023275
William M. Brackf13f77f2004-11-12 16:03:48 +000023276 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023277 desret_xmlChar_ptr(ret_val);
23278 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023279 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23280 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023281 xmlResetLastError();
23282 if (mem_base != xmlMemBlocks()) {
23283 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023285 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023286 printf(" %d", n_URI);
23287 printf(" %d", n_base);
23288 printf("\n");
23289 }
23290 }
23291 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023293
Daniel Veillard42595322004-11-08 10:52:06 +000023294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023295}
23296
23297
23298static int
23299test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023301
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023302 int mem_base;
23303 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023304 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023305 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023306 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023307 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023308
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023309 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23310 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023312 URI = gen_const_xmlChar_ptr(n_URI, 0);
23313 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023314
William M. Brackf13f77f2004-11-12 16:03:48 +000023315 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023316 desret_xmlChar_ptr(ret_val);
23317 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023318 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23319 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023320 xmlResetLastError();
23321 if (mem_base != xmlMemBlocks()) {
23322 printf("Leak of %d blocks found in xmlBuildURI",
23323 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023324 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023325 printf(" %d", n_URI);
23326 printf(" %d", n_base);
23327 printf("\n");
23328 }
23329 }
23330 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023331 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023332
Daniel Veillard42595322004-11-08 10:52:06 +000023333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023334}
23335
23336
23337static int
23338test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023340
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023341 int mem_base;
23342 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023343 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023344 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023345
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023346 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023348 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023349
William M. Brackf13f77f2004-11-12 16:03:48 +000023350 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023351 desret_xmlChar_ptr(ret_val);
23352 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023353 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023354 xmlResetLastError();
23355 if (mem_base != xmlMemBlocks()) {
23356 printf("Leak of %d blocks found in xmlCanonicPath",
23357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023358 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023359 printf(" %d", n_path);
23360 printf("\n");
23361 }
23362 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023363 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023364
Daniel Veillard42595322004-11-08 10:52:06 +000023365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023366}
23367
23368
23369static int
23370test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023372
23373
23374 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023376}
23377
23378
23379static int
23380test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023382
Daniel Veillardce682bc2004-11-05 17:22:25 +000023383 int mem_base;
23384 int ret_val;
23385 char * path; /* pointer to the path string */
23386 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023387
Daniel Veillardce682bc2004-11-05 17:22:25 +000023388 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23389 mem_base = xmlMemBlocks();
23390 path = gen_char_ptr(n_path, 0);
23391
23392 ret_val = xmlNormalizeURIPath(path);
23393 desret_int(ret_val);
23394 call_tests++;
23395 des_char_ptr(n_path, path, 0);
23396 xmlResetLastError();
23397 if (mem_base != xmlMemBlocks()) {
23398 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023400 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023401 printf(" %d", n_path);
23402 printf("\n");
23403 }
23404 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023405 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023406
Daniel Veillard42595322004-11-08 10:52:06 +000023407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023408}
23409
23410
23411static int
23412test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023414
23415
23416 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023418}
23419
23420
Daniel Veillardce682bc2004-11-05 17:22:25 +000023421#define gen_nb_xmlURIPtr 1
23422static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23423 return(NULL);
23424}
23425static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23426}
23427
Daniel Veillardd93f6252004-11-02 15:53:51 +000023428static int
23429test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023431
Daniel Veillardce682bc2004-11-05 17:22:25 +000023432 int mem_base;
23433 int ret_val;
23434 xmlURIPtr uri; /* pointer to an URI structure */
23435 int n_uri;
23436 char * str; /* the string to analyze */
23437 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023438
Daniel Veillardce682bc2004-11-05 17:22:25 +000023439 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23440 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23441 mem_base = xmlMemBlocks();
23442 uri = gen_xmlURIPtr(n_uri, 0);
23443 str = gen_const_char_ptr(n_str, 1);
23444
William M. Brackf13f77f2004-11-12 16:03:48 +000023445 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023446 desret_int(ret_val);
23447 call_tests++;
23448 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023449 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023450 xmlResetLastError();
23451 if (mem_base != xmlMemBlocks()) {
23452 printf("Leak of %d blocks found in xmlParseURIReference",
23453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023454 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023455 printf(" %d", n_uri);
23456 printf(" %d", n_str);
23457 printf("\n");
23458 }
23459 }
23460 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023461 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023462
Daniel Veillard42595322004-11-08 10:52:06 +000023463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023464}
23465
23466
23467static int
23468test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023470
Daniel Veillardce682bc2004-11-05 17:22:25 +000023471 int mem_base;
23472 FILE * stream; /* a FILE* for the output */
23473 int n_stream;
23474 xmlURIPtr uri; /* pointer to an xmlURI */
23475 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023476
Daniel Veillardce682bc2004-11-05 17:22:25 +000023477 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23478 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23479 mem_base = xmlMemBlocks();
23480 stream = gen_FILE_ptr(n_stream, 0);
23481 uri = gen_xmlURIPtr(n_uri, 1);
23482
23483 xmlPrintURI(stream, uri);
23484 call_tests++;
23485 des_FILE_ptr(n_stream, stream, 0);
23486 des_xmlURIPtr(n_uri, uri, 1);
23487 xmlResetLastError();
23488 if (mem_base != xmlMemBlocks()) {
23489 printf("Leak of %d blocks found in xmlPrintURI",
23490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023491 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023492 printf(" %d", n_stream);
23493 printf(" %d", n_uri);
23494 printf("\n");
23495 }
23496 }
23497 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023499
Daniel Veillard42595322004-11-08 10:52:06 +000023500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023501}
23502
23503
23504static int
23505test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023507
Daniel Veillardce682bc2004-11-05 17:22:25 +000023508 int mem_base;
23509 xmlChar * ret_val;
23510 xmlURIPtr uri; /* pointer to an xmlURI */
23511 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023512
Daniel Veillardce682bc2004-11-05 17:22:25 +000023513 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23514 mem_base = xmlMemBlocks();
23515 uri = gen_xmlURIPtr(n_uri, 0);
23516
23517 ret_val = xmlSaveUri(uri);
23518 desret_xmlChar_ptr(ret_val);
23519 call_tests++;
23520 des_xmlURIPtr(n_uri, uri, 0);
23521 xmlResetLastError();
23522 if (mem_base != xmlMemBlocks()) {
23523 printf("Leak of %d blocks found in xmlSaveUri",
23524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023525 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023526 printf(" %d", n_uri);
23527 printf("\n");
23528 }
23529 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023531
Daniel Veillard42595322004-11-08 10:52:06 +000023532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023533}
23534
23535
23536static int
23537test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023539
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023540 int mem_base;
23541 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023542 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023543 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023544
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023545 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23546 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023547 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023548
William M. Brackf13f77f2004-11-12 16:03:48 +000023549 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023550 desret_xmlChar_ptr(ret_val);
23551 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023552 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023553 xmlResetLastError();
23554 if (mem_base != xmlMemBlocks()) {
23555 printf("Leak of %d blocks found in xmlURIEscape",
23556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023557 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023558 printf(" %d", n_str);
23559 printf("\n");
23560 }
23561 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023562 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023563
Daniel Veillard42595322004-11-08 10:52:06 +000023564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023565}
23566
23567
23568static int
23569test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023571
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023572 int mem_base;
23573 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023574 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023575 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023576 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023577 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023578
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023579 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23580 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23581 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023582 str = gen_const_xmlChar_ptr(n_str, 0);
23583 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023584
William M. Brackf13f77f2004-11-12 16:03:48 +000023585 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023586 desret_xmlChar_ptr(ret_val);
23587 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023588 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23589 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023590 xmlResetLastError();
23591 if (mem_base != xmlMemBlocks()) {
23592 printf("Leak of %d blocks found in xmlURIEscapeStr",
23593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023594 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023595 printf(" %d", n_str);
23596 printf(" %d", n_list);
23597 printf("\n");
23598 }
23599 }
23600 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023602
Daniel Veillard42595322004-11-08 10:52:06 +000023603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023604}
23605
23606
23607static int
23608test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023610
23611
23612 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023614}
23615
23616static int
23617test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023619
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023620 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023621 test_ret += test_xmlBuildRelativeURI();
23622 test_ret += test_xmlBuildURI();
23623 test_ret += test_xmlCanonicPath();
23624 test_ret += test_xmlCreateURI();
23625 test_ret += test_xmlNormalizeURIPath();
23626 test_ret += test_xmlParseURI();
23627 test_ret += test_xmlParseURIReference();
23628 test_ret += test_xmlPrintURI();
23629 test_ret += test_xmlSaveUri();
23630 test_ret += test_xmlURIEscape();
23631 test_ret += test_xmlURIEscapeStr();
23632 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023633
Daniel Veillard42595322004-11-08 10:52:06 +000023634 if (test_ret != 0)
23635 printf("Module uri: %d errors\n", test_ret);
23636 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023637}
23638
23639static int
23640test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023642
Daniel Veillard42595322004-11-08 10:52:06 +000023643 int mem_base;
23644 xmlAttributePtr ret_val;
23645 xmlValidCtxtPtr ctxt; /* the validation context */
23646 int n_ctxt;
23647 xmlDtdPtr dtd; /* pointer to the DTD */
23648 int n_dtd;
23649 xmlChar * elem; /* the element name */
23650 int n_elem;
23651 xmlChar * name; /* the attribute name */
23652 int n_name;
23653 xmlChar * ns; /* the attribute namespace prefix */
23654 int n_ns;
23655 xmlAttributeType type; /* the attribute type */
23656 int n_type;
23657 xmlAttributeDefault def; /* the attribute default type */
23658 int n_def;
23659 xmlChar * defaultValue; /* the attribute default value */
23660 int n_defaultValue;
23661 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23662 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023663
Daniel Veillard42595322004-11-08 10:52:06 +000023664 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23665 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23666 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23667 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23668 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23669 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23670 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23671 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23672 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23673 mem_base = xmlMemBlocks();
23674 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23675 dtd = gen_xmlDtdPtr(n_dtd, 1);
23676 elem = gen_const_xmlChar_ptr(n_elem, 2);
23677 name = gen_const_xmlChar_ptr(n_name, 3);
23678 ns = gen_const_xmlChar_ptr(n_ns, 4);
23679 type = gen_xmlAttributeType(n_type, 5);
23680 def = gen_xmlAttributeDefault(n_def, 6);
23681 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23682 tree = gen_xmlEnumerationPtr(n_tree, 8);
23683
William M. Brackf13f77f2004-11-12 16:03:48 +000023684 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 +000023685 desret_xmlAttributePtr(ret_val);
23686 call_tests++;
23687 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23688 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023689 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23690 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23691 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023692 des_xmlAttributeType(n_type, type, 5);
23693 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023694 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023695 des_xmlEnumerationPtr(n_tree, tree, 8);
23696 xmlResetLastError();
23697 if (mem_base != xmlMemBlocks()) {
23698 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23699 xmlMemBlocks() - mem_base);
23700 test_ret++;
23701 printf(" %d", n_ctxt);
23702 printf(" %d", n_dtd);
23703 printf(" %d", n_elem);
23704 printf(" %d", n_name);
23705 printf(" %d", n_ns);
23706 printf(" %d", n_type);
23707 printf(" %d", n_def);
23708 printf(" %d", n_defaultValue);
23709 printf(" %d", n_tree);
23710 printf("\n");
23711 }
23712 }
23713 }
23714 }
23715 }
23716 }
23717 }
23718 }
23719 }
23720 }
Daniel Veillard42595322004-11-08 10:52:06 +000023721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023722
Daniel Veillard42595322004-11-08 10:52:06 +000023723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023724}
23725
23726
23727static int
23728test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023730
Daniel Veillard42595322004-11-08 10:52:06 +000023731 int mem_base;
23732 xmlElementPtr ret_val;
23733 xmlValidCtxtPtr ctxt; /* the validation context */
23734 int n_ctxt;
23735 xmlDtdPtr dtd; /* pointer to the DTD */
23736 int n_dtd;
23737 xmlChar * name; /* the entity name */
23738 int n_name;
23739 xmlElementTypeVal type; /* the element type */
23740 int n_type;
23741 xmlElementContentPtr content; /* the element content tree or NULL */
23742 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023743
Daniel Veillard42595322004-11-08 10:52:06 +000023744 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23745 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23746 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23747 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23748 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23749 mem_base = xmlMemBlocks();
23750 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23751 dtd = gen_xmlDtdPtr(n_dtd, 1);
23752 name = gen_const_xmlChar_ptr(n_name, 2);
23753 type = gen_xmlElementTypeVal(n_type, 3);
23754 content = gen_xmlElementContentPtr(n_content, 4);
23755
William M. Brackf13f77f2004-11-12 16:03:48 +000023756 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023757 desret_xmlElementPtr(ret_val);
23758 call_tests++;
23759 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23760 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023761 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023762 des_xmlElementTypeVal(n_type, type, 3);
23763 des_xmlElementContentPtr(n_content, content, 4);
23764 xmlResetLastError();
23765 if (mem_base != xmlMemBlocks()) {
23766 printf("Leak of %d blocks found in xmlAddElementDecl",
23767 xmlMemBlocks() - mem_base);
23768 test_ret++;
23769 printf(" %d", n_ctxt);
23770 printf(" %d", n_dtd);
23771 printf(" %d", n_name);
23772 printf(" %d", n_type);
23773 printf(" %d", n_content);
23774 printf("\n");
23775 }
23776 }
23777 }
23778 }
23779 }
23780 }
Daniel Veillard42595322004-11-08 10:52:06 +000023781 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023782
Daniel Veillard42595322004-11-08 10:52:06 +000023783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023784}
23785
23786
23787static int
23788test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023790
23791
23792 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023794}
23795
23796
23797static int
23798test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023800
23801
23802 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023804}
23805
23806
23807static int
23808test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023810
23811
23812 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023814}
23815
23816
Daniel Veillardce682bc2004-11-05 17:22:25 +000023817#define gen_nb_xmlAttributeTablePtr 1
23818static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23819 return(NULL);
23820}
23821static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23822}
23823
Daniel Veillardd93f6252004-11-02 15:53:51 +000023824static int
23825test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023827
23828
23829 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023831}
23832
23833
23834static int
23835test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023837
23838
23839 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023841}
23842
23843
Daniel Veillardce682bc2004-11-05 17:22:25 +000023844#define gen_nb_xmlElementTablePtr 1
23845static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23846 return(NULL);
23847}
23848static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23849}
23850
Daniel Veillardd93f6252004-11-02 15:53:51 +000023851static int
23852test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023854
23855
23856 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023858}
23859
23860
23861static int
23862test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023864
23865
23866 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023868}
23869
23870
Daniel Veillardce682bc2004-11-05 17:22:25 +000023871#define gen_nb_xmlNotationTablePtr 1
23872static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23873 return(NULL);
23874}
23875static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23876}
23877
Daniel Veillardd93f6252004-11-02 15:53:51 +000023878static int
23879test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023881
23882
23883 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023885}
23886
23887
23888static int
23889test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023891
23892
23893 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023895}
23896
23897
Daniel Veillardce682bc2004-11-05 17:22:25 +000023898#define gen_nb_xmlAttributePtr 1
23899static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23900 return(NULL);
23901}
23902static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23903}
23904
Daniel Veillardd93f6252004-11-02 15:53:51 +000023905static int
23906test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023908
Daniel Veillardce682bc2004-11-05 17:22:25 +000023909#ifdef LIBXML_OUTPUT_ENABLED
23910 int mem_base;
23911 xmlBufferPtr buf; /* the XML buffer output */
23912 int n_buf;
23913 xmlAttributePtr attr; /* An attribute declaration */
23914 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023915
Daniel Veillardce682bc2004-11-05 17:22:25 +000023916 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23917 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23918 mem_base = xmlMemBlocks();
23919 buf = gen_xmlBufferPtr(n_buf, 0);
23920 attr = gen_xmlAttributePtr(n_attr, 1);
23921
23922 xmlDumpAttributeDecl(buf, attr);
23923 call_tests++;
23924 des_xmlBufferPtr(n_buf, buf, 0);
23925 des_xmlAttributePtr(n_attr, attr, 1);
23926 xmlResetLastError();
23927 if (mem_base != xmlMemBlocks()) {
23928 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023930 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023931 printf(" %d", n_buf);
23932 printf(" %d", n_attr);
23933 printf("\n");
23934 }
23935 }
23936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023937 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023938#endif
23939
Daniel Veillard42595322004-11-08 10:52:06 +000023940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023941}
23942
23943
23944static int
23945test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023947
Daniel Veillardce682bc2004-11-05 17:22:25 +000023948#ifdef LIBXML_OUTPUT_ENABLED
23949 int mem_base;
23950 xmlBufferPtr buf; /* the XML buffer output */
23951 int n_buf;
23952 xmlAttributeTablePtr table; /* An attribute table */
23953 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023954
Daniel Veillardce682bc2004-11-05 17:22:25 +000023955 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23956 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23957 mem_base = xmlMemBlocks();
23958 buf = gen_xmlBufferPtr(n_buf, 0);
23959 table = gen_xmlAttributeTablePtr(n_table, 1);
23960
23961 xmlDumpAttributeTable(buf, table);
23962 call_tests++;
23963 des_xmlBufferPtr(n_buf, buf, 0);
23964 des_xmlAttributeTablePtr(n_table, table, 1);
23965 xmlResetLastError();
23966 if (mem_base != xmlMemBlocks()) {
23967 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023969 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023970 printf(" %d", n_buf);
23971 printf(" %d", n_table);
23972 printf("\n");
23973 }
23974 }
23975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023976 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023977#endif
23978
Daniel Veillard42595322004-11-08 10:52:06 +000023979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023980}
23981
23982
Daniel Veillardce682bc2004-11-05 17:22:25 +000023983#define gen_nb_xmlElementPtr 1
23984static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23985 return(NULL);
23986}
23987static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23988}
23989
Daniel Veillardd93f6252004-11-02 15:53:51 +000023990static int
23991test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023993
Daniel Veillardce682bc2004-11-05 17:22:25 +000023994#ifdef LIBXML_OUTPUT_ENABLED
23995 int mem_base;
23996 xmlBufferPtr buf; /* the XML buffer output */
23997 int n_buf;
23998 xmlElementPtr elem; /* An element table */
23999 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024000
Daniel Veillardce682bc2004-11-05 17:22:25 +000024001 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24002 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24003 mem_base = xmlMemBlocks();
24004 buf = gen_xmlBufferPtr(n_buf, 0);
24005 elem = gen_xmlElementPtr(n_elem, 1);
24006
24007 xmlDumpElementDecl(buf, elem);
24008 call_tests++;
24009 des_xmlBufferPtr(n_buf, buf, 0);
24010 des_xmlElementPtr(n_elem, elem, 1);
24011 xmlResetLastError();
24012 if (mem_base != xmlMemBlocks()) {
24013 printf("Leak of %d blocks found in xmlDumpElementDecl",
24014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024015 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024016 printf(" %d", n_buf);
24017 printf(" %d", n_elem);
24018 printf("\n");
24019 }
24020 }
24021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024022 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024023#endif
24024
Daniel Veillard42595322004-11-08 10:52:06 +000024025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024026}
24027
24028
24029static int
24030test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024032
Daniel Veillardce682bc2004-11-05 17:22:25 +000024033#ifdef LIBXML_OUTPUT_ENABLED
24034 int mem_base;
24035 xmlBufferPtr buf; /* the XML buffer output */
24036 int n_buf;
24037 xmlElementTablePtr table; /* An element table */
24038 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024039
Daniel Veillardce682bc2004-11-05 17:22:25 +000024040 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24041 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24042 mem_base = xmlMemBlocks();
24043 buf = gen_xmlBufferPtr(n_buf, 0);
24044 table = gen_xmlElementTablePtr(n_table, 1);
24045
24046 xmlDumpElementTable(buf, table);
24047 call_tests++;
24048 des_xmlBufferPtr(n_buf, buf, 0);
24049 des_xmlElementTablePtr(n_table, table, 1);
24050 xmlResetLastError();
24051 if (mem_base != xmlMemBlocks()) {
24052 printf("Leak of %d blocks found in xmlDumpElementTable",
24053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024054 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024055 printf(" %d", n_buf);
24056 printf(" %d", n_table);
24057 printf("\n");
24058 }
24059 }
24060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024061 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024062#endif
24063
Daniel Veillard42595322004-11-08 10:52:06 +000024064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024065}
24066
24067
Daniel Veillardce682bc2004-11-05 17:22:25 +000024068#define gen_nb_xmlNotationPtr 1
24069static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24070 return(NULL);
24071}
24072static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24073}
24074
Daniel Veillardd93f6252004-11-02 15:53:51 +000024075static int
24076test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024078
Daniel Veillardce682bc2004-11-05 17:22:25 +000024079#ifdef LIBXML_OUTPUT_ENABLED
24080 int mem_base;
24081 xmlBufferPtr buf; /* the XML buffer output */
24082 int n_buf;
24083 xmlNotationPtr nota; /* A notation declaration */
24084 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024085
Daniel Veillardce682bc2004-11-05 17:22:25 +000024086 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24087 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24088 mem_base = xmlMemBlocks();
24089 buf = gen_xmlBufferPtr(n_buf, 0);
24090 nota = gen_xmlNotationPtr(n_nota, 1);
24091
24092 xmlDumpNotationDecl(buf, nota);
24093 call_tests++;
24094 des_xmlBufferPtr(n_buf, buf, 0);
24095 des_xmlNotationPtr(n_nota, nota, 1);
24096 xmlResetLastError();
24097 if (mem_base != xmlMemBlocks()) {
24098 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024100 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024101 printf(" %d", n_buf);
24102 printf(" %d", n_nota);
24103 printf("\n");
24104 }
24105 }
24106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024107 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024108#endif
24109
Daniel Veillard42595322004-11-08 10:52:06 +000024110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024111}
24112
24113
24114static int
24115test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024117
Daniel Veillardce682bc2004-11-05 17:22:25 +000024118#ifdef LIBXML_OUTPUT_ENABLED
24119 int mem_base;
24120 xmlBufferPtr buf; /* the XML buffer output */
24121 int n_buf;
24122 xmlNotationTablePtr table; /* A notation table */
24123 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024124
Daniel Veillardce682bc2004-11-05 17:22:25 +000024125 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24126 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24127 mem_base = xmlMemBlocks();
24128 buf = gen_xmlBufferPtr(n_buf, 0);
24129 table = gen_xmlNotationTablePtr(n_table, 1);
24130
24131 xmlDumpNotationTable(buf, table);
24132 call_tests++;
24133 des_xmlBufferPtr(n_buf, buf, 0);
24134 des_xmlNotationTablePtr(n_table, table, 1);
24135 xmlResetLastError();
24136 if (mem_base != xmlMemBlocks()) {
24137 printf("Leak of %d blocks found in xmlDumpNotationTable",
24138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024139 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024140 printf(" %d", n_buf);
24141 printf(" %d", n_table);
24142 printf("\n");
24143 }
24144 }
24145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024146 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024147#endif
24148
Daniel Veillard42595322004-11-08 10:52:06 +000024149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024150}
24151
24152
24153static int
24154test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024156
Daniel Veillard42595322004-11-08 10:52:06 +000024157 int mem_base;
24158 xmlAttributePtr ret_val;
24159 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24160 int n_dtd;
24161 xmlChar * elem; /* the element name */
24162 int n_elem;
24163 xmlChar * name; /* the attribute name */
24164 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024165
Daniel Veillard42595322004-11-08 10:52:06 +000024166 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24167 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24168 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24169 mem_base = xmlMemBlocks();
24170 dtd = gen_xmlDtdPtr(n_dtd, 0);
24171 elem = gen_const_xmlChar_ptr(n_elem, 1);
24172 name = gen_const_xmlChar_ptr(n_name, 2);
24173
William M. Brackf13f77f2004-11-12 16:03:48 +000024174 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024175 desret_xmlAttributePtr(ret_val);
24176 call_tests++;
24177 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024178 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24179 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024180 xmlResetLastError();
24181 if (mem_base != xmlMemBlocks()) {
24182 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24183 xmlMemBlocks() - mem_base);
24184 test_ret++;
24185 printf(" %d", n_dtd);
24186 printf(" %d", n_elem);
24187 printf(" %d", n_name);
24188 printf("\n");
24189 }
24190 }
24191 }
24192 }
Daniel Veillard42595322004-11-08 10:52:06 +000024193 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024194
Daniel Veillard42595322004-11-08 10:52:06 +000024195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024196}
24197
24198
24199static int
24200test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024202
Daniel Veillard42595322004-11-08 10:52:06 +000024203 int mem_base;
24204 xmlElementPtr ret_val;
24205 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24206 int n_dtd;
24207 xmlChar * name; /* the element name */
24208 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024209
Daniel Veillard42595322004-11-08 10:52:06 +000024210 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24211 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24212 mem_base = xmlMemBlocks();
24213 dtd = gen_xmlDtdPtr(n_dtd, 0);
24214 name = gen_const_xmlChar_ptr(n_name, 1);
24215
William M. Brackf13f77f2004-11-12 16:03:48 +000024216 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024217 desret_xmlElementPtr(ret_val);
24218 call_tests++;
24219 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024220 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024221 xmlResetLastError();
24222 if (mem_base != xmlMemBlocks()) {
24223 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24224 xmlMemBlocks() - mem_base);
24225 test_ret++;
24226 printf(" %d", n_dtd);
24227 printf(" %d", n_name);
24228 printf("\n");
24229 }
24230 }
24231 }
Daniel Veillard42595322004-11-08 10:52:06 +000024232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024233
Daniel Veillard42595322004-11-08 10:52:06 +000024234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024235}
24236
24237
24238static int
24239test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024241
24242
24243 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024245}
24246
24247
24248static int
24249test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024251
Daniel Veillard42595322004-11-08 10:52:06 +000024252 int mem_base;
24253 xmlAttributePtr ret_val;
24254 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24255 int n_dtd;
24256 xmlChar * elem; /* the element name */
24257 int n_elem;
24258 xmlChar * name; /* the attribute name */
24259 int n_name;
24260 xmlChar * prefix; /* the attribute namespace prefix */
24261 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024262
Daniel Veillard42595322004-11-08 10:52:06 +000024263 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24264 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24265 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24266 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24267 mem_base = xmlMemBlocks();
24268 dtd = gen_xmlDtdPtr(n_dtd, 0);
24269 elem = gen_const_xmlChar_ptr(n_elem, 1);
24270 name = gen_const_xmlChar_ptr(n_name, 2);
24271 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24272
William M. Brackf13f77f2004-11-12 16:03:48 +000024273 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024274 desret_xmlAttributePtr(ret_val);
24275 call_tests++;
24276 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024277 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24278 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24279 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024280 xmlResetLastError();
24281 if (mem_base != xmlMemBlocks()) {
24282 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24283 xmlMemBlocks() - mem_base);
24284 test_ret++;
24285 printf(" %d", n_dtd);
24286 printf(" %d", n_elem);
24287 printf(" %d", n_name);
24288 printf(" %d", n_prefix);
24289 printf("\n");
24290 }
24291 }
24292 }
24293 }
24294 }
Daniel Veillard42595322004-11-08 10:52:06 +000024295 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024296
Daniel Veillard42595322004-11-08 10:52:06 +000024297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024298}
24299
24300
24301static int
24302test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024304
Daniel Veillard42595322004-11-08 10:52:06 +000024305 int mem_base;
24306 xmlElementPtr ret_val;
24307 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24308 int n_dtd;
24309 xmlChar * name; /* the element name */
24310 int n_name;
24311 xmlChar * prefix; /* the element namespace prefix */
24312 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024313
Daniel Veillard42595322004-11-08 10:52:06 +000024314 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24315 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24316 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24317 mem_base = xmlMemBlocks();
24318 dtd = gen_xmlDtdPtr(n_dtd, 0);
24319 name = gen_const_xmlChar_ptr(n_name, 1);
24320 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24321
William M. Brackf13f77f2004-11-12 16:03:48 +000024322 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024323 desret_xmlElementPtr(ret_val);
24324 call_tests++;
24325 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024326 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24327 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024328 xmlResetLastError();
24329 if (mem_base != xmlMemBlocks()) {
24330 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24331 xmlMemBlocks() - mem_base);
24332 test_ret++;
24333 printf(" %d", n_dtd);
24334 printf(" %d", n_name);
24335 printf(" %d", n_prefix);
24336 printf("\n");
24337 }
24338 }
24339 }
24340 }
Daniel Veillard42595322004-11-08 10:52:06 +000024341 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024342
Daniel Veillard42595322004-11-08 10:52:06 +000024343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024344}
24345
24346
24347static int
24348test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024350
Daniel Veillard57b25162004-11-06 14:50:18 +000024351 int mem_base;
24352 xmlAttrPtr ret_val;
24353 xmlDocPtr doc; /* pointer to the document */
24354 int n_doc;
24355 xmlChar * ID; /* the ID value */
24356 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024357
Daniel Veillard57b25162004-11-06 14:50:18 +000024358 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24359 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24360 mem_base = xmlMemBlocks();
24361 doc = gen_xmlDocPtr(n_doc, 0);
24362 ID = gen_const_xmlChar_ptr(n_ID, 1);
24363
William M. Brackf13f77f2004-11-12 16:03:48 +000024364 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024365 desret_xmlAttrPtr(ret_val);
24366 call_tests++;
24367 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024368 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024369 xmlResetLastError();
24370 if (mem_base != xmlMemBlocks()) {
24371 printf("Leak of %d blocks found in xmlGetID",
24372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024373 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024374 printf(" %d", n_doc);
24375 printf(" %d", n_ID);
24376 printf("\n");
24377 }
24378 }
24379 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024380 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024381
Daniel Veillard42595322004-11-08 10:52:06 +000024382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024383}
24384
24385
24386static int
24387test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024389
24390
24391 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024393}
24394
24395
24396static int
24397test_xmlIsID(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 xmlNodePtr elem; /* the element carrying the attribute */
24405 int n_elem;
24406 xmlAttrPtr attr; /* the attribute */
24407 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024408
Daniel Veillardce244ad2004-11-05 10:03:46 +000024409 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24410 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24411 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24412 mem_base = xmlMemBlocks();
24413 doc = gen_xmlDocPtr(n_doc, 0);
24414 elem = gen_xmlNodePtr(n_elem, 1);
24415 attr = gen_xmlAttrPtr(n_attr, 2);
24416
24417 ret_val = xmlIsID(doc, elem, attr);
24418 desret_int(ret_val);
24419 call_tests++;
24420 des_xmlDocPtr(n_doc, doc, 0);
24421 des_xmlNodePtr(n_elem, elem, 1);
24422 des_xmlAttrPtr(n_attr, attr, 2);
24423 xmlResetLastError();
24424 if (mem_base != xmlMemBlocks()) {
24425 printf("Leak of %d blocks found in xmlIsID",
24426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024427 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024428 printf(" %d", n_doc);
24429 printf(" %d", n_elem);
24430 printf(" %d", n_attr);
24431 printf("\n");
24432 }
24433 }
24434 }
24435 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024436 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024437
Daniel Veillard42595322004-11-08 10:52:06 +000024438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024439}
24440
24441
24442static int
24443test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024445
24446 int mem_base;
24447 int ret_val;
24448 xmlDocPtr doc; /* the document */
24449 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024450 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024451 int n_name;
24452
24453 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24454 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024456 doc = gen_xmlDocPtr(n_doc, 0);
24457 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024458
William M. Brackf13f77f2004-11-12 16:03:48 +000024459 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024460 desret_int(ret_val);
24461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024462 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024463 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024464 xmlResetLastError();
24465 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024466 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024468 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024469 printf(" %d", n_doc);
24470 printf(" %d", n_name);
24471 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024472 }
24473 }
24474 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024475 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024476
Daniel Veillard42595322004-11-08 10:52:06 +000024477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024478}
24479
24480
24481static int
24482test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024484
Daniel Veillardce244ad2004-11-05 10:03:46 +000024485 int mem_base;
24486 int ret_val;
24487 xmlDocPtr doc; /* the document */
24488 int n_doc;
24489 xmlNodePtr elem; /* the element carrying the attribute */
24490 int n_elem;
24491 xmlAttrPtr attr; /* the attribute */
24492 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024493
Daniel Veillardce244ad2004-11-05 10:03:46 +000024494 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24495 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24496 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24497 mem_base = xmlMemBlocks();
24498 doc = gen_xmlDocPtr(n_doc, 0);
24499 elem = gen_xmlNodePtr(n_elem, 1);
24500 attr = gen_xmlAttrPtr(n_attr, 2);
24501
24502 ret_val = xmlIsRef(doc, elem, attr);
24503 desret_int(ret_val);
24504 call_tests++;
24505 des_xmlDocPtr(n_doc, doc, 0);
24506 des_xmlNodePtr(n_elem, elem, 1);
24507 des_xmlAttrPtr(n_attr, attr, 2);
24508 xmlResetLastError();
24509 if (mem_base != xmlMemBlocks()) {
24510 printf("Leak of %d blocks found in xmlIsRef",
24511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024512 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024513 printf(" %d", n_doc);
24514 printf(" %d", n_elem);
24515 printf(" %d", n_attr);
24516 printf("\n");
24517 }
24518 }
24519 }
24520 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024522
Daniel Veillard42595322004-11-08 10:52:06 +000024523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024524}
24525
24526
24527static int
24528test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024530
24531
24532 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024534}
24535
24536
24537static int
24538test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024540
24541
24542 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024544}
24545
24546
24547static int
24548test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024550
Daniel Veillardce244ad2004-11-05 10:03:46 +000024551 int mem_base;
24552 int ret_val;
24553 xmlDocPtr doc; /* the document */
24554 int n_doc;
24555 xmlAttrPtr attr; /* the attribute */
24556 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024557
Daniel Veillardce244ad2004-11-05 10:03:46 +000024558 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24559 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24560 mem_base = xmlMemBlocks();
24561 doc = gen_xmlDocPtr(n_doc, 0);
24562 attr = gen_xmlAttrPtr(n_attr, 1);
24563
24564 ret_val = xmlRemoveID(doc, attr);
24565 desret_int(ret_val);
24566 call_tests++;
24567 des_xmlDocPtr(n_doc, doc, 0);
24568 des_xmlAttrPtr(n_attr, attr, 1);
24569 xmlResetLastError();
24570 if (mem_base != xmlMemBlocks()) {
24571 printf("Leak of %d blocks found in xmlRemoveID",
24572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024573 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024574 printf(" %d", n_doc);
24575 printf(" %d", n_attr);
24576 printf("\n");
24577 }
24578 }
24579 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024581
Daniel Veillard42595322004-11-08 10:52:06 +000024582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024583}
24584
24585
24586static int
24587test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024589
Daniel Veillardce244ad2004-11-05 10:03:46 +000024590 int mem_base;
24591 int ret_val;
24592 xmlDocPtr doc; /* the document */
24593 int n_doc;
24594 xmlAttrPtr attr; /* the attribute */
24595 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024596
Daniel Veillardce244ad2004-11-05 10:03:46 +000024597 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24598 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24599 mem_base = xmlMemBlocks();
24600 doc = gen_xmlDocPtr(n_doc, 0);
24601 attr = gen_xmlAttrPtr(n_attr, 1);
24602
24603 ret_val = xmlRemoveRef(doc, attr);
24604 desret_int(ret_val);
24605 call_tests++;
24606 des_xmlDocPtr(n_doc, doc, 0);
24607 des_xmlAttrPtr(n_attr, attr, 1);
24608 xmlResetLastError();
24609 if (mem_base != xmlMemBlocks()) {
24610 printf("Leak of %d blocks found in xmlRemoveRef",
24611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024612 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024613 printf(" %d", n_doc);
24614 printf(" %d", n_attr);
24615 printf("\n");
24616 }
24617 }
24618 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024620
Daniel Veillard42595322004-11-08 10:52:06 +000024621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024622}
24623
24624
24625static int
24626test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024628
Daniel Veillardce682bc2004-11-05 17:22:25 +000024629 int mem_base;
24630 char * buf; /* an output buffer */
24631 int n_buf;
24632 int size; /* the buffer size */
24633 int n_size;
24634 xmlElementContentPtr content; /* An element table */
24635 int n_content;
24636 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24637 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024638
Daniel Veillardce682bc2004-11-05 17:22:25 +000024639 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24640 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24641 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24642 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24643 mem_base = xmlMemBlocks();
24644 buf = gen_char_ptr(n_buf, 0);
24645 size = gen_int(n_size, 1);
24646 content = gen_xmlElementContentPtr(n_content, 2);
24647 glob = gen_int(n_glob, 3);
24648
24649 xmlSnprintfElementContent(buf, size, content, glob);
24650 call_tests++;
24651 des_char_ptr(n_buf, buf, 0);
24652 des_int(n_size, size, 1);
24653 des_xmlElementContentPtr(n_content, content, 2);
24654 des_int(n_glob, glob, 3);
24655 xmlResetLastError();
24656 if (mem_base != xmlMemBlocks()) {
24657 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024659 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024660 printf(" %d", n_buf);
24661 printf(" %d", n_size);
24662 printf(" %d", n_content);
24663 printf(" %d", n_glob);
24664 printf("\n");
24665 }
24666 }
24667 }
24668 }
24669 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024670 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024671
Daniel Veillard42595322004-11-08 10:52:06 +000024672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024673}
24674
24675
24676static int
24677test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024679
Daniel Veillarda521d282004-11-09 14:59:59 +000024680#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024681 int mem_base;
24682 char * buf; /* an output buffer */
24683 int n_buf;
24684 xmlElementContentPtr content; /* An element table */
24685 int n_content;
24686 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24687 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024688
Daniel Veillardce682bc2004-11-05 17:22:25 +000024689 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24690 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24691 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24692 mem_base = xmlMemBlocks();
24693 buf = gen_char_ptr(n_buf, 0);
24694 content = gen_xmlElementContentPtr(n_content, 1);
24695 glob = gen_int(n_glob, 2);
24696
24697 xmlSprintfElementContent(buf, content, glob);
24698 call_tests++;
24699 des_char_ptr(n_buf, buf, 0);
24700 des_xmlElementContentPtr(n_content, content, 1);
24701 des_int(n_glob, glob, 2);
24702 xmlResetLastError();
24703 if (mem_base != xmlMemBlocks()) {
24704 printf("Leak of %d blocks found in xmlSprintfElementContent",
24705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024706 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024707 printf(" %d", n_buf);
24708 printf(" %d", n_content);
24709 printf(" %d", n_glob);
24710 printf("\n");
24711 }
24712 }
24713 }
24714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024715 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024716#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024717
Daniel Veillard42595322004-11-08 10:52:06 +000024718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024719}
24720
24721
24722static int
24723test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024725
Daniel Veillardce682bc2004-11-05 17:22:25 +000024726#ifdef LIBXML_REGEXP_ENABLED
24727 int mem_base;
24728 int ret_val;
24729 xmlValidCtxtPtr ctxt; /* a validation context */
24730 int n_ctxt;
24731 xmlElementPtr elem; /* an element declaration node */
24732 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024733
Daniel Veillardce682bc2004-11-05 17:22:25 +000024734 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24735 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24736 mem_base = xmlMemBlocks();
24737 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24738 elem = gen_xmlElementPtr(n_elem, 1);
24739
24740 ret_val = xmlValidBuildContentModel(ctxt, elem);
24741 desret_int(ret_val);
24742 call_tests++;
24743 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24744 des_xmlElementPtr(n_elem, elem, 1);
24745 xmlResetLastError();
24746 if (mem_base != xmlMemBlocks()) {
24747 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024749 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024750 printf(" %d", n_ctxt);
24751 printf(" %d", n_elem);
24752 printf("\n");
24753 }
24754 }
24755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024756 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024757#endif
24758
Daniel Veillard42595322004-11-08 10:52:06 +000024759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024760}
24761
24762
24763static int
24764test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024766
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024767#ifdef LIBXML_VALID_ENABLED
24768 int mem_base;
24769 xmlChar * ret_val;
24770 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24771 int n_ctxt;
24772 xmlDocPtr doc; /* the document */
24773 int n_doc;
24774 xmlNodePtr elem; /* the parent */
24775 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024776 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024777 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024778 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024779 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024780
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024781 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24782 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24783 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24784 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24785 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024787 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24788 doc = gen_xmlDocPtr(n_doc, 1);
24789 elem = gen_xmlNodePtr(n_elem, 2);
24790 name = gen_const_xmlChar_ptr(n_name, 3);
24791 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024792
William M. Brackf13f77f2004-11-12 16:03:48 +000024793 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024794 desret_xmlChar_ptr(ret_val);
24795 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024796 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24797 des_xmlDocPtr(n_doc, doc, 1);
24798 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024799 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24800 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024801 xmlResetLastError();
24802 if (mem_base != xmlMemBlocks()) {
24803 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024805 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024806 printf(" %d", n_ctxt);
24807 printf(" %d", n_doc);
24808 printf(" %d", n_elem);
24809 printf(" %d", n_name);
24810 printf(" %d", n_value);
24811 printf("\n");
24812 }
24813 }
24814 }
24815 }
24816 }
24817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024818 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024819#endif
24820
Daniel Veillard42595322004-11-08 10:52:06 +000024821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024822}
24823
24824
Daniel Veillardce682bc2004-11-05 17:22:25 +000024825#define gen_nb_xmlElementContent_ptr 1
24826static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24827 return(NULL);
24828}
24829static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24830}
24831
Daniel Veillardd93f6252004-11-02 15:53:51 +000024832static int
24833test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024835
Daniel Veillarda521d282004-11-09 14:59:59 +000024836#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024837 int mem_base;
24838 int ret_val;
24839 xmlElementContent * ctree; /* an element content tree */
24840 int n_ctree;
24841 xmlChar ** list; /* an array to store the list of child names */
24842 int n_list;
24843 int * len; /* a pointer to the number of element in the list */
24844 int n_len;
24845 int max; /* the size of the array */
24846 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024847
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024848 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24849 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24850 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24851 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24852 mem_base = xmlMemBlocks();
24853 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24854 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24855 len = gen_int_ptr(n_len, 2);
24856 max = gen_int(n_max, 3);
24857
William M. Brackf13f77f2004-11-12 16:03:48 +000024858 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024859 desret_int(ret_val);
24860 call_tests++;
24861 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024862 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024863 des_int_ptr(n_len, len, 2);
24864 des_int(n_max, max, 3);
24865 xmlResetLastError();
24866 if (mem_base != xmlMemBlocks()) {
24867 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024869 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024870 printf(" %d", n_ctree);
24871 printf(" %d", n_list);
24872 printf(" %d", n_len);
24873 printf(" %d", n_max);
24874 printf("\n");
24875 }
24876 }
24877 }
24878 }
24879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024880 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024881#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024882
Daniel Veillard42595322004-11-08 10:52:06 +000024883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024884}
24885
24886
24887static int
24888test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024890
Daniel Veillarda521d282004-11-09 14:59:59 +000024891#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024892 int mem_base;
24893 int ret_val;
24894 xmlNode * prev; /* an element to insert after */
24895 int n_prev;
24896 xmlNode * next; /* an element to insert next */
24897 int n_next;
24898 xmlChar ** names; /* an array to store the list of child names */
24899 int n_names;
24900 int max; /* the size of the array */
24901 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024902
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024903 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24904 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24905 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24906 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24907 mem_base = xmlMemBlocks();
24908 prev = gen_xmlNodePtr(n_prev, 0);
24909 next = gen_xmlNodePtr(n_next, 1);
24910 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24911 max = gen_int(n_max, 3);
24912
William M. Brackf13f77f2004-11-12 16:03:48 +000024913 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024914 desret_int(ret_val);
24915 call_tests++;
24916 des_xmlNodePtr(n_prev, prev, 0);
24917 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024918 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024919 des_int(n_max, max, 3);
24920 xmlResetLastError();
24921 if (mem_base != xmlMemBlocks()) {
24922 printf("Leak of %d blocks found in xmlValidGetValidElements",
24923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024924 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024925 printf(" %d", n_prev);
24926 printf(" %d", n_next);
24927 printf(" %d", n_names);
24928 printf(" %d", n_max);
24929 printf("\n");
24930 }
24931 }
24932 }
24933 }
24934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024935 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024936#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024937
Daniel Veillard42595322004-11-08 10:52:06 +000024938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024939}
24940
24941
24942static int
24943test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024945
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024946#ifdef LIBXML_VALID_ENABLED
24947 int mem_base;
24948 xmlChar * ret_val;
24949 xmlDocPtr doc; /* the document */
24950 int n_doc;
24951 xmlNodePtr elem; /* the parent */
24952 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024953 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024954 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024955 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024956 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024957
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024958 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24959 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24960 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24961 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24962 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024963 doc = gen_xmlDocPtr(n_doc, 0);
24964 elem = gen_xmlNodePtr(n_elem, 1);
24965 name = gen_const_xmlChar_ptr(n_name, 2);
24966 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024967
William M. Brackf13f77f2004-11-12 16:03:48 +000024968 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024969 desret_xmlChar_ptr(ret_val);
24970 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024971 des_xmlDocPtr(n_doc, doc, 0);
24972 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024973 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24974 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024975 xmlResetLastError();
24976 if (mem_base != xmlMemBlocks()) {
24977 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024979 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024980 printf(" %d", n_doc);
24981 printf(" %d", n_elem);
24982 printf(" %d", n_name);
24983 printf(" %d", n_value);
24984 printf("\n");
24985 }
24986 }
24987 }
24988 }
24989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024990 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024991#endif
24992
Daniel Veillard42595322004-11-08 10:52:06 +000024993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024994}
24995
24996
24997static int
24998test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025000
Daniel Veillardce682bc2004-11-05 17:22:25 +000025001#ifdef LIBXML_VALID_ENABLED
25002 int mem_base;
25003 int ret_val;
25004 xmlValidCtxtPtr ctxt; /* the validation context */
25005 int n_ctxt;
25006 xmlDocPtr doc; /* a document instance */
25007 int n_doc;
25008 xmlAttributePtr attr; /* an attribute definition */
25009 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025010
Daniel Veillardce682bc2004-11-05 17:22:25 +000025011 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25012 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25013 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25014 mem_base = xmlMemBlocks();
25015 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25016 doc = gen_xmlDocPtr(n_doc, 1);
25017 attr = gen_xmlAttributePtr(n_attr, 2);
25018
25019 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25020 desret_int(ret_val);
25021 call_tests++;
25022 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25023 des_xmlDocPtr(n_doc, doc, 1);
25024 des_xmlAttributePtr(n_attr, attr, 2);
25025 xmlResetLastError();
25026 if (mem_base != xmlMemBlocks()) {
25027 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025029 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025030 printf(" %d", n_ctxt);
25031 printf(" %d", n_doc);
25032 printf(" %d", n_attr);
25033 printf("\n");
25034 }
25035 }
25036 }
25037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025038 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025039#endif
25040
Daniel Veillard42595322004-11-08 10:52:06 +000025041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025042}
25043
25044
25045static int
25046test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025048
Daniel Veillard57b25162004-11-06 14:50:18 +000025049#ifdef LIBXML_VALID_ENABLED
25050 int mem_base;
25051 int ret_val;
25052 xmlAttributeType type; /* an attribute type */
25053 int n_type;
25054 xmlChar * value; /* an attribute value */
25055 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025056
Daniel Veillard57b25162004-11-06 14:50:18 +000025057 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25058 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25059 mem_base = xmlMemBlocks();
25060 type = gen_xmlAttributeType(n_type, 0);
25061 value = gen_const_xmlChar_ptr(n_value, 1);
25062
William M. Brackf13f77f2004-11-12 16:03:48 +000025063 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025064 desret_int(ret_val);
25065 call_tests++;
25066 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025067 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025068 xmlResetLastError();
25069 if (mem_base != xmlMemBlocks()) {
25070 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025072 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025073 printf(" %d", n_type);
25074 printf(" %d", n_value);
25075 printf("\n");
25076 }
25077 }
25078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025079 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025080#endif
25081
Daniel Veillard42595322004-11-08 10:52:06 +000025082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025083}
25084
25085
25086static int
25087test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025089
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025090#ifdef LIBXML_VALID_ENABLED
25091 int mem_base;
25092 int ret_val;
25093 xmlValidCtxtPtr ctxt; /* the validation context */
25094 int n_ctxt;
25095 xmlDocPtr doc; /* a document instance */
25096 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025097
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025098 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25099 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025101 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25102 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025103
25104 ret_val = xmlValidateDocument(ctxt, doc);
25105 desret_int(ret_val);
25106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025107 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25108 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025109 xmlResetLastError();
25110 if (mem_base != xmlMemBlocks()) {
25111 printf("Leak of %d blocks found in xmlValidateDocument",
25112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025113 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025114 printf(" %d", n_ctxt);
25115 printf(" %d", n_doc);
25116 printf("\n");
25117 }
25118 }
25119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025120 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025121#endif
25122
Daniel Veillard42595322004-11-08 10:52:06 +000025123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025124}
25125
25126
25127static int
25128test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025130
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025131#ifdef LIBXML_VALID_ENABLED
25132 int mem_base;
25133 int ret_val;
25134 xmlValidCtxtPtr ctxt; /* the validation context */
25135 int n_ctxt;
25136 xmlDocPtr doc; /* a document instance */
25137 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025138
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025139 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25140 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025142 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25143 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025144
25145 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25146 desret_int(ret_val);
25147 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025148 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25149 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025150 xmlResetLastError();
25151 if (mem_base != xmlMemBlocks()) {
25152 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025154 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025155 printf(" %d", n_ctxt);
25156 printf(" %d", n_doc);
25157 printf("\n");
25158 }
25159 }
25160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025161 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025162#endif
25163
Daniel Veillard42595322004-11-08 10:52:06 +000025164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025165}
25166
25167
25168static int
25169test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025171
Daniel Veillard27f20102004-11-05 11:50:11 +000025172#ifdef LIBXML_VALID_ENABLED
25173 int mem_base;
25174 int ret_val;
25175 xmlValidCtxtPtr ctxt; /* the validation context */
25176 int n_ctxt;
25177 xmlDocPtr doc; /* a document instance */
25178 int n_doc;
25179 xmlDtdPtr dtd; /* a dtd instance */
25180 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025181
Daniel Veillard27f20102004-11-05 11:50:11 +000025182 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25183 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25184 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25185 mem_base = xmlMemBlocks();
25186 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25187 doc = gen_xmlDocPtr(n_doc, 1);
25188 dtd = gen_xmlDtdPtr(n_dtd, 2);
25189
25190 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25191 desret_int(ret_val);
25192 call_tests++;
25193 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25194 des_xmlDocPtr(n_doc, doc, 1);
25195 des_xmlDtdPtr(n_dtd, dtd, 2);
25196 xmlResetLastError();
25197 if (mem_base != xmlMemBlocks()) {
25198 printf("Leak of %d blocks found in xmlValidateDtd",
25199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025200 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025201 printf(" %d", n_ctxt);
25202 printf(" %d", n_doc);
25203 printf(" %d", n_dtd);
25204 printf("\n");
25205 }
25206 }
25207 }
25208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025209 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025210#endif
25211
Daniel Veillard42595322004-11-08 10:52:06 +000025212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025213}
25214
25215
25216static int
25217test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025219
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025220#ifdef LIBXML_VALID_ENABLED
25221 int mem_base;
25222 int ret_val;
25223 xmlValidCtxtPtr ctxt; /* the validation context */
25224 int n_ctxt;
25225 xmlDocPtr doc; /* a document instance */
25226 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025227
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025228 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25229 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25230 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025231 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25232 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025233
25234 ret_val = xmlValidateDtdFinal(ctxt, doc);
25235 desret_int(ret_val);
25236 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025237 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25238 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025239 xmlResetLastError();
25240 if (mem_base != xmlMemBlocks()) {
25241 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025243 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025244 printf(" %d", n_ctxt);
25245 printf(" %d", n_doc);
25246 printf("\n");
25247 }
25248 }
25249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025250 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025251#endif
25252
Daniel Veillard42595322004-11-08 10:52:06 +000025253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025254}
25255
25256
25257static int
25258test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025260
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025261#ifdef LIBXML_VALID_ENABLED
25262 int mem_base;
25263 int ret_val;
25264 xmlValidCtxtPtr ctxt; /* the validation context */
25265 int n_ctxt;
25266 xmlDocPtr doc; /* a document instance */
25267 int n_doc;
25268 xmlNodePtr elem; /* an element instance */
25269 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025270
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025271 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25273 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025275 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25276 doc = gen_xmlDocPtr(n_doc, 1);
25277 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025278
25279 ret_val = xmlValidateElement(ctxt, doc, elem);
25280 desret_int(ret_val);
25281 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025282 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25283 des_xmlDocPtr(n_doc, doc, 1);
25284 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025285 xmlResetLastError();
25286 if (mem_base != xmlMemBlocks()) {
25287 printf("Leak of %d blocks found in xmlValidateElement",
25288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025289 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025290 printf(" %d", n_ctxt);
25291 printf(" %d", n_doc);
25292 printf(" %d", n_elem);
25293 printf("\n");
25294 }
25295 }
25296 }
25297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025298 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +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_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025308
Daniel Veillardce682bc2004-11-05 17:22:25 +000025309#ifdef LIBXML_VALID_ENABLED
25310 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 xmlElementPtr elem; /* an element definition */
25317 int n_elem;
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_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25322 mem_base = xmlMemBlocks();
25323 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25324 doc = gen_xmlDocPtr(n_doc, 1);
25325 elem = gen_xmlElementPtr(n_elem, 2);
25326
25327 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25328 desret_int(ret_val);
25329 call_tests++;
25330 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25331 des_xmlDocPtr(n_doc, doc, 1);
25332 des_xmlElementPtr(n_elem, elem, 2);
25333 xmlResetLastError();
25334 if (mem_base != xmlMemBlocks()) {
25335 printf("Leak of %d blocks found in xmlValidateElementDecl",
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_elem);
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_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025356
25357#ifdef LIBXML_VALID_ENABLED
25358 int mem_base;
25359 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025360 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025361 int n_value;
25362
25363 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025365 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025366
William M. Brackf13f77f2004-11-12 16:03:48 +000025367 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025368 desret_int(ret_val);
25369 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025370 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025371 xmlResetLastError();
25372 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025373 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025375 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025376 printf(" %d", n_value);
25377 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025378 }
25379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025380 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025381#endif
25382
Daniel Veillard42595322004-11-08 10:52:06 +000025383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025384}
25385
25386
25387static int
25388test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025390
25391#ifdef LIBXML_VALID_ENABLED
25392 int mem_base;
25393 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025394 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025395 int n_value;
25396
25397 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25398 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025399 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025400
William M. Brackf13f77f2004-11-12 16:03:48 +000025401 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025402 desret_int(ret_val);
25403 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025404 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025405 xmlResetLastError();
25406 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025407 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025409 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025410 printf(" %d", n_value);
25411 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025412 }
25413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025414 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025415#endif
25416
Daniel Veillard42595322004-11-08 10:52:06 +000025417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025418}
25419
25420
25421static int
25422test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025424
25425#ifdef LIBXML_VALID_ENABLED
25426 int mem_base;
25427 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025428 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025429 int n_value;
25430
25431 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025433 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025434
William M. Brackf13f77f2004-11-12 16:03:48 +000025435 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025436 desret_int(ret_val);
25437 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025438 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025439 xmlResetLastError();
25440 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025441 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025443 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025444 printf(" %d", n_value);
25445 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025446 }
25447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025448 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025449#endif
25450
Daniel Veillard42595322004-11-08 10:52:06 +000025451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025452}
25453
25454
25455static int
25456test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025458
25459#ifdef LIBXML_VALID_ENABLED
25460 int mem_base;
25461 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025462 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025463 int n_value;
25464
25465 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025467 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025468
William M. Brackf13f77f2004-11-12 16:03:48 +000025469 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025470 desret_int(ret_val);
25471 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025472 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025473 xmlResetLastError();
25474 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025475 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025477 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025478 printf(" %d", n_value);
25479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025480 }
25481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025482 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025483#endif
25484
Daniel Veillard42595322004-11-08 10:52:06 +000025485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025486}
25487
25488
25489static int
25490test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025492
Daniel Veillardce682bc2004-11-05 17:22:25 +000025493#ifdef LIBXML_VALID_ENABLED
25494 int mem_base;
25495 int ret_val;
25496 xmlValidCtxtPtr ctxt; /* the validation context */
25497 int n_ctxt;
25498 xmlDocPtr doc; /* a document instance */
25499 int n_doc;
25500 xmlNotationPtr nota; /* a notation definition */
25501 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025502
Daniel Veillardce682bc2004-11-05 17:22:25 +000025503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25504 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25505 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25506 mem_base = xmlMemBlocks();
25507 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25508 doc = gen_xmlDocPtr(n_doc, 1);
25509 nota = gen_xmlNotationPtr(n_nota, 2);
25510
25511 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25512 desret_int(ret_val);
25513 call_tests++;
25514 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25515 des_xmlDocPtr(n_doc, doc, 1);
25516 des_xmlNotationPtr(n_nota, nota, 2);
25517 xmlResetLastError();
25518 if (mem_base != xmlMemBlocks()) {
25519 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025521 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025522 printf(" %d", n_ctxt);
25523 printf(" %d", n_doc);
25524 printf(" %d", n_nota);
25525 printf("\n");
25526 }
25527 }
25528 }
25529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025530 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025531#endif
25532
Daniel Veillard42595322004-11-08 10:52:06 +000025533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025534}
25535
25536
25537static int
25538test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025540
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025541#ifdef LIBXML_VALID_ENABLED
25542 int mem_base;
25543 int ret_val;
25544 xmlValidCtxtPtr ctxt; /* the validation context */
25545 int n_ctxt;
25546 xmlDocPtr doc; /* the document */
25547 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025548 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025549 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025550
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025551 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25552 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25553 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25554 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025555 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25556 doc = gen_xmlDocPtr(n_doc, 1);
25557 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025558
William M. Brackf13f77f2004-11-12 16:03:48 +000025559 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025560 desret_int(ret_val);
25561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025562 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25563 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025564 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025565 xmlResetLastError();
25566 if (mem_base != xmlMemBlocks()) {
25567 printf("Leak of %d blocks found in xmlValidateNotationUse",
25568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025569 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025570 printf(" %d", n_ctxt);
25571 printf(" %d", n_doc);
25572 printf(" %d", n_notationName);
25573 printf("\n");
25574 }
25575 }
25576 }
25577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025578 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025579#endif
25580
Daniel Veillard42595322004-11-08 10:52:06 +000025581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025582}
25583
25584
25585static int
25586test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025588
Daniel Veillardce244ad2004-11-05 10:03:46 +000025589#ifdef LIBXML_VALID_ENABLED
25590 int mem_base;
25591 int ret_val;
25592 xmlValidCtxtPtr ctxt; /* the validation context */
25593 int n_ctxt;
25594 xmlDocPtr doc; /* a document instance */
25595 int n_doc;
25596 xmlNodePtr elem; /* an element instance */
25597 int n_elem;
25598 xmlAttrPtr attr; /* an attribute instance */
25599 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025600 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025601 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025602
Daniel Veillardce244ad2004-11-05 10:03:46 +000025603 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25604 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25605 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25606 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25607 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25608 mem_base = xmlMemBlocks();
25609 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25610 doc = gen_xmlDocPtr(n_doc, 1);
25611 elem = gen_xmlNodePtr(n_elem, 2);
25612 attr = gen_xmlAttrPtr(n_attr, 3);
25613 value = gen_const_xmlChar_ptr(n_value, 4);
25614
William M. Brackf13f77f2004-11-12 16:03:48 +000025615 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025616 desret_int(ret_val);
25617 call_tests++;
25618 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25619 des_xmlDocPtr(n_doc, doc, 1);
25620 des_xmlNodePtr(n_elem, elem, 2);
25621 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025622 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025623 xmlResetLastError();
25624 if (mem_base != xmlMemBlocks()) {
25625 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025627 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025628 printf(" %d", n_ctxt);
25629 printf(" %d", n_doc);
25630 printf(" %d", n_elem);
25631 printf(" %d", n_attr);
25632 printf(" %d", n_value);
25633 printf("\n");
25634 }
25635 }
25636 }
25637 }
25638 }
25639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025640 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025641#endif
25642
Daniel Veillard42595322004-11-08 10:52:06 +000025643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025644}
25645
25646
25647static int
25648test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025650
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025651#ifdef LIBXML_VALID_ENABLED
25652 int mem_base;
25653 int ret_val;
25654 xmlValidCtxtPtr ctxt; /* the validation context */
25655 int n_ctxt;
25656 xmlDocPtr doc; /* a document instance */
25657 int n_doc;
25658 xmlNodePtr elem; /* an element instance */
25659 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025660
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025661 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25662 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25663 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25664 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025665 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25666 doc = gen_xmlDocPtr(n_doc, 1);
25667 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025668
25669 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25670 desret_int(ret_val);
25671 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025672 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25673 des_xmlDocPtr(n_doc, doc, 1);
25674 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025675 xmlResetLastError();
25676 if (mem_base != xmlMemBlocks()) {
25677 printf("Leak of %d blocks found in xmlValidateOneElement",
25678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025679 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025680 printf(" %d", n_ctxt);
25681 printf(" %d", n_doc);
25682 printf(" %d", n_elem);
25683 printf("\n");
25684 }
25685 }
25686 }
25687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025688 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025689#endif
25690
Daniel Veillard42595322004-11-08 10:52:06 +000025691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025692}
25693
25694
25695static int
25696test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025698
Daniel Veillard27f20102004-11-05 11:50:11 +000025699#ifdef LIBXML_VALID_ENABLED
25700 int mem_base;
25701 int ret_val;
25702 xmlValidCtxtPtr ctxt; /* the validation context */
25703 int n_ctxt;
25704 xmlDocPtr doc; /* a document instance */
25705 int n_doc;
25706 xmlNodePtr elem; /* an element instance */
25707 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025708 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025709 int n_prefix;
25710 xmlNsPtr ns; /* an namespace declaration instance */
25711 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025712 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025713 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025714
Daniel Veillard27f20102004-11-05 11:50:11 +000025715 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25716 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25717 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25718 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25719 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25720 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25721 mem_base = xmlMemBlocks();
25722 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25723 doc = gen_xmlDocPtr(n_doc, 1);
25724 elem = gen_xmlNodePtr(n_elem, 2);
25725 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25726 ns = gen_xmlNsPtr(n_ns, 4);
25727 value = gen_const_xmlChar_ptr(n_value, 5);
25728
William M. Brackf13f77f2004-11-12 16:03:48 +000025729 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025730 desret_int(ret_val);
25731 call_tests++;
25732 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25733 des_xmlDocPtr(n_doc, doc, 1);
25734 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025735 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025736 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025737 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025738 xmlResetLastError();
25739 if (mem_base != xmlMemBlocks()) {
25740 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025742 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025743 printf(" %d", n_ctxt);
25744 printf(" %d", n_doc);
25745 printf(" %d", n_elem);
25746 printf(" %d", n_prefix);
25747 printf(" %d", n_ns);
25748 printf(" %d", n_value);
25749 printf("\n");
25750 }
25751 }
25752 }
25753 }
25754 }
25755 }
25756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025757 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025758#endif
25759
Daniel Veillard42595322004-11-08 10:52:06 +000025760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025761}
25762
25763
25764static int
25765test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025767
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025768#ifdef LIBXML_REGEXP_ENABLED
25769 int mem_base;
25770 int ret_val;
25771 xmlValidCtxtPtr ctxt; /* the validation context */
25772 int n_ctxt;
25773 xmlDocPtr doc; /* a document instance */
25774 int n_doc;
25775 xmlNodePtr elem; /* an element instance */
25776 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025777 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025778 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025779
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025780 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25781 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25782 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25783 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25784 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025785 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25786 doc = gen_xmlDocPtr(n_doc, 1);
25787 elem = gen_xmlNodePtr(n_elem, 2);
25788 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025789
William M. Brackf13f77f2004-11-12 16:03:48 +000025790 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025791 desret_int(ret_val);
25792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025793 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25794 des_xmlDocPtr(n_doc, doc, 1);
25795 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025796 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025797 xmlResetLastError();
25798 if (mem_base != xmlMemBlocks()) {
25799 printf("Leak of %d blocks found in xmlValidatePopElement",
25800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025801 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025802 printf(" %d", n_ctxt);
25803 printf(" %d", n_doc);
25804 printf(" %d", n_elem);
25805 printf(" %d", n_qname);
25806 printf("\n");
25807 }
25808 }
25809 }
25810 }
25811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025812 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025813#endif
25814
Daniel Veillard42595322004-11-08 10:52:06 +000025815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025816}
25817
25818
25819static int
25820test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025822
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025823#ifdef LIBXML_REGEXP_ENABLED
25824 int mem_base;
25825 int ret_val;
25826 xmlValidCtxtPtr ctxt; /* the validation context */
25827 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025828 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025829 int n_data;
25830 int len; /* the lenght of the data */
25831 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025832
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025833 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25834 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25835 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25836 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025837 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25838 data = gen_const_xmlChar_ptr(n_data, 1);
25839 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025840
William M. Brackf13f77f2004-11-12 16:03:48 +000025841 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025842 desret_int(ret_val);
25843 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025844 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025845 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025846 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025847 xmlResetLastError();
25848 if (mem_base != xmlMemBlocks()) {
25849 printf("Leak of %d blocks found in xmlValidatePushCData",
25850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025851 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025852 printf(" %d", n_ctxt);
25853 printf(" %d", n_data);
25854 printf(" %d", n_len);
25855 printf("\n");
25856 }
25857 }
25858 }
25859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025860 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025861#endif
25862
Daniel Veillard42595322004-11-08 10:52:06 +000025863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025864}
25865
25866
25867static int
25868test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025870
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025871#ifdef LIBXML_REGEXP_ENABLED
25872 int mem_base;
25873 int ret_val;
25874 xmlValidCtxtPtr ctxt; /* the validation context */
25875 int n_ctxt;
25876 xmlDocPtr doc; /* a document instance */
25877 int n_doc;
25878 xmlNodePtr elem; /* an element instance */
25879 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025880 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025881 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025882
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025883 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25884 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25885 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25886 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25887 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025888 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25889 doc = gen_xmlDocPtr(n_doc, 1);
25890 elem = gen_xmlNodePtr(n_elem, 2);
25891 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025892
William M. Brackf13f77f2004-11-12 16:03:48 +000025893 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025894 desret_int(ret_val);
25895 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025896 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25897 des_xmlDocPtr(n_doc, doc, 1);
25898 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025899 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025900 xmlResetLastError();
25901 if (mem_base != xmlMemBlocks()) {
25902 printf("Leak of %d blocks found in xmlValidatePushElement",
25903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025904 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025905 printf(" %d", n_ctxt);
25906 printf(" %d", n_doc);
25907 printf(" %d", n_elem);
25908 printf(" %d", n_qname);
25909 printf("\n");
25910 }
25911 }
25912 }
25913 }
25914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025915 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025916#endif
25917
Daniel Veillard42595322004-11-08 10:52:06 +000025918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025919}
25920
25921
25922static int
25923test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025925
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025926#ifdef LIBXML_VALID_ENABLED
25927 int mem_base;
25928 int ret_val;
25929 xmlValidCtxtPtr ctxt; /* the validation context */
25930 int n_ctxt;
25931 xmlDocPtr doc; /* a document instance */
25932 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025933
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025934 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25935 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025937 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25938 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025939
25940 ret_val = xmlValidateRoot(ctxt, doc);
25941 desret_int(ret_val);
25942 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025943 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25944 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025945 xmlResetLastError();
25946 if (mem_base != xmlMemBlocks()) {
25947 printf("Leak of %d blocks found in xmlValidateRoot",
25948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025949 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025950 printf(" %d", n_ctxt);
25951 printf(" %d", n_doc);
25952 printf("\n");
25953 }
25954 }
25955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025956 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025957#endif
25958
Daniel Veillard42595322004-11-08 10:52:06 +000025959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025960}
25961
25962static int
25963test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025965
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025966 if (quiet == 0) printf("Testing valid : 46 of 67 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025967 test_ret += test_xmlAddAttributeDecl();
25968 test_ret += test_xmlAddElementDecl();
25969 test_ret += test_xmlAddID();
25970 test_ret += test_xmlAddNotationDecl();
25971 test_ret += test_xmlAddRef();
25972 test_ret += test_xmlCopyAttributeTable();
25973 test_ret += test_xmlCopyElementContent();
25974 test_ret += test_xmlCopyElementTable();
25975 test_ret += test_xmlCopyEnumeration();
25976 test_ret += test_xmlCopyNotationTable();
25977 test_ret += test_xmlCreateEnumeration();
25978 test_ret += test_xmlDumpAttributeDecl();
25979 test_ret += test_xmlDumpAttributeTable();
25980 test_ret += test_xmlDumpElementDecl();
25981 test_ret += test_xmlDumpElementTable();
25982 test_ret += test_xmlDumpNotationDecl();
25983 test_ret += test_xmlDumpNotationTable();
25984 test_ret += test_xmlGetDtdAttrDesc();
25985 test_ret += test_xmlGetDtdElementDesc();
25986 test_ret += test_xmlGetDtdNotationDesc();
25987 test_ret += test_xmlGetDtdQAttrDesc();
25988 test_ret += test_xmlGetDtdQElementDesc();
25989 test_ret += test_xmlGetID();
25990 test_ret += test_xmlGetRefs();
25991 test_ret += test_xmlIsID();
25992 test_ret += test_xmlIsMixedElement();
25993 test_ret += test_xmlIsRef();
25994 test_ret += test_xmlNewElementContent();
25995 test_ret += test_xmlNewValidCtxt();
25996 test_ret += test_xmlRemoveID();
25997 test_ret += test_xmlRemoveRef();
25998 test_ret += test_xmlSnprintfElementContent();
25999 test_ret += test_xmlSprintfElementContent();
26000 test_ret += test_xmlValidBuildContentModel();
26001 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
26002 test_ret += test_xmlValidGetPotentialChildren();
26003 test_ret += test_xmlValidGetValidElements();
26004 test_ret += test_xmlValidNormalizeAttributeValue();
26005 test_ret += test_xmlValidateAttributeDecl();
26006 test_ret += test_xmlValidateAttributeValue();
26007 test_ret += test_xmlValidateDocument();
26008 test_ret += test_xmlValidateDocumentFinal();
26009 test_ret += test_xmlValidateDtd();
26010 test_ret += test_xmlValidateDtdFinal();
26011 test_ret += test_xmlValidateElement();
26012 test_ret += test_xmlValidateElementDecl();
26013 test_ret += test_xmlValidateNameValue();
26014 test_ret += test_xmlValidateNamesValue();
26015 test_ret += test_xmlValidateNmtokenValue();
26016 test_ret += test_xmlValidateNmtokensValue();
26017 test_ret += test_xmlValidateNotationDecl();
26018 test_ret += test_xmlValidateNotationUse();
26019 test_ret += test_xmlValidateOneAttribute();
26020 test_ret += test_xmlValidateOneElement();
26021 test_ret += test_xmlValidateOneNamespace();
26022 test_ret += test_xmlValidatePopElement();
26023 test_ret += test_xmlValidatePushCData();
26024 test_ret += test_xmlValidatePushElement();
26025 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026026
Daniel Veillard42595322004-11-08 10:52:06 +000026027 if (test_ret != 0)
26028 printf("Module valid: %d errors\n", test_ret);
26029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026030}
26031
26032static int
26033test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026035
26036
26037 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026039}
26040
26041
26042static int
26043test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026045
26046#ifdef LIBXML_XINCLUDE_ENABLED
26047 int mem_base;
26048 int ret_val;
26049 xmlDocPtr doc; /* an XML document */
26050 int n_doc;
26051
26052 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026054 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026055
26056 ret_val = xmlXIncludeProcess(doc);
26057 desret_int(ret_val);
26058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026059 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026060 xmlResetLastError();
26061 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026062 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026064 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026065 printf(" %d", n_doc);
26066 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026067 }
26068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026069 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026070#endif
26071
Daniel Veillard42595322004-11-08 10:52:06 +000026072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026073}
26074
26075
26076static int
26077test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026079
26080#ifdef LIBXML_XINCLUDE_ENABLED
26081 int mem_base;
26082 int ret_val;
26083 xmlDocPtr doc; /* an XML document */
26084 int n_doc;
26085 int flags; /* a set of xmlParserOption used for parsing XML includes */
26086 int n_flags;
26087
26088 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26089 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026091 doc = gen_xmlDocPtr(n_doc, 0);
26092 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026093
26094 ret_val = xmlXIncludeProcessFlags(doc, flags);
26095 desret_int(ret_val);
26096 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026097 des_xmlDocPtr(n_doc, doc, 0);
26098 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026099 xmlResetLastError();
26100 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026101 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026103 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026104 printf(" %d", n_doc);
26105 printf(" %d", n_flags);
26106 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026107 }
26108 }
26109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026110 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111#endif
26112
Daniel Veillard42595322004-11-08 10:52:06 +000026113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026114}
26115
Daniel Veillarda521d282004-11-09 14:59:59 +000026116#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026117
Daniel Veillardce682bc2004-11-05 17:22:25 +000026118#define gen_nb_xmlXIncludeCtxtPtr 1
26119static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26120 return(NULL);
26121}
26122static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26123}
Daniel Veillarda521d282004-11-09 14:59:59 +000026124#endif
26125
Daniel Veillardce682bc2004-11-05 17:22:25 +000026126
Daniel Veillardd93f6252004-11-02 15:53:51 +000026127static int
26128test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026130
Daniel Veillardce682bc2004-11-05 17:22:25 +000026131#ifdef LIBXML_XINCLUDE_ENABLED
26132 int mem_base;
26133 int ret_val;
26134 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26135 int n_ctxt;
26136 xmlNodePtr node; /* a node in an XML document */
26137 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026138
Daniel Veillardce682bc2004-11-05 17:22:25 +000026139 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26140 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26141 mem_base = xmlMemBlocks();
26142 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26143 node = gen_xmlNodePtr(n_node, 1);
26144
26145 ret_val = xmlXIncludeProcessNode(ctxt, node);
26146 desret_int(ret_val);
26147 call_tests++;
26148 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26149 des_xmlNodePtr(n_node, node, 1);
26150 xmlResetLastError();
26151 if (mem_base != xmlMemBlocks()) {
26152 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026154 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026155 printf(" %d", n_ctxt);
26156 printf(" %d", n_node);
26157 printf("\n");
26158 }
26159 }
26160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026161 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026162#endif
26163
Daniel Veillard42595322004-11-08 10:52:06 +000026164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026165}
26166
26167
26168static int
26169test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026171
26172#ifdef LIBXML_XINCLUDE_ENABLED
26173 int mem_base;
26174 int ret_val;
26175 xmlNodePtr tree; /* a node in an XML document */
26176 int n_tree;
26177
26178 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026180 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026181
26182 ret_val = xmlXIncludeProcessTree(tree);
26183 desret_int(ret_val);
26184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026185 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026186 xmlResetLastError();
26187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026188 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026191 printf(" %d", n_tree);
26192 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026193 }
26194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026195 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026196#endif
26197
Daniel Veillard42595322004-11-08 10:52:06 +000026198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026199}
26200
26201
26202static int
26203test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026205
26206#ifdef LIBXML_XINCLUDE_ENABLED
26207 int mem_base;
26208 int ret_val;
26209 xmlNodePtr tree; /* a node in an XML document */
26210 int n_tree;
26211 int flags; /* a set of xmlParserOption used for parsing XML includes */
26212 int n_flags;
26213
26214 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26215 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026217 tree = gen_xmlNodePtr(n_tree, 0);
26218 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026219
26220 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26221 desret_int(ret_val);
26222 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026223 des_xmlNodePtr(n_tree, tree, 0);
26224 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026225 xmlResetLastError();
26226 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026227 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026229 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026230 printf(" %d", n_tree);
26231 printf(" %d", n_flags);
26232 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026233 }
26234 }
26235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026236 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026237#endif
26238
Daniel Veillard42595322004-11-08 10:52:06 +000026239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026240}
26241
26242
26243static int
26244test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026246
Daniel Veillardce682bc2004-11-05 17:22:25 +000026247#ifdef LIBXML_XINCLUDE_ENABLED
26248 int mem_base;
26249 int ret_val;
26250 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26251 int n_ctxt;
26252 int flags; /* a set of xmlParserOption used for parsing XML includes */
26253 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026254
Daniel Veillardce682bc2004-11-05 17:22:25 +000026255 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26256 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26257 mem_base = xmlMemBlocks();
26258 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26259 flags = gen_int(n_flags, 1);
26260
26261 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26262 desret_int(ret_val);
26263 call_tests++;
26264 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26265 des_int(n_flags, flags, 1);
26266 xmlResetLastError();
26267 if (mem_base != xmlMemBlocks()) {
26268 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026270 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026271 printf(" %d", n_ctxt);
26272 printf(" %d", n_flags);
26273 printf("\n");
26274 }
26275 }
26276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026277 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026278#endif
26279
Daniel Veillard42595322004-11-08 10:52:06 +000026280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026281}
26282
26283static int
26284test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026286
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026287 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026288 test_ret += test_xmlXIncludeNewContext();
26289 test_ret += test_xmlXIncludeProcess();
26290 test_ret += test_xmlXIncludeProcessFlags();
26291 test_ret += test_xmlXIncludeProcessNode();
26292 test_ret += test_xmlXIncludeProcessTree();
26293 test_ret += test_xmlXIncludeProcessTreeFlags();
26294 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026295
Daniel Veillard42595322004-11-08 10:52:06 +000026296 if (test_ret != 0)
26297 printf("Module xinclude: %d errors\n", test_ret);
26298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026299}
26300
26301static int
26302test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026304
Daniel Veillard3d95c732004-11-06 22:25:14 +000026305#ifdef LIBXML_OUTPUT_ENABLED
26306 int mem_base;
26307 xmlOutputBufferPtr ret_val;
26308 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26309 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026310
Daniel Veillard3d95c732004-11-06 22:25:14 +000026311 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26312 mem_base = xmlMemBlocks();
26313 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26314
26315 ret_val = xmlAllocOutputBuffer(encoder);
26316 desret_xmlOutputBufferPtr(ret_val);
26317 call_tests++;
26318 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26319 xmlResetLastError();
26320 if (mem_base != xmlMemBlocks()) {
26321 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026323 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026324 printf(" %d", n_encoder);
26325 printf("\n");
26326 }
26327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026328 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026329#endif
26330
Daniel Veillard42595322004-11-08 10:52:06 +000026331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026332}
26333
26334
26335static int
26336test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026338
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026339 int mem_base;
26340 xmlParserInputBufferPtr ret_val;
26341 xmlCharEncoding enc; /* the charset encoding if known */
26342 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026343
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026344 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26345 mem_base = xmlMemBlocks();
26346 enc = gen_xmlCharEncoding(n_enc, 0);
26347
26348 ret_val = xmlAllocParserInputBuffer(enc);
26349 desret_xmlParserInputBufferPtr(ret_val);
26350 call_tests++;
26351 des_xmlCharEncoding(n_enc, enc, 0);
26352 xmlResetLastError();
26353 if (mem_base != xmlMemBlocks()) {
26354 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026356 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026357 printf(" %d", n_enc);
26358 printf("\n");
26359 }
26360 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026361 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026362
Daniel Veillard42595322004-11-08 10:52:06 +000026363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026364}
26365
26366
26367static int
26368test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026370
26371 int mem_base;
26372 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026373 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374 int n_path;
26375
26376 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26377 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026378 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026379
William M. Brackf13f77f2004-11-12 16:03:48 +000026380 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026381 desret_int(ret_val);
26382 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026383 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026384 xmlResetLastError();
26385 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026386 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026388 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026389 printf(" %d", n_path);
26390 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026391 }
26392 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026393 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026394
Daniel Veillard42595322004-11-08 10:52:06 +000026395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026396}
26397
26398
26399static int
26400test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026402
Daniel Veillard42595322004-11-08 10:52:06 +000026403 int mem_base;
26404 xmlParserInputPtr ret_val;
26405 xmlParserCtxtPtr ctxt; /* an XML parser context */
26406 int n_ctxt;
26407 xmlParserInputPtr ret; /* an XML parser input */
26408 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026409
Daniel Veillard42595322004-11-08 10:52:06 +000026410 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26411 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26412 mem_base = xmlMemBlocks();
26413 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26414 ret = gen_xmlParserInputPtr(n_ret, 1);
26415
26416 ret_val = xmlCheckHTTPInput(ctxt, ret);
26417 desret_xmlParserInputPtr(ret_val);
26418 call_tests++;
26419 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26420 des_xmlParserInputPtr(n_ret, ret, 1);
26421 xmlResetLastError();
26422 if (mem_base != xmlMemBlocks()) {
26423 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26424 xmlMemBlocks() - mem_base);
26425 test_ret++;
26426 printf(" %d", n_ctxt);
26427 printf(" %d", n_ret);
26428 printf("\n");
26429 }
26430 }
26431 }
Daniel Veillard42595322004-11-08 10:52:06 +000026432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026433
Daniel Veillard42595322004-11-08 10:52:06 +000026434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026435}
26436
26437
26438static int
26439test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026441
26442 int mem_base;
26443
26444 mem_base = xmlMemBlocks();
26445
26446 xmlCleanupInputCallbacks();
26447 call_tests++;
26448 xmlResetLastError();
26449 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026450 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026452 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026453 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026454 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026456
Daniel Veillard42595322004-11-08 10:52:06 +000026457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026458}
26459
26460
26461static int
26462test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026464
26465#ifdef LIBXML_OUTPUT_ENABLED
26466 int mem_base;
26467
26468 mem_base = xmlMemBlocks();
26469
26470 xmlCleanupOutputCallbacks();
26471 call_tests++;
26472 xmlResetLastError();
26473 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026474 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026477 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026479 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026480#endif
26481
Daniel Veillard42595322004-11-08 10:52:06 +000026482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026483}
26484
26485
26486static int
26487test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026489
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026490 int mem_base;
26491 int ret_val;
26492 void * context; /* the I/O context */
26493 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026494
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026495 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26496 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026497 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026498
26499 ret_val = xmlFileClose(context);
26500 desret_int(ret_val);
26501 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026502 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026503 xmlResetLastError();
26504 if (mem_base != xmlMemBlocks()) {
26505 printf("Leak of %d blocks found in xmlFileClose",
26506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026507 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026508 printf(" %d", n_context);
26509 printf("\n");
26510 }
26511 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026513
Daniel Veillard42595322004-11-08 10:52:06 +000026514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026515}
26516
26517
26518static int
26519test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026521
26522 int mem_base;
26523 int ret_val;
26524 const char * filename; /* the URI for matching */
26525 int n_filename;
26526
26527 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26528 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026529 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026530
26531 ret_val = xmlFileMatch(filename);
26532 desret_int(ret_val);
26533 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026534 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026535 xmlResetLastError();
26536 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026537 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026539 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026540 printf(" %d", n_filename);
26541 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026542 }
26543 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026545
Daniel Veillard42595322004-11-08 10:52:06 +000026546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026547}
26548
26549
26550static int
26551test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026553
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026554 int mem_base;
26555 void * ret_val;
26556 const char * filename; /* the URI for matching */
26557 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026558
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026559 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26560 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026561 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026562
26563 ret_val = xmlFileOpen(filename);
26564 desret_void_ptr(ret_val);
26565 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026566 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026567 xmlResetLastError();
26568 if (mem_base != xmlMemBlocks()) {
26569 printf("Leak of %d blocks found in xmlFileOpen",
26570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026571 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026572 printf(" %d", n_filename);
26573 printf("\n");
26574 }
26575 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026576 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026577
Daniel Veillard42595322004-11-08 10:52:06 +000026578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026579}
26580
26581
26582static int
26583test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026585
Daniel Veillardce682bc2004-11-05 17:22:25 +000026586 int mem_base;
26587 int ret_val;
26588 void * context; /* the I/O context */
26589 int n_context;
26590 char * buffer; /* where to drop data */
26591 int n_buffer;
26592 int len; /* number of bytes to write */
26593 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026594
Daniel Veillardce682bc2004-11-05 17:22:25 +000026595 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26596 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26597 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26598 mem_base = xmlMemBlocks();
26599 context = gen_void_ptr(n_context, 0);
26600 buffer = gen_char_ptr(n_buffer, 1);
26601 len = gen_int(n_len, 2);
26602
26603 ret_val = xmlFileRead(context, buffer, len);
26604 desret_int(ret_val);
26605 call_tests++;
26606 des_void_ptr(n_context, context, 0);
26607 des_char_ptr(n_buffer, buffer, 1);
26608 des_int(n_len, len, 2);
26609 xmlResetLastError();
26610 if (mem_base != xmlMemBlocks()) {
26611 printf("Leak of %d blocks found in xmlFileRead",
26612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026613 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026614 printf(" %d", n_context);
26615 printf(" %d", n_buffer);
26616 printf(" %d", n_len);
26617 printf("\n");
26618 }
26619 }
26620 }
26621 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026622 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026623
Daniel Veillard42595322004-11-08 10:52:06 +000026624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026625}
26626
26627
26628static int
26629test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026631
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026632#ifdef LIBXML_FTP_ENABLED
26633 int mem_base;
26634 int ret_val;
26635 void * context; /* the I/O context */
26636 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026637
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026638 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026640 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026641
26642 ret_val = xmlIOFTPClose(context);
26643 desret_int(ret_val);
26644 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026645 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026646 xmlResetLastError();
26647 if (mem_base != xmlMemBlocks()) {
26648 printf("Leak of %d blocks found in xmlIOFTPClose",
26649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026650 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026651 printf(" %d", n_context);
26652 printf("\n");
26653 }
26654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026655 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +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_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026665
26666#ifdef LIBXML_FTP_ENABLED
26667 int mem_base;
26668 int ret_val;
26669 const char * filename; /* the URI for matching */
26670 int n_filename;
26671
26672 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 Veillardd93f6252004-11-02 15:53:51 +000026675
26676 ret_val = xmlIOFTPMatch(filename);
26677 desret_int(ret_val);
26678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026679 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026680 xmlResetLastError();
26681 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026682 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026684 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026685 printf(" %d", n_filename);
26686 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026687 }
26688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026689 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026699
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026700#ifdef LIBXML_FTP_ENABLED
26701 int mem_base;
26702 void * ret_val;
26703 const char * filename; /* the URI for matching */
26704 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026705
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026706 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26707 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026708 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026709
26710 ret_val = xmlIOFTPOpen(filename);
26711 desret_void_ptr(ret_val);
26712 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026713 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026714 xmlResetLastError();
26715 if (mem_base != xmlMemBlocks()) {
26716 printf("Leak of %d blocks found in xmlIOFTPOpen",
26717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026718 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026719 printf(" %d", n_filename);
26720 printf("\n");
26721 }
26722 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026723 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026724#endif
26725
Daniel Veillard42595322004-11-08 10:52:06 +000026726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026727}
26728
26729
26730static int
26731test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026733
Daniel Veillardce682bc2004-11-05 17:22:25 +000026734#ifdef LIBXML_FTP_ENABLED
26735 int mem_base;
26736 int ret_val;
26737 void * context; /* the I/O context */
26738 int n_context;
26739 char * buffer; /* where to drop data */
26740 int n_buffer;
26741 int len; /* number of bytes to write */
26742 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026743
Daniel Veillardce682bc2004-11-05 17:22:25 +000026744 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26745 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26746 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26747 mem_base = xmlMemBlocks();
26748 context = gen_void_ptr(n_context, 0);
26749 buffer = gen_char_ptr(n_buffer, 1);
26750 len = gen_int(n_len, 2);
26751
26752 ret_val = xmlIOFTPRead(context, buffer, len);
26753 desret_int(ret_val);
26754 call_tests++;
26755 des_void_ptr(n_context, context, 0);
26756 des_char_ptr(n_buffer, buffer, 1);
26757 des_int(n_len, len, 2);
26758 xmlResetLastError();
26759 if (mem_base != xmlMemBlocks()) {
26760 printf("Leak of %d blocks found in xmlIOFTPRead",
26761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026762 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026763 printf(" %d", n_context);
26764 printf(" %d", n_buffer);
26765 printf(" %d", n_len);
26766 printf("\n");
26767 }
26768 }
26769 }
26770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026771 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026772#endif
26773
Daniel Veillard42595322004-11-08 10:52:06 +000026774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026775}
26776
26777
26778static int
26779test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026781
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026782#ifdef LIBXML_HTTP_ENABLED
26783 int mem_base;
26784 int ret_val;
26785 void * context; /* the I/O context */
26786 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026787
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026788 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26789 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026790 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026791
26792 ret_val = xmlIOHTTPClose(context);
26793 desret_int(ret_val);
26794 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026795 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026796 xmlResetLastError();
26797 if (mem_base != xmlMemBlocks()) {
26798 printf("Leak of %d blocks found in xmlIOHTTPClose",
26799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026800 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026801 printf(" %d", n_context);
26802 printf("\n");
26803 }
26804 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026805 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026806#endif
26807
Daniel Veillard42595322004-11-08 10:52:06 +000026808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026809}
26810
26811
26812static int
26813test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026815
26816#ifdef LIBXML_HTTP_ENABLED
26817 int mem_base;
26818 int ret_val;
26819 const char * filename; /* the URI for matching */
26820 int n_filename;
26821
26822 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26823 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026824 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026825
26826 ret_val = xmlIOHTTPMatch(filename);
26827 desret_int(ret_val);
26828 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026829 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026830 xmlResetLastError();
26831 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026832 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026834 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026835 printf(" %d", n_filename);
26836 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026837 }
26838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026839 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026840#endif
26841
Daniel Veillard42595322004-11-08 10:52:06 +000026842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026843}
26844
26845
26846static int
26847test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026849
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026850#ifdef LIBXML_HTTP_ENABLED
26851 int mem_base;
26852 void * ret_val;
26853 const char * filename; /* the URI for matching */
26854 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026855
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026856 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026858 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026859
26860 ret_val = xmlIOHTTPOpen(filename);
26861 desret_void_ptr(ret_val);
26862 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026863 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026864 xmlResetLastError();
26865 if (mem_base != xmlMemBlocks()) {
26866 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026868 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026869 printf(" %d", n_filename);
26870 printf("\n");
26871 }
26872 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026873 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026874#endif
26875
Daniel Veillard42595322004-11-08 10:52:06 +000026876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026877}
26878
26879
26880static int
26881test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026883
26884
26885 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026887}
26888
26889
26890static int
26891test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026893
Daniel Veillardce682bc2004-11-05 17:22:25 +000026894#ifdef LIBXML_HTTP_ENABLED
26895 int mem_base;
26896 int ret_val;
26897 void * context; /* the I/O context */
26898 int n_context;
26899 char * buffer; /* where to drop data */
26900 int n_buffer;
26901 int len; /* number of bytes to write */
26902 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026903
Daniel Veillardce682bc2004-11-05 17:22:25 +000026904 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26905 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26906 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26907 mem_base = xmlMemBlocks();
26908 context = gen_void_ptr(n_context, 0);
26909 buffer = gen_char_ptr(n_buffer, 1);
26910 len = gen_int(n_len, 2);
26911
26912 ret_val = xmlIOHTTPRead(context, buffer, len);
26913 desret_int(ret_val);
26914 call_tests++;
26915 des_void_ptr(n_context, context, 0);
26916 des_char_ptr(n_buffer, buffer, 1);
26917 des_int(n_len, len, 2);
26918 xmlResetLastError();
26919 if (mem_base != xmlMemBlocks()) {
26920 printf("Leak of %d blocks found in xmlIOHTTPRead",
26921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026922 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026923 printf(" %d", n_context);
26924 printf(" %d", n_buffer);
26925 printf(" %d", n_len);
26926 printf("\n");
26927 }
26928 }
26929 }
26930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026931 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026932#endif
26933
Daniel Veillard42595322004-11-08 10:52:06 +000026934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026935}
26936
26937
26938static int
26939test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026941
Daniel Veillard42595322004-11-08 10:52:06 +000026942 int mem_base;
26943 xmlParserInputPtr ret_val;
26944 const char * URL; /* the URL for the entity to load */
26945 int n_URL;
26946 char * ID; /* the System ID for the entity to load */
26947 int n_ID;
26948 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26949 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026950
Daniel Veillard42595322004-11-08 10:52:06 +000026951 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26952 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26953 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26954 mem_base = xmlMemBlocks();
26955 URL = gen_filepath(n_URL, 0);
26956 ID = gen_const_char_ptr(n_ID, 1);
26957 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26958
William M. Brackf13f77f2004-11-12 16:03:48 +000026959 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026960 desret_xmlParserInputPtr(ret_val);
26961 call_tests++;
26962 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026963 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026964 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26965 xmlResetLastError();
26966 if (mem_base != xmlMemBlocks()) {
26967 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26968 xmlMemBlocks() - mem_base);
26969 test_ret++;
26970 printf(" %d", n_URL);
26971 printf(" %d", n_ID);
26972 printf(" %d", n_ctxt);
26973 printf("\n");
26974 }
26975 }
26976 }
26977 }
Daniel Veillard42595322004-11-08 10:52:06 +000026978 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026979
Daniel Veillard42595322004-11-08 10:52:06 +000026980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026981}
26982
26983
26984static int
26985test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026987
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026988 int mem_base;
26989 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026990 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026991 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026992
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026993 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26994 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026995 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026996
William M. Brackf13f77f2004-11-12 16:03:48 +000026997 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026998 desret_xmlChar_ptr(ret_val);
26999 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027000 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027001 xmlResetLastError();
27002 if (mem_base != xmlMemBlocks()) {
27003 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
27004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027005 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027006 printf(" %d", n_path);
27007 printf("\n");
27008 }
27009 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027011
Daniel Veillard42595322004-11-08 10:52:06 +000027012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027013}
27014
27015
27016static int
27017test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027019
Daniel Veillard3d95c732004-11-06 22:25:14 +000027020#ifdef LIBXML_OUTPUT_ENABLED
27021 int mem_base;
27022 xmlOutputBufferPtr ret_val;
27023 int fd; /* a file descriptor number */
27024 int n_fd;
27025 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27026 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027027
Daniel Veillard3d95c732004-11-06 22:25:14 +000027028 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27029 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27030 mem_base = xmlMemBlocks();
27031 fd = gen_int(n_fd, 0);
27032 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27033
27034 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27035 desret_xmlOutputBufferPtr(ret_val);
27036 call_tests++;
27037 des_int(n_fd, fd, 0);
27038 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27039 xmlResetLastError();
27040 if (mem_base != xmlMemBlocks()) {
27041 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027043 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027044 printf(" %d", n_fd);
27045 printf(" %d", n_encoder);
27046 printf("\n");
27047 }
27048 }
27049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027050 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027051#endif
27052
Daniel Veillard42595322004-11-08 10:52:06 +000027053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027054}
27055
27056
27057static int
27058test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027060
Daniel Veillard3d95c732004-11-06 22:25:14 +000027061#ifdef LIBXML_OUTPUT_ENABLED
27062 int mem_base;
27063 xmlOutputBufferPtr ret_val;
27064 FILE * file; /* a FILE* */
27065 int n_file;
27066 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27067 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027068
Daniel Veillard3d95c732004-11-06 22:25:14 +000027069 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27070 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27071 mem_base = xmlMemBlocks();
27072 file = gen_FILE_ptr(n_file, 0);
27073 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27074
27075 ret_val = xmlOutputBufferCreateFile(file, encoder);
27076 desret_xmlOutputBufferPtr(ret_val);
27077 call_tests++;
27078 des_FILE_ptr(n_file, file, 0);
27079 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27080 xmlResetLastError();
27081 if (mem_base != xmlMemBlocks()) {
27082 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027084 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027085 printf(" %d", n_file);
27086 printf(" %d", n_encoder);
27087 printf("\n");
27088 }
27089 }
27090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027091 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027092#endif
27093
Daniel Veillard42595322004-11-08 10:52:06 +000027094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027095}
27096
27097
27098static int
27099test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027101
Daniel Veillard3d95c732004-11-06 22:25:14 +000027102#ifdef LIBXML_OUTPUT_ENABLED
27103 int mem_base;
27104 xmlOutputBufferPtr ret_val;
27105 const char * URI; /* a C string containing the URI or filename */
27106 int n_URI;
27107 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27108 int n_encoder;
27109 int compression; /* the compression ration (0 none, 9 max). */
27110 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027111
Daniel Veillard42595322004-11-08 10:52:06 +000027112 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027113 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27114 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27115 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027116 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027117 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27118 compression = gen_int(n_compression, 2);
27119
27120 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27121 desret_xmlOutputBufferPtr(ret_val);
27122 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027123 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027124 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27125 des_int(n_compression, compression, 2);
27126 xmlResetLastError();
27127 if (mem_base != xmlMemBlocks()) {
27128 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027130 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027131 printf(" %d", n_URI);
27132 printf(" %d", n_encoder);
27133 printf(" %d", n_compression);
27134 printf("\n");
27135 }
27136 }
27137 }
27138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027139 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027140#endif
27141
Daniel Veillard42595322004-11-08 10:52:06 +000027142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027143}
27144
27145
27146static int
27147test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027149
Daniel Veillard3d97e662004-11-04 10:49:00 +000027150#ifdef LIBXML_OUTPUT_ENABLED
27151 int mem_base;
27152 int ret_val;
27153 xmlOutputBufferPtr out; /* a buffered output */
27154 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027155
Daniel Veillard3d97e662004-11-04 10:49:00 +000027156 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27157 mem_base = xmlMemBlocks();
27158 out = gen_xmlOutputBufferPtr(n_out, 0);
27159
27160 ret_val = xmlOutputBufferFlush(out);
27161 desret_int(ret_val);
27162 call_tests++;
27163 des_xmlOutputBufferPtr(n_out, out, 0);
27164 xmlResetLastError();
27165 if (mem_base != xmlMemBlocks()) {
27166 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027168 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027169 printf(" %d", n_out);
27170 printf("\n");
27171 }
27172 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027173 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027174#endif
27175
Daniel Veillard42595322004-11-08 10:52:06 +000027176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027177}
27178
27179
27180static int
27181test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027183
Daniel Veillard3d97e662004-11-04 10:49:00 +000027184#ifdef LIBXML_OUTPUT_ENABLED
27185 int mem_base;
27186 int ret_val;
27187 xmlOutputBufferPtr out; /* a buffered parser output */
27188 int n_out;
27189 int len; /* the size in bytes of the array. */
27190 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027191 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027192 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027193
Daniel Veillard3d97e662004-11-04 10:49:00 +000027194 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27195 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27196 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27197 mem_base = xmlMemBlocks();
27198 out = gen_xmlOutputBufferPtr(n_out, 0);
27199 len = gen_int(n_len, 1);
27200 buf = gen_const_char_ptr(n_buf, 2);
27201
William M. Brackf13f77f2004-11-12 16:03:48 +000027202 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027203 desret_int(ret_val);
27204 call_tests++;
27205 des_xmlOutputBufferPtr(n_out, out, 0);
27206 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027207 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027208 xmlResetLastError();
27209 if (mem_base != xmlMemBlocks()) {
27210 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027212 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027213 printf(" %d", n_out);
27214 printf(" %d", n_len);
27215 printf(" %d", n_buf);
27216 printf("\n");
27217 }
27218 }
27219 }
27220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027221 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027222#endif
27223
Daniel Veillard42595322004-11-08 10:52:06 +000027224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027225}
27226
27227
27228static int
27229test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027231
27232
27233 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027235}
27236
27237
27238static int
27239test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027241
Daniel Veillard3d97e662004-11-04 10:49:00 +000027242#ifdef LIBXML_OUTPUT_ENABLED
27243 int mem_base;
27244 int ret_val;
27245 xmlOutputBufferPtr out; /* a buffered parser output */
27246 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027247 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027248 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027249
Daniel Veillard3d97e662004-11-04 10:49:00 +000027250 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27251 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27252 mem_base = xmlMemBlocks();
27253 out = gen_xmlOutputBufferPtr(n_out, 0);
27254 str = gen_const_char_ptr(n_str, 1);
27255
William M. Brackf13f77f2004-11-12 16:03:48 +000027256 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027257 desret_int(ret_val);
27258 call_tests++;
27259 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027260 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027261 xmlResetLastError();
27262 if (mem_base != xmlMemBlocks()) {
27263 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027265 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027266 printf(" %d", n_out);
27267 printf(" %d", n_str);
27268 printf("\n");
27269 }
27270 }
27271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027272 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027273#endif
27274
Daniel Veillard42595322004-11-08 10:52:06 +000027275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027276}
27277
27278
27279static int
27280test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027282
27283
27284 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027286}
27287
27288
27289static int
27290test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027292
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027293 int mem_base;
27294 xmlParserInputBufferPtr ret_val;
27295 int fd; /* a file descriptor number */
27296 int n_fd;
27297 xmlCharEncoding enc; /* the charset encoding if known */
27298 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027299
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027300 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27301 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27302 mem_base = xmlMemBlocks();
27303 fd = gen_int(n_fd, 0);
27304 enc = gen_xmlCharEncoding(n_enc, 1);
27305 if (fd >= 0) fd = -1;
27306
27307 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27308 desret_xmlParserInputBufferPtr(ret_val);
27309 call_tests++;
27310 des_int(n_fd, fd, 0);
27311 des_xmlCharEncoding(n_enc, enc, 1);
27312 xmlResetLastError();
27313 if (mem_base != xmlMemBlocks()) {
27314 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027316 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027317 printf(" %d", n_fd);
27318 printf(" %d", n_enc);
27319 printf("\n");
27320 }
27321 }
27322 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027323 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027324
Daniel Veillard42595322004-11-08 10:52:06 +000027325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027326}
27327
27328
27329static int
27330test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027332
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027333 int mem_base;
27334 xmlParserInputBufferPtr ret_val;
27335 FILE * file; /* a FILE* */
27336 int n_file;
27337 xmlCharEncoding enc; /* the charset encoding if known */
27338 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027339
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027340 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27341 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27342 mem_base = xmlMemBlocks();
27343 file = gen_FILE_ptr(n_file, 0);
27344 enc = gen_xmlCharEncoding(n_enc, 1);
27345
27346 ret_val = xmlParserInputBufferCreateFile(file, enc);
27347 desret_xmlParserInputBufferPtr(ret_val);
27348 call_tests++;
27349 des_FILE_ptr(n_file, file, 0);
27350 des_xmlCharEncoding(n_enc, enc, 1);
27351 xmlResetLastError();
27352 if (mem_base != xmlMemBlocks()) {
27353 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027355 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027356 printf(" %d", n_file);
27357 printf(" %d", n_enc);
27358 printf("\n");
27359 }
27360 }
27361 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027362 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027363
Daniel Veillard42595322004-11-08 10:52:06 +000027364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027365}
27366
27367
27368static int
27369test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027371
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027372 int mem_base;
27373 xmlParserInputBufferPtr ret_val;
27374 const char * URI; /* a C string containing the URI or filename */
27375 int n_URI;
27376 xmlCharEncoding enc; /* the charset encoding if known */
27377 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027378
Daniel Veillard42595322004-11-08 10:52:06 +000027379 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027380 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27381 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027382 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027383 enc = gen_xmlCharEncoding(n_enc, 1);
27384
27385 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27386 desret_xmlParserInputBufferPtr(ret_val);
27387 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027388 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027389 des_xmlCharEncoding(n_enc, enc, 1);
27390 xmlResetLastError();
27391 if (mem_base != xmlMemBlocks()) {
27392 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027394 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027395 printf(" %d", n_URI);
27396 printf(" %d", n_enc);
27397 printf("\n");
27398 }
27399 }
27400 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027401 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027402
Daniel Veillard42595322004-11-08 10:52:06 +000027403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027404}
27405
27406
27407static int
27408test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027410
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027411 int mem_base;
27412 xmlParserInputBufferPtr ret_val;
27413 char * mem; /* the memory input */
27414 int n_mem;
27415 int size; /* the length of the memory block */
27416 int n_size;
27417 xmlCharEncoding enc; /* the charset encoding if known */
27418 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027419
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027420 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27421 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27422 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27423 mem_base = xmlMemBlocks();
27424 mem = gen_const_char_ptr(n_mem, 0);
27425 size = gen_int(n_size, 1);
27426 enc = gen_xmlCharEncoding(n_enc, 2);
27427
William M. Brackf13f77f2004-11-12 16:03:48 +000027428 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027429 desret_xmlParserInputBufferPtr(ret_val);
27430 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027431 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027432 des_int(n_size, size, 1);
27433 des_xmlCharEncoding(n_enc, enc, 2);
27434 xmlResetLastError();
27435 if (mem_base != xmlMemBlocks()) {
27436 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027438 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027439 printf(" %d", n_mem);
27440 printf(" %d", n_size);
27441 printf(" %d", n_enc);
27442 printf("\n");
27443 }
27444 }
27445 }
27446 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027448
Daniel Veillard42595322004-11-08 10:52:06 +000027449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027450}
27451
27452
27453static int
27454test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027456
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027457 int mem_base;
27458 xmlParserInputBufferPtr ret_val;
27459 char * mem; /* the memory input */
27460 int n_mem;
27461 int size; /* the length of the memory block */
27462 int n_size;
27463 xmlCharEncoding enc; /* the charset encoding if known */
27464 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027465
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027466 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27467 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27468 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27469 mem_base = xmlMemBlocks();
27470 mem = gen_const_char_ptr(n_mem, 0);
27471 size = gen_int(n_size, 1);
27472 enc = gen_xmlCharEncoding(n_enc, 2);
27473
William M. Brackf13f77f2004-11-12 16:03:48 +000027474 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027475 desret_xmlParserInputBufferPtr(ret_val);
27476 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027477 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027478 des_int(n_size, size, 1);
27479 des_xmlCharEncoding(n_enc, enc, 2);
27480 xmlResetLastError();
27481 if (mem_base != xmlMemBlocks()) {
27482 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027484 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027485 printf(" %d", n_mem);
27486 printf(" %d", n_size);
27487 printf(" %d", n_enc);
27488 printf("\n");
27489 }
27490 }
27491 }
27492 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027493 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027494
Daniel Veillard42595322004-11-08 10:52:06 +000027495 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027496}
27497
27498
27499static int
27500test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027501 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027502
Daniel Veillard34099b42004-11-04 17:34:35 +000027503 int mem_base;
27504 int ret_val;
27505 xmlParserInputBufferPtr in; /* a buffered parser input */
27506 int n_in;
27507 int len; /* indicative value of the amount of chars to read */
27508 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027509
Daniel Veillard34099b42004-11-04 17:34:35 +000027510 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27511 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27512 mem_base = xmlMemBlocks();
27513 in = gen_xmlParserInputBufferPtr(n_in, 0);
27514 len = gen_int(n_len, 1);
27515
27516 ret_val = xmlParserInputBufferGrow(in, len);
27517 desret_int(ret_val);
27518 call_tests++;
27519 des_xmlParserInputBufferPtr(n_in, in, 0);
27520 des_int(n_len, len, 1);
27521 xmlResetLastError();
27522 if (mem_base != xmlMemBlocks()) {
27523 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027525 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027526 printf(" %d", n_in);
27527 printf(" %d", n_len);
27528 printf("\n");
27529 }
27530 }
27531 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027532 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027533
Daniel Veillard42595322004-11-08 10:52:06 +000027534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027535}
27536
27537
27538static int
27539test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027541
Daniel Veillard34099b42004-11-04 17:34:35 +000027542 int mem_base;
27543 int ret_val;
27544 xmlParserInputBufferPtr in; /* a buffered parser input */
27545 int n_in;
27546 int len; /* the size in bytes of the array. */
27547 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027548 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027549 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027550
Daniel Veillard34099b42004-11-04 17:34:35 +000027551 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27552 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27553 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27554 mem_base = xmlMemBlocks();
27555 in = gen_xmlParserInputBufferPtr(n_in, 0);
27556 len = gen_int(n_len, 1);
27557 buf = gen_const_char_ptr(n_buf, 2);
27558
William M. Brackf13f77f2004-11-12 16:03:48 +000027559 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027560 desret_int(ret_val);
27561 call_tests++;
27562 des_xmlParserInputBufferPtr(n_in, in, 0);
27563 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027564 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027565 xmlResetLastError();
27566 if (mem_base != xmlMemBlocks()) {
27567 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027569 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027570 printf(" %d", n_in);
27571 printf(" %d", n_len);
27572 printf(" %d", n_buf);
27573 printf("\n");
27574 }
27575 }
27576 }
27577 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027578 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027579
Daniel Veillard42595322004-11-08 10:52:06 +000027580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027581}
27582
27583
27584static int
27585test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027587
Daniel Veillard34099b42004-11-04 17:34:35 +000027588 int mem_base;
27589 int ret_val;
27590 xmlParserInputBufferPtr in; /* a buffered parser input */
27591 int n_in;
27592 int len; /* indicative value of the amount of chars to read */
27593 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027594
Daniel Veillard34099b42004-11-04 17:34:35 +000027595 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27596 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27597 mem_base = xmlMemBlocks();
27598 in = gen_xmlParserInputBufferPtr(n_in, 0);
27599 len = gen_int(n_len, 1);
27600
27601 ret_val = xmlParserInputBufferRead(in, len);
27602 desret_int(ret_val);
27603 call_tests++;
27604 des_xmlParserInputBufferPtr(n_in, in, 0);
27605 des_int(n_len, len, 1);
27606 xmlResetLastError();
27607 if (mem_base != xmlMemBlocks()) {
27608 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027610 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027611 printf(" %d", n_in);
27612 printf(" %d", n_len);
27613 printf("\n");
27614 }
27615 }
27616 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027617 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027618
Daniel Veillard42595322004-11-08 10:52:06 +000027619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027620}
27621
27622
27623static int
27624test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027626
27627 int mem_base;
27628 int ret_val;
27629
27630 mem_base = xmlMemBlocks();
27631
27632 ret_val = xmlPopInputCallbacks();
27633 desret_int(ret_val);
27634 call_tests++;
27635 xmlResetLastError();
27636 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027637 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027639 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027640 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027641 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027642 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027643
Daniel Veillard42595322004-11-08 10:52:06 +000027644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027645}
27646
27647
27648static int
27649test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027651
27652 int mem_base;
27653
27654 mem_base = xmlMemBlocks();
27655
27656 xmlRegisterDefaultInputCallbacks();
27657 call_tests++;
27658 xmlResetLastError();
27659 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027660 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027663 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027664 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027666
Daniel Veillard42595322004-11-08 10:52:06 +000027667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027668}
27669
27670
27671static int
27672test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027674
27675#ifdef LIBXML_OUTPUT_ENABLED
27676 int mem_base;
27677
27678 mem_base = xmlMemBlocks();
27679
27680 xmlRegisterDefaultOutputCallbacks();
27681 call_tests++;
27682 xmlResetLastError();
27683 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027684 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027686 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027687 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027689 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027690#endif
27691
Daniel Veillard42595322004-11-08 10:52:06 +000027692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027693}
27694
27695
27696static int
27697test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027699
27700#ifdef LIBXML_HTTP_ENABLED
27701 int mem_base;
27702
27703 mem_base = xmlMemBlocks();
27704
27705 xmlRegisterHTTPPostCallbacks();
27706 call_tests++;
27707 xmlResetLastError();
27708 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027709 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027711 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027712 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027714 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027715#endif
27716
Daniel Veillard42595322004-11-08 10:52:06 +000027717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027718}
27719
27720static int
27721test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027723
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027724 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027725 test_ret += test_xmlAllocOutputBuffer();
27726 test_ret += test_xmlAllocParserInputBuffer();
27727 test_ret += test_xmlCheckFilename();
27728 test_ret += test_xmlCheckHTTPInput();
27729 test_ret += test_xmlCleanupInputCallbacks();
27730 test_ret += test_xmlCleanupOutputCallbacks();
27731 test_ret += test_xmlFileClose();
27732 test_ret += test_xmlFileMatch();
27733 test_ret += test_xmlFileOpen();
27734 test_ret += test_xmlFileRead();
27735 test_ret += test_xmlIOFTPClose();
27736 test_ret += test_xmlIOFTPMatch();
27737 test_ret += test_xmlIOFTPOpen();
27738 test_ret += test_xmlIOFTPRead();
27739 test_ret += test_xmlIOHTTPClose();
27740 test_ret += test_xmlIOHTTPMatch();
27741 test_ret += test_xmlIOHTTPOpen();
27742 test_ret += test_xmlIOHTTPOpenW();
27743 test_ret += test_xmlIOHTTPRead();
27744 test_ret += test_xmlNoNetExternalEntityLoader();
27745 test_ret += test_xmlNormalizeWindowsPath();
27746 test_ret += test_xmlOutputBufferCreateFd();
27747 test_ret += test_xmlOutputBufferCreateFile();
27748 test_ret += test_xmlOutputBufferCreateFilename();
27749 test_ret += test_xmlOutputBufferFlush();
27750 test_ret += test_xmlOutputBufferWrite();
27751 test_ret += test_xmlOutputBufferWriteEscape();
27752 test_ret += test_xmlOutputBufferWriteString();
27753 test_ret += test_xmlParserGetDirectory();
27754 test_ret += test_xmlParserInputBufferCreateFd();
27755 test_ret += test_xmlParserInputBufferCreateFile();
27756 test_ret += test_xmlParserInputBufferCreateFilename();
27757 test_ret += test_xmlParserInputBufferCreateMem();
27758 test_ret += test_xmlParserInputBufferCreateStatic();
27759 test_ret += test_xmlParserInputBufferGrow();
27760 test_ret += test_xmlParserInputBufferPush();
27761 test_ret += test_xmlParserInputBufferRead();
27762 test_ret += test_xmlPopInputCallbacks();
27763 test_ret += test_xmlRegisterDefaultInputCallbacks();
27764 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27765 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027766
Daniel Veillard42595322004-11-08 10:52:06 +000027767 if (test_ret != 0)
27768 printf("Module xmlIO: %d errors\n", test_ret);
27769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027770}
Daniel Veillarda521d282004-11-09 14:59:59 +000027771#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027772
Daniel Veillarda82b1822004-11-08 16:24:57 +000027773#define gen_nb_xmlAutomataPtr 1
27774static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27775 return(NULL);
27776}
27777static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27778}
Daniel Veillarda521d282004-11-09 14:59:59 +000027779#endif
27780
Daniel Veillarda82b1822004-11-08 16:24:57 +000027781
27782static int
27783test_xmlAutomataCompile(void) {
27784 int test_ret = 0;
27785
27786
27787 /* missing type support */
27788 return(test_ret);
27789}
27790
27791
27792static int
27793test_xmlAutomataGetInitState(void) {
27794 int test_ret = 0;
27795
27796
27797 /* missing type support */
27798 return(test_ret);
27799}
27800
27801
27802static int
27803test_xmlAutomataIsDeterminist(void) {
27804 int test_ret = 0;
27805
27806#ifdef LIBXML_AUTOMATA_ENABLED
27807 int mem_base;
27808 int ret_val;
27809 xmlAutomataPtr am; /* an automata */
27810 int n_am;
27811
27812 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27813 mem_base = xmlMemBlocks();
27814 am = gen_xmlAutomataPtr(n_am, 0);
27815
27816 ret_val = xmlAutomataIsDeterminist(am);
27817 desret_int(ret_val);
27818 call_tests++;
27819 des_xmlAutomataPtr(n_am, am, 0);
27820 xmlResetLastError();
27821 if (mem_base != xmlMemBlocks()) {
27822 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27823 xmlMemBlocks() - mem_base);
27824 test_ret++;
27825 printf(" %d", n_am);
27826 printf("\n");
27827 }
27828 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027829 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027830#endif
27831
Daniel Veillarda82b1822004-11-08 16:24:57 +000027832 return(test_ret);
27833}
27834
Daniel Veillarda521d282004-11-09 14:59:59 +000027835#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027836
27837#define gen_nb_xmlAutomataStatePtr 1
27838static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27839 return(NULL);
27840}
27841static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27842}
Daniel Veillarda521d282004-11-09 14:59:59 +000027843#endif
27844
Daniel Veillarda82b1822004-11-08 16:24:57 +000027845
27846static int
27847test_xmlAutomataNewAllTrans(void) {
27848 int test_ret = 0;
27849
27850
27851 /* missing type support */
27852 return(test_ret);
27853}
27854
27855
27856static int
27857test_xmlAutomataNewCountTrans(void) {
27858 int test_ret = 0;
27859
27860
27861 /* missing type support */
27862 return(test_ret);
27863}
27864
27865
27866static int
27867test_xmlAutomataNewCountTrans2(void) {
27868 int test_ret = 0;
27869
27870
27871 /* missing type support */
27872 return(test_ret);
27873}
27874
27875
27876static int
27877test_xmlAutomataNewCountedTrans(void) {
27878 int test_ret = 0;
27879
27880
27881 /* missing type support */
27882 return(test_ret);
27883}
27884
27885
27886static int
27887test_xmlAutomataNewCounter(void) {
27888 int test_ret = 0;
27889
27890#ifdef LIBXML_AUTOMATA_ENABLED
27891 int mem_base;
27892 int ret_val;
27893 xmlAutomataPtr am; /* an automata */
27894 int n_am;
27895 int min; /* the minimal value on the counter */
27896 int n_min;
27897 int max; /* the maximal value on the counter */
27898 int n_max;
27899
27900 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27901 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27902 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27903 mem_base = xmlMemBlocks();
27904 am = gen_xmlAutomataPtr(n_am, 0);
27905 min = gen_int(n_min, 1);
27906 max = gen_int(n_max, 2);
27907
27908 ret_val = xmlAutomataNewCounter(am, min, max);
27909 desret_int(ret_val);
27910 call_tests++;
27911 des_xmlAutomataPtr(n_am, am, 0);
27912 des_int(n_min, min, 1);
27913 des_int(n_max, max, 2);
27914 xmlResetLastError();
27915 if (mem_base != xmlMemBlocks()) {
27916 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27917 xmlMemBlocks() - mem_base);
27918 test_ret++;
27919 printf(" %d", n_am);
27920 printf(" %d", n_min);
27921 printf(" %d", n_max);
27922 printf("\n");
27923 }
27924 }
27925 }
27926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027927 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027928#endif
27929
Daniel Veillarda82b1822004-11-08 16:24:57 +000027930 return(test_ret);
27931}
27932
27933
27934static int
27935test_xmlAutomataNewCounterTrans(void) {
27936 int test_ret = 0;
27937
27938
27939 /* missing type support */
27940 return(test_ret);
27941}
27942
27943
27944static int
27945test_xmlAutomataNewEpsilon(void) {
27946 int test_ret = 0;
27947
27948
27949 /* missing type support */
27950 return(test_ret);
27951}
27952
27953
27954static int
27955test_xmlAutomataNewOnceTrans(void) {
27956 int test_ret = 0;
27957
27958
27959 /* missing type support */
27960 return(test_ret);
27961}
27962
27963
27964static int
27965test_xmlAutomataNewOnceTrans2(void) {
27966 int test_ret = 0;
27967
27968
27969 /* missing type support */
27970 return(test_ret);
27971}
27972
27973
27974static int
27975test_xmlAutomataNewState(void) {
27976 int test_ret = 0;
27977
27978
27979 /* missing type support */
27980 return(test_ret);
27981}
27982
27983
27984static int
27985test_xmlAutomataNewTransition(void) {
27986 int test_ret = 0;
27987
27988
27989 /* missing type support */
27990 return(test_ret);
27991}
27992
27993
27994static int
27995test_xmlAutomataNewTransition2(void) {
27996 int test_ret = 0;
27997
27998
27999 /* missing type support */
28000 return(test_ret);
28001}
28002
28003
28004static int
28005test_xmlAutomataSetFinalState(void) {
28006 int test_ret = 0;
28007
28008#ifdef LIBXML_AUTOMATA_ENABLED
28009 int mem_base;
28010 int ret_val;
28011 xmlAutomataPtr am; /* an automata */
28012 int n_am;
28013 xmlAutomataStatePtr state; /* a state in this automata */
28014 int n_state;
28015
28016 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28017 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28018 mem_base = xmlMemBlocks();
28019 am = gen_xmlAutomataPtr(n_am, 0);
28020 state = gen_xmlAutomataStatePtr(n_state, 1);
28021
28022 ret_val = xmlAutomataSetFinalState(am, state);
28023 desret_int(ret_val);
28024 call_tests++;
28025 des_xmlAutomataPtr(n_am, am, 0);
28026 des_xmlAutomataStatePtr(n_state, state, 1);
28027 xmlResetLastError();
28028 if (mem_base != xmlMemBlocks()) {
28029 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28030 xmlMemBlocks() - mem_base);
28031 test_ret++;
28032 printf(" %d", n_am);
28033 printf(" %d", n_state);
28034 printf("\n");
28035 }
28036 }
28037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028038 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028039#endif
28040
Daniel Veillarda82b1822004-11-08 16:24:57 +000028041 return(test_ret);
28042}
28043
28044
28045static int
28046test_xmlNewAutomata(void) {
28047 int test_ret = 0;
28048
28049
28050 /* missing type support */
28051 return(test_ret);
28052}
28053
28054static int
28055test_xmlautomata(void) {
28056 int test_ret = 0;
28057
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028058 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028059 test_ret += test_xmlAutomataCompile();
28060 test_ret += test_xmlAutomataGetInitState();
28061 test_ret += test_xmlAutomataIsDeterminist();
28062 test_ret += test_xmlAutomataNewAllTrans();
28063 test_ret += test_xmlAutomataNewCountTrans();
28064 test_ret += test_xmlAutomataNewCountTrans2();
28065 test_ret += test_xmlAutomataNewCountedTrans();
28066 test_ret += test_xmlAutomataNewCounter();
28067 test_ret += test_xmlAutomataNewCounterTrans();
28068 test_ret += test_xmlAutomataNewEpsilon();
28069 test_ret += test_xmlAutomataNewOnceTrans();
28070 test_ret += test_xmlAutomataNewOnceTrans2();
28071 test_ret += test_xmlAutomataNewState();
28072 test_ret += test_xmlAutomataNewTransition();
28073 test_ret += test_xmlAutomataNewTransition2();
28074 test_ret += test_xmlAutomataSetFinalState();
28075 test_ret += test_xmlNewAutomata();
28076
28077 if (test_ret != 0)
28078 printf("Module xmlautomata: %d errors\n", test_ret);
28079 return(test_ret);
28080}
28081
Daniel Veillardce682bc2004-11-05 17:22:25 +000028082#define gen_nb_xmlGenericErrorFunc_ptr 1
28083static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28084 return(NULL);
28085}
28086static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28087}
28088
Daniel Veillardd93f6252004-11-02 15:53:51 +000028089static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028090test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028092
Daniel Veillardce682bc2004-11-05 17:22:25 +000028093 int mem_base;
28094 xmlGenericErrorFunc * handler; /* the handler */
28095 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028096
Daniel Veillardce682bc2004-11-05 17:22:25 +000028097 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28098 mem_base = xmlMemBlocks();
28099 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28100
28101 initGenericErrorDefaultFunc(handler);
28102 call_tests++;
28103 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28104 xmlResetLastError();
28105 if (mem_base != xmlMemBlocks()) {
28106 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028108 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028109 printf(" %d", n_handler);
28110 printf("\n");
28111 }
28112 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028113 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028114
Daniel Veillard42595322004-11-08 10:52:06 +000028115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028116}
28117
28118
Daniel Veillardce682bc2004-11-05 17:22:25 +000028119#define gen_nb_xmlErrorPtr 1
28120static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28121 return(NULL);
28122}
28123static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28124}
28125
Daniel Veillardd93f6252004-11-02 15:53:51 +000028126static int
28127test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028129
Daniel Veillardce682bc2004-11-05 17:22:25 +000028130 int mem_base;
28131 int ret_val;
28132 xmlErrorPtr from; /* a source error */
28133 int n_from;
28134 xmlErrorPtr to; /* a target error */
28135 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028136
Daniel Veillardce682bc2004-11-05 17:22:25 +000028137 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28138 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28139 mem_base = xmlMemBlocks();
28140 from = gen_xmlErrorPtr(n_from, 0);
28141 to = gen_xmlErrorPtr(n_to, 1);
28142
28143 ret_val = xmlCopyError(from, to);
28144 desret_int(ret_val);
28145 call_tests++;
28146 des_xmlErrorPtr(n_from, from, 0);
28147 des_xmlErrorPtr(n_to, to, 1);
28148 xmlResetLastError();
28149 if (mem_base != xmlMemBlocks()) {
28150 printf("Leak of %d blocks found in xmlCopyError",
28151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028152 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028153 printf(" %d", n_from);
28154 printf(" %d", n_to);
28155 printf("\n");
28156 }
28157 }
28158 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028159 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028160
Daniel Veillard42595322004-11-08 10:52:06 +000028161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028162}
28163
28164
28165static int
28166test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028168
28169
28170 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028172}
28173
28174
28175static int
28176test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028178
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028179 int mem_base;
28180 void * ctx; /* an XML parser context */
28181 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028182
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028183 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28184 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028185 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028186
28187 xmlCtxtResetLastError(ctx);
28188 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028189 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028190 xmlResetLastError();
28191 if (mem_base != xmlMemBlocks()) {
28192 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028194 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028195 printf(" %d", n_ctx);
28196 printf("\n");
28197 }
28198 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028199 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028200
Daniel Veillard42595322004-11-08 10:52:06 +000028201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028202}
28203
28204
28205static int
28206test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028208
28209
28210 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028212}
28213
28214
28215static int
28216test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028218
28219
28220 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028222}
28223
28224
28225static int
28226test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028228
Daniel Veillardce682bc2004-11-05 17:22:25 +000028229 int mem_base;
28230 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28231 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028232
Daniel Veillardce682bc2004-11-05 17:22:25 +000028233 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28234 mem_base = xmlMemBlocks();
28235 input = gen_xmlParserInputPtr(n_input, 0);
28236
28237 xmlParserPrintFileContext(input);
28238 call_tests++;
28239 des_xmlParserInputPtr(n_input, input, 0);
28240 xmlResetLastError();
28241 if (mem_base != xmlMemBlocks()) {
28242 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028244 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028245 printf(" %d", n_input);
28246 printf("\n");
28247 }
28248 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028249 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028250
Daniel Veillard42595322004-11-08 10:52:06 +000028251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028252}
28253
28254
28255static int
28256test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028258
Daniel Veillardce682bc2004-11-05 17:22:25 +000028259 int mem_base;
28260 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28261 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028262
Daniel Veillardce682bc2004-11-05 17:22:25 +000028263 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28264 mem_base = xmlMemBlocks();
28265 input = gen_xmlParserInputPtr(n_input, 0);
28266
28267 xmlParserPrintFileInfo(input);
28268 call_tests++;
28269 des_xmlParserInputPtr(n_input, input, 0);
28270 xmlResetLastError();
28271 if (mem_base != xmlMemBlocks()) {
28272 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028274 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028275 printf(" %d", n_input);
28276 printf("\n");
28277 }
28278 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028279 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028280
Daniel Veillard42595322004-11-08 10:52:06 +000028281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028282}
28283
28284
28285static int
28286test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028288
28289
28290 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028292}
28293
28294
28295static int
28296test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028298
28299
28300 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028302}
28303
28304
28305static int
28306test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028308
28309
28310 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028312}
28313
28314
28315static int
28316test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028318
Daniel Veillardce682bc2004-11-05 17:22:25 +000028319 int mem_base;
28320 xmlErrorPtr err; /* pointer to the error. */
28321 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028322
Daniel Veillardce682bc2004-11-05 17:22:25 +000028323 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28324 mem_base = xmlMemBlocks();
28325 err = gen_xmlErrorPtr(n_err, 0);
28326
28327 xmlResetError(err);
28328 call_tests++;
28329 des_xmlErrorPtr(n_err, err, 0);
28330 xmlResetLastError();
28331 if (mem_base != xmlMemBlocks()) {
28332 printf("Leak of %d blocks found in xmlResetError",
28333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028334 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028335 printf(" %d", n_err);
28336 printf("\n");
28337 }
28338 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028340
Daniel Veillard42595322004-11-08 10:52:06 +000028341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028342}
28343
28344
28345static int
28346test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028348
28349
28350
28351 xmlResetLastError();
28352 call_tests++;
28353 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028354 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028355
Daniel Veillard42595322004-11-08 10:52:06 +000028356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028357}
28358
28359
28360static int
28361test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028363
28364
28365 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028367}
28368
28369
28370static int
28371test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028373
28374
28375 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028377}
28378
28379static int
28380test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028382
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028383 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028384 test_ret += test_initGenericErrorDefaultFunc();
28385 test_ret += test_xmlCopyError();
28386 test_ret += test_xmlCtxtGetLastError();
28387 test_ret += test_xmlCtxtResetLastError();
28388 test_ret += test_xmlGetLastError();
28389 test_ret += test_xmlParserError();
28390 test_ret += test_xmlParserPrintFileContext();
28391 test_ret += test_xmlParserPrintFileInfo();
28392 test_ret += test_xmlParserValidityError();
28393 test_ret += test_xmlParserValidityWarning();
28394 test_ret += test_xmlParserWarning();
28395 test_ret += test_xmlResetError();
28396 test_ret += test_xmlResetLastError();
28397 test_ret += test_xmlSetGenericErrorFunc();
28398 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028399
Daniel Veillard42595322004-11-08 10:52:06 +000028400 if (test_ret != 0)
28401 printf("Module xmlerror: %d errors\n", test_ret);
28402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028403}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028404
28405static int
28406test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028408
Daniel Veillard34099b42004-11-04 17:34:35 +000028409#ifdef LIBXML_READER_ENABLED
28410 int mem_base;
28411 xmlTextReaderPtr ret_val;
28412 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28413 int n_input;
28414 const char * URI; /* the URI information for the source if available */
28415 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028416
Daniel Veillard34099b42004-11-04 17:34:35 +000028417 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28418 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28419 mem_base = xmlMemBlocks();
28420 input = gen_xmlParserInputBufferPtr(n_input, 0);
28421 URI = gen_filepath(n_URI, 1);
28422
28423 ret_val = xmlNewTextReader(input, URI);
28424 desret_xmlTextReaderPtr(ret_val);
28425 call_tests++;
28426 des_xmlParserInputBufferPtr(n_input, input, 0);
28427 des_filepath(n_URI, URI, 1);
28428 xmlResetLastError();
28429 if (mem_base != xmlMemBlocks()) {
28430 printf("Leak of %d blocks found in xmlNewTextReader",
28431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028432 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028433 printf(" %d", n_input);
28434 printf(" %d", n_URI);
28435 printf("\n");
28436 }
28437 }
28438 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028439 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028440#endif
28441
Daniel Veillard42595322004-11-08 10:52:06 +000028442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028443}
28444
28445
28446static int
28447test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028449
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028450#ifdef LIBXML_READER_ENABLED
28451 int mem_base;
28452 xmlTextReaderPtr ret_val;
28453 const char * URI; /* the URI of the resource to process */
28454 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028455
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028456 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28457 mem_base = xmlMemBlocks();
28458 URI = gen_filepath(n_URI, 0);
28459
28460 ret_val = xmlNewTextReaderFilename(URI);
28461 desret_xmlTextReaderPtr(ret_val);
28462 call_tests++;
28463 des_filepath(n_URI, URI, 0);
28464 xmlResetLastError();
28465 if (mem_base != xmlMemBlocks()) {
28466 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028468 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028469 printf(" %d", n_URI);
28470 printf("\n");
28471 }
28472 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028473 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028474#endif
28475
Daniel Veillard42595322004-11-08 10:52:06 +000028476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028477}
28478
28479
28480static int
28481test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028483
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028484#ifdef LIBXML_READER_ENABLED
28485 int mem_base;
28486 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028487 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028488 int n_cur;
28489 const char * URL; /* the base URL to use for the document */
28490 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028491 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028492 int n_encoding;
28493 int options; /* a combination of xmlParserOption */
28494 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028495
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028496 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28497 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28498 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028499 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028500 mem_base = xmlMemBlocks();
28501 cur = gen_const_xmlChar_ptr(n_cur, 0);
28502 URL = gen_filepath(n_URL, 1);
28503 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028504 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028505
William M. Brackf13f77f2004-11-12 16:03:48 +000028506 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028507 desret_xmlTextReaderPtr(ret_val);
28508 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028509 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028510 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028511 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028512 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028513 xmlResetLastError();
28514 if (mem_base != xmlMemBlocks()) {
28515 printf("Leak of %d blocks found in xmlReaderForDoc",
28516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028517 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028518 printf(" %d", n_cur);
28519 printf(" %d", n_URL);
28520 printf(" %d", n_encoding);
28521 printf(" %d", n_options);
28522 printf("\n");
28523 }
28524 }
28525 }
28526 }
28527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028528 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028529#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028530
Daniel Veillard42595322004-11-08 10:52:06 +000028531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028532}
28533
28534
28535static int
28536test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028538
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028539#ifdef LIBXML_READER_ENABLED
28540 int mem_base;
28541 xmlTextReaderPtr ret_val;
28542 const char * filename; /* a file or URL */
28543 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028544 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028545 int n_encoding;
28546 int options; /* a combination of xmlParserOption */
28547 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028548
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028549 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28550 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028551 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028552 mem_base = xmlMemBlocks();
28553 filename = gen_filepath(n_filename, 0);
28554 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028555 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028556
William M. Brackf13f77f2004-11-12 16:03:48 +000028557 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028558 desret_xmlTextReaderPtr(ret_val);
28559 call_tests++;
28560 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028561 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028562 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028563 xmlResetLastError();
28564 if (mem_base != xmlMemBlocks()) {
28565 printf("Leak of %d blocks found in xmlReaderForFile",
28566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028567 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028568 printf(" %d", n_filename);
28569 printf(" %d", n_encoding);
28570 printf(" %d", n_options);
28571 printf("\n");
28572 }
28573 }
28574 }
28575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028576 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028577#endif
28578
Daniel Veillard42595322004-11-08 10:52:06 +000028579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028580}
28581
28582
28583static int
28584test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028586
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028587#ifdef LIBXML_READER_ENABLED
28588 int mem_base;
28589 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028590 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028591 int n_buffer;
28592 int size; /* the size of the array */
28593 int n_size;
28594 const char * URL; /* the base URL to use for the document */
28595 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028596 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028597 int n_encoding;
28598 int options; /* a combination of xmlParserOption */
28599 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028600
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028601 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28602 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28603 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28604 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028605 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028606 mem_base = xmlMemBlocks();
28607 buffer = gen_const_char_ptr(n_buffer, 0);
28608 size = gen_int(n_size, 1);
28609 URL = gen_filepath(n_URL, 2);
28610 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028611 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028612
William M. Brackf13f77f2004-11-12 16:03:48 +000028613 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028614 desret_xmlTextReaderPtr(ret_val);
28615 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028616 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028617 des_int(n_size, size, 1);
28618 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028619 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028620 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028621 xmlResetLastError();
28622 if (mem_base != xmlMemBlocks()) {
28623 printf("Leak of %d blocks found in xmlReaderForMemory",
28624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028625 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028626 printf(" %d", n_buffer);
28627 printf(" %d", n_size);
28628 printf(" %d", n_URL);
28629 printf(" %d", n_encoding);
28630 printf(" %d", n_options);
28631 printf("\n");
28632 }
28633 }
28634 }
28635 }
28636 }
28637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028638 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028639#endif
28640
Daniel Veillard42595322004-11-08 10:52:06 +000028641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028642}
28643
28644
28645static int
28646test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028648
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028649#ifdef LIBXML_READER_ENABLED
28650 int mem_base;
28651 int ret_val;
28652 xmlTextReaderPtr reader; /* an XML reader */
28653 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028654 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028655 int n_cur;
28656 const char * URL; /* the base URL to use for the document */
28657 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028658 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028659 int n_encoding;
28660 int options; /* a combination of xmlParserOption */
28661 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028662
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028663 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28664 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28665 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28666 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028667 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028669 reader = gen_xmlTextReaderPtr(n_reader, 0);
28670 cur = gen_const_xmlChar_ptr(n_cur, 1);
28671 URL = gen_filepath(n_URL, 2);
28672 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028673 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028674
William M. Brackf13f77f2004-11-12 16:03:48 +000028675 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028676 desret_int(ret_val);
28677 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028678 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028679 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028680 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028681 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028682 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028683 xmlResetLastError();
28684 if (mem_base != xmlMemBlocks()) {
28685 printf("Leak of %d blocks found in xmlReaderNewDoc",
28686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028687 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028688 printf(" %d", n_reader);
28689 printf(" %d", n_cur);
28690 printf(" %d", n_URL);
28691 printf(" %d", n_encoding);
28692 printf(" %d", n_options);
28693 printf("\n");
28694 }
28695 }
28696 }
28697 }
28698 }
28699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028700 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028701#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028702
Daniel Veillard42595322004-11-08 10:52:06 +000028703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028704}
28705
28706
28707static int
28708test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028710
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028711#ifdef LIBXML_READER_ENABLED
28712 int mem_base;
28713 int ret_val;
28714 xmlTextReaderPtr reader; /* an XML reader */
28715 int n_reader;
28716 const char * filename; /* a file or URL */
28717 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028718 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028719 int n_encoding;
28720 int options; /* a combination of xmlParserOption */
28721 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028722
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028723 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28724 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28725 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028726 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028727 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028728 reader = gen_xmlTextReaderPtr(n_reader, 0);
28729 filename = gen_filepath(n_filename, 1);
28730 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028731 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028732
William M. Brackf13f77f2004-11-12 16:03:48 +000028733 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028734 desret_int(ret_val);
28735 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028736 des_xmlTextReaderPtr(n_reader, reader, 0);
28737 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028738 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028739 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028740 xmlResetLastError();
28741 if (mem_base != xmlMemBlocks()) {
28742 printf("Leak of %d blocks found in xmlReaderNewFile",
28743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028744 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028745 printf(" %d", n_reader);
28746 printf(" %d", n_filename);
28747 printf(" %d", n_encoding);
28748 printf(" %d", n_options);
28749 printf("\n");
28750 }
28751 }
28752 }
28753 }
28754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028755 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028756#endif
28757
Daniel Veillard42595322004-11-08 10:52:06 +000028758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028759}
28760
28761
28762static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028763test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028765
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028766#ifdef LIBXML_READER_ENABLED
28767 int mem_base;
28768 int ret_val;
28769 xmlTextReaderPtr reader; /* an XML reader */
28770 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028771 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028772 int n_buffer;
28773 int size; /* the size of the array */
28774 int n_size;
28775 const char * URL; /* the base URL to use for the document */
28776 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028777 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028778 int n_encoding;
28779 int options; /* a combination of xmlParserOption */
28780 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028781
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028782 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28783 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28784 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28785 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28786 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028787 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028788 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028789 reader = gen_xmlTextReaderPtr(n_reader, 0);
28790 buffer = gen_const_char_ptr(n_buffer, 1);
28791 size = gen_int(n_size, 2);
28792 URL = gen_filepath(n_URL, 3);
28793 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028794 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028795
William M. Brackf13f77f2004-11-12 16:03:48 +000028796 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028797 desret_int(ret_val);
28798 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028799 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028800 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028801 des_int(n_size, size, 2);
28802 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028803 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028804 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028805 xmlResetLastError();
28806 if (mem_base != xmlMemBlocks()) {
28807 printf("Leak of %d blocks found in xmlReaderNewMemory",
28808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028809 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028810 printf(" %d", n_reader);
28811 printf(" %d", n_buffer);
28812 printf(" %d", n_size);
28813 printf(" %d", n_URL);
28814 printf(" %d", n_encoding);
28815 printf(" %d", n_options);
28816 printf("\n");
28817 }
28818 }
28819 }
28820 }
28821 }
28822 }
28823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028824 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028825#endif
28826
Daniel Veillard42595322004-11-08 10:52:06 +000028827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028828}
28829
28830
28831static int
28832test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028834
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028835#ifdef LIBXML_READER_ENABLED
28836 int mem_base;
28837 int ret_val;
28838 xmlTextReaderPtr reader; /* an XML reader */
28839 int n_reader;
28840 xmlDocPtr doc; /* a preparsed document */
28841 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028842
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028843 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28844 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28845 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028846 reader = gen_xmlTextReaderPtr(n_reader, 0);
28847 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028848
28849 ret_val = xmlReaderNewWalker(reader, doc);
28850 desret_int(ret_val);
28851 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028852 des_xmlTextReaderPtr(n_reader, reader, 0);
28853 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028854 xmlResetLastError();
28855 if (mem_base != xmlMemBlocks()) {
28856 printf("Leak of %d blocks found in xmlReaderNewWalker",
28857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028858 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028859 printf(" %d", n_reader);
28860 printf(" %d", n_doc);
28861 printf("\n");
28862 }
28863 }
28864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028865 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028866#endif
28867
Daniel Veillard42595322004-11-08 10:52:06 +000028868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028869}
28870
28871
28872static int
28873test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028875
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028876#ifdef LIBXML_READER_ENABLED
28877 int mem_base;
28878 xmlTextReaderPtr ret_val;
28879 xmlDocPtr doc; /* a preparsed document */
28880 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028881
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028882 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28883 mem_base = xmlMemBlocks();
28884 doc = gen_xmlDocPtr(n_doc, 0);
28885
28886 ret_val = xmlReaderWalker(doc);
28887 desret_xmlTextReaderPtr(ret_val);
28888 call_tests++;
28889 des_xmlDocPtr(n_doc, doc, 0);
28890 xmlResetLastError();
28891 if (mem_base != xmlMemBlocks()) {
28892 printf("Leak of %d blocks found in xmlReaderWalker",
28893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028894 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028895 printf(" %d", n_doc);
28896 printf("\n");
28897 }
28898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028899 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028900#endif
28901
Daniel Veillard42595322004-11-08 10:52:06 +000028902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028903}
28904
28905
28906static int
28907test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028909
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028910#ifdef LIBXML_READER_ENABLED
28911 int mem_base;
28912 int ret_val;
28913 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28914 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028915
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028916 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28917 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028918 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028919
28920 ret_val = xmlTextReaderAttributeCount(reader);
28921 desret_int(ret_val);
28922 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028923 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028924 xmlResetLastError();
28925 if (mem_base != xmlMemBlocks()) {
28926 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028928 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028929 printf(" %d", n_reader);
28930 printf("\n");
28931 }
28932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028933 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028934#endif
28935
Daniel Veillard42595322004-11-08 10:52:06 +000028936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028937}
28938
28939
28940static int
28941test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028943
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028944#ifdef LIBXML_READER_ENABLED
28945 int mem_base;
28946 xmlChar * ret_val;
28947 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28948 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028949
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028950 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28951 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028952 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028953
28954 ret_val = xmlTextReaderBaseUri(reader);
28955 desret_xmlChar_ptr(ret_val);
28956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028957 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028958 xmlResetLastError();
28959 if (mem_base != xmlMemBlocks()) {
28960 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028962 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028963 printf(" %d", n_reader);
28964 printf("\n");
28965 }
28966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028967 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028968#endif
28969
Daniel Veillard42595322004-11-08 10:52:06 +000028970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028971}
28972
28973
28974static int
28975test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028977
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028978#ifdef LIBXML_READER_ENABLED
28979 int mem_base;
28980 int ret_val;
28981 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28982 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028983
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028984 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28985 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028986 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028987
28988 ret_val = xmlTextReaderClose(reader);
28989 desret_int(ret_val);
28990 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028991 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028992 xmlResetLastError();
28993 if (mem_base != xmlMemBlocks()) {
28994 printf("Leak of %d blocks found in xmlTextReaderClose",
28995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028996 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028997 printf(" %d", n_reader);
28998 printf("\n");
28999 }
29000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029001 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029002#endif
29003
Daniel Veillard42595322004-11-08 10:52:06 +000029004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029005}
29006
29007
29008static int
29009test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029012#ifdef LIBXML_READER_ENABLED
29013 int mem_base;
29014 const xmlChar * ret_val;
29015 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29016 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029017
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029018 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029020 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029021
29022 ret_val = xmlTextReaderConstBaseUri(reader);
29023 desret_const_xmlChar_ptr(ret_val);
29024 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029025 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029026 xmlResetLastError();
29027 if (mem_base != xmlMemBlocks()) {
29028 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029030 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029031 printf(" %d", n_reader);
29032 printf("\n");
29033 }
29034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029035 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029036#endif
29037
Daniel Veillard42595322004-11-08 10:52:06 +000029038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029039}
29040
29041
29042static int
29043test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029045
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029046#ifdef LIBXML_READER_ENABLED
29047 int mem_base;
29048 const xmlChar * ret_val;
29049 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29050 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029051
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029052 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029054 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029055
29056 ret_val = xmlTextReaderConstEncoding(reader);
29057 desret_const_xmlChar_ptr(ret_val);
29058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029059 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029060 xmlResetLastError();
29061 if (mem_base != xmlMemBlocks()) {
29062 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029064 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029065 printf(" %d", n_reader);
29066 printf("\n");
29067 }
29068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029069 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029070#endif
29071
Daniel Veillard42595322004-11-08 10:52:06 +000029072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029073}
29074
29075
29076static int
29077test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029079
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029080#ifdef LIBXML_READER_ENABLED
29081 int mem_base;
29082 const xmlChar * ret_val;
29083 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29084 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029085
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029086 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29087 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029088 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029089
29090 ret_val = xmlTextReaderConstLocalName(reader);
29091 desret_const_xmlChar_ptr(ret_val);
29092 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029093 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029094 xmlResetLastError();
29095 if (mem_base != xmlMemBlocks()) {
29096 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029098 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029099 printf(" %d", n_reader);
29100 printf("\n");
29101 }
29102 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029103 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029104#endif
29105
Daniel Veillard42595322004-11-08 10:52:06 +000029106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029107}
29108
29109
29110static int
29111test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029113
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029114#ifdef LIBXML_READER_ENABLED
29115 int mem_base;
29116 const xmlChar * ret_val;
29117 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29118 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029119
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029120 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29121 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029122 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029123
29124 ret_val = xmlTextReaderConstName(reader);
29125 desret_const_xmlChar_ptr(ret_val);
29126 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029127 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029128 xmlResetLastError();
29129 if (mem_base != xmlMemBlocks()) {
29130 printf("Leak of %d blocks found in xmlTextReaderConstName",
29131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029132 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029133 printf(" %d", n_reader);
29134 printf("\n");
29135 }
29136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029137 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029138#endif
29139
Daniel Veillard42595322004-11-08 10:52:06 +000029140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029141}
29142
29143
29144static int
29145test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029147
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029148#ifdef LIBXML_READER_ENABLED
29149 int mem_base;
29150 const xmlChar * ret_val;
29151 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29152 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029153
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029154 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29155 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029156 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029157
29158 ret_val = xmlTextReaderConstNamespaceUri(reader);
29159 desret_const_xmlChar_ptr(ret_val);
29160 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029161 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029162 xmlResetLastError();
29163 if (mem_base != xmlMemBlocks()) {
29164 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029166 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029167 printf(" %d", n_reader);
29168 printf("\n");
29169 }
29170 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029171 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029172#endif
29173
Daniel Veillard42595322004-11-08 10:52:06 +000029174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029175}
29176
29177
29178static int
29179test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029181
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029182#ifdef LIBXML_READER_ENABLED
29183 int mem_base;
29184 const xmlChar * ret_val;
29185 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29186 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029187
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029188 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29189 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029190 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029191
29192 ret_val = xmlTextReaderConstPrefix(reader);
29193 desret_const_xmlChar_ptr(ret_val);
29194 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029195 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029196 xmlResetLastError();
29197 if (mem_base != xmlMemBlocks()) {
29198 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029200 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029201 printf(" %d", n_reader);
29202 printf("\n");
29203 }
29204 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029205 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029206#endif
29207
Daniel Veillard42595322004-11-08 10:52:06 +000029208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029209}
29210
29211
29212static int
29213test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029215
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029216#ifdef LIBXML_READER_ENABLED
29217 int mem_base;
29218 const xmlChar * ret_val;
29219 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29220 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029221 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029222 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029223
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029224 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29225 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29226 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029227 reader = gen_xmlTextReaderPtr(n_reader, 0);
29228 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029229
William M. Brackf13f77f2004-11-12 16:03:48 +000029230 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029231 desret_const_xmlChar_ptr(ret_val);
29232 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029233 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029234 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029235 xmlResetLastError();
29236 if (mem_base != xmlMemBlocks()) {
29237 printf("Leak of %d blocks found in xmlTextReaderConstString",
29238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029239 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029240 printf(" %d", n_reader);
29241 printf(" %d", n_str);
29242 printf("\n");
29243 }
29244 }
29245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029246 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029247#endif
29248
Daniel Veillard42595322004-11-08 10:52:06 +000029249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029250}
29251
29252
29253static int
29254test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029256
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029257#ifdef LIBXML_READER_ENABLED
29258 int mem_base;
29259 const xmlChar * ret_val;
29260 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29261 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029262
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029263 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029265 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029266
29267 ret_val = xmlTextReaderConstValue(reader);
29268 desret_const_xmlChar_ptr(ret_val);
29269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029270 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029271 xmlResetLastError();
29272 if (mem_base != xmlMemBlocks()) {
29273 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029275 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029276 printf(" %d", n_reader);
29277 printf("\n");
29278 }
29279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029280 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029281#endif
29282
Daniel Veillard42595322004-11-08 10:52:06 +000029283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029284}
29285
29286
29287static int
29288test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029290
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029291#ifdef LIBXML_READER_ENABLED
29292 int mem_base;
29293 const xmlChar * ret_val;
29294 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29295 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029296
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029297 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29298 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029299 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029300
29301 ret_val = xmlTextReaderConstXmlLang(reader);
29302 desret_const_xmlChar_ptr(ret_val);
29303 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029304 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029305 xmlResetLastError();
29306 if (mem_base != xmlMemBlocks()) {
29307 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029309 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029310 printf(" %d", n_reader);
29311 printf("\n");
29312 }
29313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029314 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029315#endif
29316
Daniel Veillard42595322004-11-08 10:52:06 +000029317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029318}
29319
29320
29321static int
29322test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029324
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029325#ifdef LIBXML_READER_ENABLED
29326 int mem_base;
29327 const xmlChar * ret_val;
29328 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29329 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029330
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029331 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029333 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029334
29335 ret_val = xmlTextReaderConstXmlVersion(reader);
29336 desret_const_xmlChar_ptr(ret_val);
29337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029338 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029339 xmlResetLastError();
29340 if (mem_base != xmlMemBlocks()) {
29341 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029343 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029344 printf(" %d", n_reader);
29345 printf("\n");
29346 }
29347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029348 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029349#endif
29350
Daniel Veillard42595322004-11-08 10:52:06 +000029351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029352}
29353
29354
29355static int
29356test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029358
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029359#ifdef LIBXML_READER_ENABLED
29360 int mem_base;
29361 xmlDocPtr ret_val;
29362 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29363 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029364
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029365 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29366 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029367 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029368
29369 ret_val = xmlTextReaderCurrentDoc(reader);
29370 desret_xmlDocPtr(ret_val);
29371 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029372 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029373 xmlResetLastError();
29374 if (mem_base != xmlMemBlocks()) {
29375 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029377 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029378 printf(" %d", n_reader);
29379 printf("\n");
29380 }
29381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029382 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029383#endif
29384
Daniel Veillard42595322004-11-08 10:52:06 +000029385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029386}
29387
29388
29389static int
29390test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029392
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029393#ifdef LIBXML_READER_ENABLED
29394 int mem_base;
29395 xmlNodePtr ret_val;
29396 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29397 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029398
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029399 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29400 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029401 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029402
29403 ret_val = xmlTextReaderCurrentNode(reader);
29404 desret_xmlNodePtr(ret_val);
29405 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029406 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029407 xmlResetLastError();
29408 if (mem_base != xmlMemBlocks()) {
29409 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029411 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029412 printf(" %d", n_reader);
29413 printf("\n");
29414 }
29415 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029416 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029417#endif
29418
Daniel Veillard42595322004-11-08 10:52:06 +000029419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029420}
29421
29422
29423static int
29424test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029426
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029427#ifdef LIBXML_READER_ENABLED
29428 int mem_base;
29429 int ret_val;
29430 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29431 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029432
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029433 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29434 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029435 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029436
29437 ret_val = xmlTextReaderDepth(reader);
29438 desret_int(ret_val);
29439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029440 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029441 xmlResetLastError();
29442 if (mem_base != xmlMemBlocks()) {
29443 printf("Leak of %d blocks found in xmlTextReaderDepth",
29444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029445 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029446 printf(" %d", n_reader);
29447 printf("\n");
29448 }
29449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029450 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029451#endif
29452
Daniel Veillard42595322004-11-08 10:52:06 +000029453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029454}
29455
29456
29457static int
29458test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029460
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029461#ifdef LIBXML_READER_ENABLED
29462 int mem_base;
29463 xmlNodePtr ret_val;
29464 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29465 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029466
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029467 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29468 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029469 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029470
29471 ret_val = xmlTextReaderExpand(reader);
29472 desret_xmlNodePtr(ret_val);
29473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029474 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029475 xmlResetLastError();
29476 if (mem_base != xmlMemBlocks()) {
29477 printf("Leak of %d blocks found in xmlTextReaderExpand",
29478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029479 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029480 printf(" %d", n_reader);
29481 printf("\n");
29482 }
29483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029484 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029485#endif
29486
Daniel Veillard42595322004-11-08 10:52:06 +000029487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029488}
29489
29490
29491static int
29492test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029494
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029495#ifdef LIBXML_READER_ENABLED
29496 int mem_base;
29497 xmlChar * ret_val;
29498 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29499 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029500 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029501 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029502
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029503 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29504 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029506 reader = gen_xmlTextReaderPtr(n_reader, 0);
29507 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029508
William M. Brackf13f77f2004-11-12 16:03:48 +000029509 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029510 desret_xmlChar_ptr(ret_val);
29511 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029512 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029513 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029514 xmlResetLastError();
29515 if (mem_base != xmlMemBlocks()) {
29516 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029518 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029519 printf(" %d", n_reader);
29520 printf(" %d", n_name);
29521 printf("\n");
29522 }
29523 }
29524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029525 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029526#endif
29527
Daniel Veillard42595322004-11-08 10:52:06 +000029528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029529}
29530
29531
29532static int
29533test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029535
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029536#ifdef LIBXML_READER_ENABLED
29537 int mem_base;
29538 xmlChar * ret_val;
29539 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29540 int n_reader;
29541 int no; /* the zero-based index of the attribute relative to the containing element */
29542 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029543
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029544 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29545 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29546 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029547 reader = gen_xmlTextReaderPtr(n_reader, 0);
29548 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029549
29550 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29551 desret_xmlChar_ptr(ret_val);
29552 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029553 des_xmlTextReaderPtr(n_reader, reader, 0);
29554 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029555 xmlResetLastError();
29556 if (mem_base != xmlMemBlocks()) {
29557 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029559 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029560 printf(" %d", n_reader);
29561 printf(" %d", n_no);
29562 printf("\n");
29563 }
29564 }
29565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029566 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029567#endif
29568
Daniel Veillard42595322004-11-08 10:52:06 +000029569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029570}
29571
29572
29573static int
29574test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029576
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029577#ifdef LIBXML_READER_ENABLED
29578 int mem_base;
29579 xmlChar * ret_val;
29580 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29581 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029582 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029583 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029584 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029585 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029586
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029587 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29588 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29589 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029591 reader = gen_xmlTextReaderPtr(n_reader, 0);
29592 localName = gen_const_xmlChar_ptr(n_localName, 1);
29593 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029594
William M. Brackf13f77f2004-11-12 16:03:48 +000029595 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029596 desret_xmlChar_ptr(ret_val);
29597 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029598 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029599 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29600 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029601 xmlResetLastError();
29602 if (mem_base != xmlMemBlocks()) {
29603 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029605 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029606 printf(" %d", n_reader);
29607 printf(" %d", n_localName);
29608 printf(" %d", n_namespaceURI);
29609 printf("\n");
29610 }
29611 }
29612 }
29613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029614 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029615#endif
29616
Daniel Veillard42595322004-11-08 10:52:06 +000029617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029618}
29619
Daniel Veillarda521d282004-11-09 14:59:59 +000029620#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029621
Daniel Veillardce682bc2004-11-05 17:22:25 +000029622#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29623static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29624 return(NULL);
29625}
29626static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29627}
Daniel Veillarda521d282004-11-09 14:59:59 +000029628#endif
29629
Daniel Veillardce682bc2004-11-05 17:22:25 +000029630
Daniel Veillardd93f6252004-11-02 15:53:51 +000029631static int
29632test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029634
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029635#ifdef LIBXML_READER_ENABLED
29636 int mem_base;
29637 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29638 int n_reader;
29639 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29640 int n_f;
29641 void ** arg; /* a user argument */
29642 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029643
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029644 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29645 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29646 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29647 mem_base = xmlMemBlocks();
29648 reader = gen_xmlTextReaderPtr(n_reader, 0);
29649 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29650 arg = gen_void_ptr_ptr(n_arg, 2);
29651
29652 xmlTextReaderGetErrorHandler(reader, f, arg);
29653 call_tests++;
29654 des_xmlTextReaderPtr(n_reader, reader, 0);
29655 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29656 des_void_ptr_ptr(n_arg, arg, 2);
29657 xmlResetLastError();
29658 if (mem_base != xmlMemBlocks()) {
29659 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029661 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029662 printf(" %d", n_reader);
29663 printf(" %d", n_f);
29664 printf(" %d", n_arg);
29665 printf("\n");
29666 }
29667 }
29668 }
29669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029670 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029671#endif
29672
Daniel Veillard42595322004-11-08 10:52:06 +000029673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029674}
29675
29676
29677static int
29678test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029680
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029681#ifdef LIBXML_READER_ENABLED
29682 int mem_base;
29683 int ret_val;
29684 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29685 int n_reader;
29686 int prop; /* the xmlParserProperties to get */
29687 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029688
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029689 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29690 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029692 reader = gen_xmlTextReaderPtr(n_reader, 0);
29693 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029694
29695 ret_val = xmlTextReaderGetParserProp(reader, prop);
29696 desret_int(ret_val);
29697 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029698 des_xmlTextReaderPtr(n_reader, reader, 0);
29699 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029700 xmlResetLastError();
29701 if (mem_base != xmlMemBlocks()) {
29702 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029704 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029705 printf(" %d", n_reader);
29706 printf(" %d", n_prop);
29707 printf("\n");
29708 }
29709 }
29710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029711 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029712#endif
29713
Daniel Veillard42595322004-11-08 10:52:06 +000029714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029715}
29716
29717
29718static int
29719test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029720 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029721
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029722#ifdef LIBXML_READER_ENABLED
29723 int mem_base;
29724 xmlParserInputBufferPtr ret_val;
29725 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29726 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029727
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029728 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29729 mem_base = xmlMemBlocks();
29730 reader = gen_xmlTextReaderPtr(n_reader, 0);
29731
29732 ret_val = xmlTextReaderGetRemainder(reader);
29733 desret_xmlParserInputBufferPtr(ret_val);
29734 call_tests++;
29735 des_xmlTextReaderPtr(n_reader, reader, 0);
29736 xmlResetLastError();
29737 if (mem_base != xmlMemBlocks()) {
29738 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029740 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029741 printf(" %d", n_reader);
29742 printf("\n");
29743 }
29744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029745 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029746#endif
29747
Daniel Veillard42595322004-11-08 10:52:06 +000029748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029749}
29750
29751
29752static int
29753test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029755
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029756#ifdef LIBXML_READER_ENABLED
29757 int mem_base;
29758 int ret_val;
29759 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29760 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029761
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029762 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29763 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029764 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029765
29766 ret_val = xmlTextReaderHasAttributes(reader);
29767 desret_int(ret_val);
29768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029769 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029770 xmlResetLastError();
29771 if (mem_base != xmlMemBlocks()) {
29772 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029774 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029775 printf(" %d", n_reader);
29776 printf("\n");
29777 }
29778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029779 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029780#endif
29781
Daniel Veillard42595322004-11-08 10:52:06 +000029782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029783}
29784
29785
29786static int
29787test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029789
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029790#ifdef LIBXML_READER_ENABLED
29791 int mem_base;
29792 int ret_val;
29793 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29794 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029795
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029796 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29797 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029798 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029799
29800 ret_val = xmlTextReaderHasValue(reader);
29801 desret_int(ret_val);
29802 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029803 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029804 xmlResetLastError();
29805 if (mem_base != xmlMemBlocks()) {
29806 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029808 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029809 printf(" %d", n_reader);
29810 printf("\n");
29811 }
29812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029813 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029814#endif
29815
Daniel Veillard42595322004-11-08 10:52:06 +000029816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029817}
29818
29819
29820static int
29821test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029823
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029824#ifdef LIBXML_READER_ENABLED
29825 int mem_base;
29826 int ret_val;
29827 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29828 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029829
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029830 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29831 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029832 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029833
29834 ret_val = xmlTextReaderIsDefault(reader);
29835 desret_int(ret_val);
29836 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029837 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029838 xmlResetLastError();
29839 if (mem_base != xmlMemBlocks()) {
29840 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029842 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029843 printf(" %d", n_reader);
29844 printf("\n");
29845 }
29846 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029847 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029848#endif
29849
Daniel Veillard42595322004-11-08 10:52:06 +000029850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029851}
29852
29853
29854static int
29855test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029857
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029858#ifdef LIBXML_READER_ENABLED
29859 int mem_base;
29860 int ret_val;
29861 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29862 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029863
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029864 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29865 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029866 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029867
29868 ret_val = xmlTextReaderIsEmptyElement(reader);
29869 desret_int(ret_val);
29870 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029871 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029872 xmlResetLastError();
29873 if (mem_base != xmlMemBlocks()) {
29874 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029876 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029877 printf(" %d", n_reader);
29878 printf("\n");
29879 }
29880 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029881 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029882#endif
29883
Daniel Veillard42595322004-11-08 10:52:06 +000029884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029885}
29886
29887
29888static int
29889test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029891
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892#ifdef LIBXML_READER_ENABLED
29893 int mem_base;
29894 int ret_val;
29895 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29896 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029897
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029898 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29899 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029900 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029901
29902 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29903 desret_int(ret_val);
29904 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029905 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029906 xmlResetLastError();
29907 if (mem_base != xmlMemBlocks()) {
29908 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029910 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029911 printf(" %d", n_reader);
29912 printf("\n");
29913 }
29914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029915 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029916#endif
29917
Daniel Veillard42595322004-11-08 10:52:06 +000029918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029919}
29920
29921
29922static int
29923test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029925
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926#ifdef LIBXML_READER_ENABLED
29927 int mem_base;
29928 int ret_val;
29929 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29930 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029931
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029932 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029934 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029935
29936 ret_val = xmlTextReaderIsValid(reader);
29937 desret_int(ret_val);
29938 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029939 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029940 xmlResetLastError();
29941 if (mem_base != xmlMemBlocks()) {
29942 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029944 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029945 printf(" %d", n_reader);
29946 printf("\n");
29947 }
29948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029949 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029950#endif
29951
Daniel Veillard42595322004-11-08 10:52:06 +000029952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029953}
29954
29955
29956static int
29957test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029959
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029960#ifdef LIBXML_READER_ENABLED
29961 int mem_base;
29962 xmlChar * ret_val;
29963 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29964 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029965
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029966 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029968 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029969
29970 ret_val = xmlTextReaderLocalName(reader);
29971 desret_xmlChar_ptr(ret_val);
29972 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029973 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029974 xmlResetLastError();
29975 if (mem_base != xmlMemBlocks()) {
29976 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029978 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029979 printf(" %d", n_reader);
29980 printf("\n");
29981 }
29982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029983 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029984#endif
29985
Daniel Veillard42595322004-11-08 10:52:06 +000029986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029987}
29988
Daniel Veillarda521d282004-11-09 14:59:59 +000029989#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029990
Daniel Veillardce682bc2004-11-05 17:22:25 +000029991#define gen_nb_xmlTextReaderLocatorPtr 1
29992static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29993 return(NULL);
29994}
29995static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29996}
Daniel Veillarda521d282004-11-09 14:59:59 +000029997#endif
29998
Daniel Veillardce682bc2004-11-05 17:22:25 +000029999
Daniel Veillardd93f6252004-11-02 15:53:51 +000030000static int
30001test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030003
Daniel Veillardce682bc2004-11-05 17:22:25 +000030004#ifdef LIBXML_READER_ENABLED
30005 int mem_base;
30006 xmlChar * ret_val;
30007 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30008 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030009
Daniel Veillardce682bc2004-11-05 17:22:25 +000030010 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30011 mem_base = xmlMemBlocks();
30012 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30013
30014 ret_val = xmlTextReaderLocatorBaseURI(locator);
30015 desret_xmlChar_ptr(ret_val);
30016 call_tests++;
30017 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30018 xmlResetLastError();
30019 if (mem_base != xmlMemBlocks()) {
30020 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030022 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030023 printf(" %d", n_locator);
30024 printf("\n");
30025 }
30026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030027 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030028#endif
30029
Daniel Veillard42595322004-11-08 10:52:06 +000030030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030031}
30032
30033
30034static int
30035test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030037
Daniel Veillardce682bc2004-11-05 17:22:25 +000030038#ifdef LIBXML_READER_ENABLED
30039 int mem_base;
30040 int ret_val;
30041 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30042 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030043
Daniel Veillardce682bc2004-11-05 17:22:25 +000030044 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30045 mem_base = xmlMemBlocks();
30046 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30047
30048 ret_val = xmlTextReaderLocatorLineNumber(locator);
30049 desret_int(ret_val);
30050 call_tests++;
30051 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30052 xmlResetLastError();
30053 if (mem_base != xmlMemBlocks()) {
30054 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030056 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030057 printf(" %d", n_locator);
30058 printf("\n");
30059 }
30060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030061 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030062#endif
30063
Daniel Veillard42595322004-11-08 10:52:06 +000030064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030065}
30066
30067
30068static int
30069test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030071
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072#ifdef LIBXML_READER_ENABLED
30073 int mem_base;
30074 xmlChar * ret_val;
30075 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30076 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030077 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 +000030078 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030079
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30081 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30082 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030083 reader = gen_xmlTextReaderPtr(n_reader, 0);
30084 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030085
William M. Brackf13f77f2004-11-12 16:03:48 +000030086 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030087 desret_xmlChar_ptr(ret_val);
30088 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030089 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030090 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030091 xmlResetLastError();
30092 if (mem_base != xmlMemBlocks()) {
30093 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030095 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030096 printf(" %d", n_reader);
30097 printf(" %d", n_prefix);
30098 printf("\n");
30099 }
30100 }
30101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030102 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030103#endif
30104
Daniel Veillard42595322004-11-08 10:52:06 +000030105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030106}
30107
30108
30109static int
30110test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030112
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030113#ifdef LIBXML_READER_ENABLED
30114 int mem_base;
30115 int ret_val;
30116 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30117 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030118 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030119 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030120
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030121 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30122 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30123 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030124 reader = gen_xmlTextReaderPtr(n_reader, 0);
30125 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030126
William M. Brackf13f77f2004-11-12 16:03:48 +000030127 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030128 desret_int(ret_val);
30129 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030130 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030131 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030132 xmlResetLastError();
30133 if (mem_base != xmlMemBlocks()) {
30134 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030136 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030137 printf(" %d", n_reader);
30138 printf(" %d", n_name);
30139 printf("\n");
30140 }
30141 }
30142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030143 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030144#endif
30145
Daniel Veillard42595322004-11-08 10:52:06 +000030146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030147}
30148
30149
30150static int
30151test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030153
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030154#ifdef LIBXML_READER_ENABLED
30155 int mem_base;
30156 int ret_val;
30157 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30158 int n_reader;
30159 int no; /* the zero-based index of the attribute relative to the containing element. */
30160 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030161
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030162 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30163 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30164 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030165 reader = gen_xmlTextReaderPtr(n_reader, 0);
30166 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030167
30168 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30169 desret_int(ret_val);
30170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030171 des_xmlTextReaderPtr(n_reader, reader, 0);
30172 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030173 xmlResetLastError();
30174 if (mem_base != xmlMemBlocks()) {
30175 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030177 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030178 printf(" %d", n_reader);
30179 printf(" %d", n_no);
30180 printf("\n");
30181 }
30182 }
30183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030184 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030185#endif
30186
Daniel Veillard42595322004-11-08 10:52:06 +000030187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030188}
30189
30190
30191static int
30192test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030194
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030195#ifdef LIBXML_READER_ENABLED
30196 int mem_base;
30197 int ret_val;
30198 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30199 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030200 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030201 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030202 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030203 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030204
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030205 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30206 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30207 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030209 reader = gen_xmlTextReaderPtr(n_reader, 0);
30210 localName = gen_const_xmlChar_ptr(n_localName, 1);
30211 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030212
William M. Brackf13f77f2004-11-12 16:03:48 +000030213 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030214 desret_int(ret_val);
30215 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030216 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030217 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30218 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030219 xmlResetLastError();
30220 if (mem_base != xmlMemBlocks()) {
30221 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030223 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030224 printf(" %d", n_reader);
30225 printf(" %d", n_localName);
30226 printf(" %d", n_namespaceURI);
30227 printf("\n");
30228 }
30229 }
30230 }
30231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030232 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030233#endif
30234
Daniel Veillard42595322004-11-08 10:52:06 +000030235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030236}
30237
30238
30239static int
30240test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030242
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030243#ifdef LIBXML_READER_ENABLED
30244 int mem_base;
30245 int ret_val;
30246 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30247 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030248
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030249 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30250 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030251 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030252
30253 ret_val = xmlTextReaderMoveToElement(reader);
30254 desret_int(ret_val);
30255 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030256 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030257 xmlResetLastError();
30258 if (mem_base != xmlMemBlocks()) {
30259 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030261 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030262 printf(" %d", n_reader);
30263 printf("\n");
30264 }
30265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030266 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030267#endif
30268
Daniel Veillard42595322004-11-08 10:52:06 +000030269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030270}
30271
30272
30273static int
30274test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030276
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030277#ifdef LIBXML_READER_ENABLED
30278 int mem_base;
30279 int ret_val;
30280 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30281 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030282
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030283 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30284 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030285 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030286
30287 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30288 desret_int(ret_val);
30289 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030290 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030291 xmlResetLastError();
30292 if (mem_base != xmlMemBlocks()) {
30293 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030295 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030296 printf(" %d", n_reader);
30297 printf("\n");
30298 }
30299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030300 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030301#endif
30302
Daniel Veillard42595322004-11-08 10:52:06 +000030303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030304}
30305
30306
30307static int
30308test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030310
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030311#ifdef LIBXML_READER_ENABLED
30312 int mem_base;
30313 int ret_val;
30314 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30315 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030316
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030317 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30318 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030319 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030320
30321 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30322 desret_int(ret_val);
30323 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030324 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030325 xmlResetLastError();
30326 if (mem_base != xmlMemBlocks()) {
30327 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030329 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030330 printf(" %d", n_reader);
30331 printf("\n");
30332 }
30333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030334 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030335#endif
30336
Daniel Veillard42595322004-11-08 10:52:06 +000030337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030338}
30339
30340
30341static int
30342test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030344
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030345#ifdef LIBXML_READER_ENABLED
30346 int mem_base;
30347 xmlChar * ret_val;
30348 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30349 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030350
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030351 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30352 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030353 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030354
30355 ret_val = xmlTextReaderName(reader);
30356 desret_xmlChar_ptr(ret_val);
30357 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030358 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030359 xmlResetLastError();
30360 if (mem_base != xmlMemBlocks()) {
30361 printf("Leak of %d blocks found in xmlTextReaderName",
30362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030363 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030364 printf(" %d", n_reader);
30365 printf("\n");
30366 }
30367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030368 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030369#endif
30370
Daniel Veillard42595322004-11-08 10:52:06 +000030371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030372}
30373
30374
30375static int
30376test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030378
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030379#ifdef LIBXML_READER_ENABLED
30380 int mem_base;
30381 xmlChar * ret_val;
30382 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30383 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030384
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030385 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030387 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030388
30389 ret_val = xmlTextReaderNamespaceUri(reader);
30390 desret_xmlChar_ptr(ret_val);
30391 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030392 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030393 xmlResetLastError();
30394 if (mem_base != xmlMemBlocks()) {
30395 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030397 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030398 printf(" %d", n_reader);
30399 printf("\n");
30400 }
30401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030402 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030403#endif
30404
Daniel Veillard42595322004-11-08 10:52:06 +000030405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030406}
30407
30408
30409static int
30410test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030412
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413#ifdef LIBXML_READER_ENABLED
30414 int mem_base;
30415 int ret_val;
30416 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30417 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030418
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030419 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030421 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030422
30423 ret_val = xmlTextReaderNext(reader);
30424 desret_int(ret_val);
30425 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030426 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030427 xmlResetLastError();
30428 if (mem_base != xmlMemBlocks()) {
30429 printf("Leak of %d blocks found in xmlTextReaderNext",
30430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030431 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030432 printf(" %d", n_reader);
30433 printf("\n");
30434 }
30435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030436 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030437#endif
30438
Daniel Veillard42595322004-11-08 10:52:06 +000030439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030440}
30441
30442
30443static int
30444test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030446
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030447#ifdef LIBXML_READER_ENABLED
30448 int mem_base;
30449 int ret_val;
30450 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30451 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030452
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030453 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30454 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030455 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030456
30457 ret_val = xmlTextReaderNextSibling(reader);
30458 desret_int(ret_val);
30459 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030460 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030461 xmlResetLastError();
30462 if (mem_base != xmlMemBlocks()) {
30463 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030465 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030466 printf(" %d", n_reader);
30467 printf("\n");
30468 }
30469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030470 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030471#endif
30472
Daniel Veillard42595322004-11-08 10:52:06 +000030473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030474}
30475
30476
30477static int
30478test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030480
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030481#ifdef LIBXML_READER_ENABLED
30482 int mem_base;
30483 int ret_val;
30484 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30485 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030486
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030487 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30488 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030489 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030490
30491 ret_val = xmlTextReaderNodeType(reader);
30492 desret_int(ret_val);
30493 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030494 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030495 xmlResetLastError();
30496 if (mem_base != xmlMemBlocks()) {
30497 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030499 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030500 printf(" %d", n_reader);
30501 printf("\n");
30502 }
30503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030504 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030505#endif
30506
Daniel Veillard42595322004-11-08 10:52:06 +000030507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030508}
30509
30510
30511static int
30512test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030514
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030515#ifdef LIBXML_READER_ENABLED
30516 int mem_base;
30517 int ret_val;
30518 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30519 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030520
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030521 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030523 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030524
30525 ret_val = xmlTextReaderNormalization(reader);
30526 desret_int(ret_val);
30527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030528 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030529 xmlResetLastError();
30530 if (mem_base != xmlMemBlocks()) {
30531 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030533 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030534 printf(" %d", n_reader);
30535 printf("\n");
30536 }
30537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030538 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030539#endif
30540
Daniel Veillard42595322004-11-08 10:52:06 +000030541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030542}
30543
30544
30545static int
30546test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030548
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030549#ifdef LIBXML_READER_ENABLED
30550 int mem_base;
30551 xmlChar * ret_val;
30552 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30553 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030554
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030555 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30556 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030557 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030558
30559 ret_val = xmlTextReaderPrefix(reader);
30560 desret_xmlChar_ptr(ret_val);
30561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030562 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030563 xmlResetLastError();
30564 if (mem_base != xmlMemBlocks()) {
30565 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030567 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030568 printf(" %d", n_reader);
30569 printf("\n");
30570 }
30571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030572 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030573#endif
30574
Daniel Veillard42595322004-11-08 10:52:06 +000030575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030576}
30577
30578
30579static int
30580test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030582
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030583#ifdef LIBXML_READER_ENABLED
30584 int mem_base;
30585 xmlNodePtr ret_val;
30586 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30587 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030588
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030589 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030591 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030592
30593 ret_val = xmlTextReaderPreserve(reader);
30594 desret_xmlNodePtr(ret_val);
30595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030596 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030597 xmlResetLastError();
30598 if (mem_base != xmlMemBlocks()) {
30599 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030601 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030602 printf(" %d", n_reader);
30603 printf("\n");
30604 }
30605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030606 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030607#endif
30608
Daniel Veillard42595322004-11-08 10:52:06 +000030609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030610}
30611
30612
30613static int
30614test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030616
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030617#ifdef LIBXML_READER_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030618#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030619 int mem_base;
30620 int ret_val;
30621 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30622 int n_reader;
30623 xmlChar * pattern; /* an XPath subset pattern */
30624 int n_pattern;
30625 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30626 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030627
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030628 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30629 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30630 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30631 mem_base = xmlMemBlocks();
30632 reader = gen_xmlTextReaderPtr(n_reader, 0);
30633 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30634 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30635
William M. Brackf13f77f2004-11-12 16:03:48 +000030636 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030637 desret_int(ret_val);
30638 call_tests++;
30639 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030640 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30641 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030642 xmlResetLastError();
30643 if (mem_base != xmlMemBlocks()) {
30644 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030646 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030647 printf(" %d", n_reader);
30648 printf(" %d", n_pattern);
30649 printf(" %d", n_namespaces);
30650 printf("\n");
30651 }
30652 }
30653 }
30654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030655 function_tests++;
30656#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030657#endif
30658
Daniel Veillard42595322004-11-08 10:52:06 +000030659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030660}
30661
30662
30663static int
30664test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030666
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030667#ifdef LIBXML_READER_ENABLED
30668 int mem_base;
30669 int ret_val;
30670 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30671 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030672
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030673 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30674 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030675 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030676
30677 ret_val = xmlTextReaderQuoteChar(reader);
30678 desret_int(ret_val);
30679 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030680 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030681 xmlResetLastError();
30682 if (mem_base != xmlMemBlocks()) {
30683 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030685 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030686 printf(" %d", n_reader);
30687 printf("\n");
30688 }
30689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030690 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030691#endif
30692
Daniel Veillard42595322004-11-08 10:52:06 +000030693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030694}
30695
30696
30697static int
30698test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030700
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030701#ifdef LIBXML_READER_ENABLED
30702 int mem_base;
30703 int ret_val;
30704 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30705 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030706
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030707 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30708 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030709 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030710
30711 ret_val = xmlTextReaderRead(reader);
30712 desret_int(ret_val);
30713 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030714 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030715 xmlResetLastError();
30716 if (mem_base != xmlMemBlocks()) {
30717 printf("Leak of %d blocks found in xmlTextReaderRead",
30718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030719 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030720 printf(" %d", n_reader);
30721 printf("\n");
30722 }
30723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030724 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030725#endif
30726
Daniel Veillard42595322004-11-08 10:52:06 +000030727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030728}
30729
30730
30731static int
30732test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030734
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030735#ifdef LIBXML_READER_ENABLED
30736 int mem_base;
30737 int ret_val;
30738 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30739 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030740
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030741 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30742 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030743 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030744
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030745 ret_val = xmlTextReaderReadAttributeValue(reader);
30746 desret_int(ret_val);
30747 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030748 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030749 xmlResetLastError();
30750 if (mem_base != xmlMemBlocks()) {
30751 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030753 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030754 printf(" %d", n_reader);
30755 printf("\n");
30756 }
30757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030758 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030759#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030760
Daniel Veillard42595322004-11-08 10:52:06 +000030761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030762}
30763
30764
30765static int
30766test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030768
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030769#ifdef LIBXML_READER_ENABLED
30770 int mem_base;
30771 int ret_val;
30772 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30773 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030774
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030775 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30776 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030777 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030778
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030779 ret_val = xmlTextReaderReadState(reader);
30780 desret_int(ret_val);
30781 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030782 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030783 xmlResetLastError();
30784 if (mem_base != xmlMemBlocks()) {
30785 printf("Leak of %d blocks found in xmlTextReaderReadState",
30786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030787 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030788 printf(" %d", n_reader);
30789 printf("\n");
30790 }
30791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030792 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030793#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030794
Daniel Veillard42595322004-11-08 10:52:06 +000030795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030796}
30797
30798
30799static int
30800test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030802
Daniel Veillardce682bc2004-11-05 17:22:25 +000030803#ifdef LIBXML_READER_ENABLED
30804#ifdef LIBXML_SCHEMAS_ENABLED
30805 int mem_base;
30806 int ret_val;
30807 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30808 int n_reader;
30809 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30810 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030811
Daniel Veillardce682bc2004-11-05 17:22:25 +000030812 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30813 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30814 mem_base = xmlMemBlocks();
30815 reader = gen_xmlTextReaderPtr(n_reader, 0);
30816 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30817
30818 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30819 desret_int(ret_val);
30820 call_tests++;
30821 des_xmlTextReaderPtr(n_reader, reader, 0);
30822 des_xmlRelaxNGPtr(n_schema, schema, 1);
30823 xmlResetLastError();
30824 if (mem_base != xmlMemBlocks()) {
30825 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030827 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030828 printf(" %d", n_reader);
30829 printf(" %d", n_schema);
30830 printf("\n");
30831 }
30832 }
30833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030834 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030835#endif
30836#endif
30837
Daniel Veillard42595322004-11-08 10:52:06 +000030838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030839}
30840
30841
30842static int
30843test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030845
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030846#ifdef LIBXML_READER_ENABLED
30847#ifdef LIBXML_SCHEMAS_ENABLED
30848 int mem_base;
30849 int ret_val;
30850 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30851 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030852 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030853 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030854
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030855 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30856 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030858 reader = gen_xmlTextReaderPtr(n_reader, 0);
30859 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030860
William M. Brackf13f77f2004-11-12 16:03:48 +000030861 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030862 desret_int(ret_val);
30863 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030864 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030865 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030866 xmlResetLastError();
30867 if (mem_base != xmlMemBlocks()) {
30868 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030870 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030871 printf(" %d", n_reader);
30872 printf(" %d", n_rng);
30873 printf("\n");
30874 }
30875 }
30876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030877 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030878#endif
30879#endif
30880
Daniel Veillard42595322004-11-08 10:52:06 +000030881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030882}
30883
30884
30885static int
30886test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030888
30889
30890 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030892}
30893
30894
30895static int
30896test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030898
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030899#ifdef LIBXML_READER_ENABLED
30900 int mem_base;
30901 int ret_val;
30902 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30903 int n_reader;
30904 int prop; /* the xmlParserProperties to set */
30905 int n_prop;
30906 int value; /* usually 0 or 1 to (de)activate it */
30907 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030908
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030909 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30910 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30911 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030913 reader = gen_xmlTextReaderPtr(n_reader, 0);
30914 prop = gen_int(n_prop, 1);
30915 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030916
30917 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30918 desret_int(ret_val);
30919 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030920 des_xmlTextReaderPtr(n_reader, reader, 0);
30921 des_int(n_prop, prop, 1);
30922 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030923 xmlResetLastError();
30924 if (mem_base != xmlMemBlocks()) {
30925 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030927 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030928 printf(" %d", n_reader);
30929 printf(" %d", n_prop);
30930 printf(" %d", n_value);
30931 printf("\n");
30932 }
30933 }
30934 }
30935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030936 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030937#endif
30938
Daniel Veillard42595322004-11-08 10:52:06 +000030939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030940}
30941
30942
30943static int
30944test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030946
30947
30948 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030950}
30951
30952
30953static int
30954test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030956
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030957#ifdef LIBXML_READER_ENABLED
30958 int mem_base;
30959 int ret_val;
30960 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30961 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030962
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030963 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30964 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030965 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030966
30967 ret_val = xmlTextReaderStandalone(reader);
30968 desret_int(ret_val);
30969 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030970 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030971 xmlResetLastError();
30972 if (mem_base != xmlMemBlocks()) {
30973 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030975 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030976 printf(" %d", n_reader);
30977 printf("\n");
30978 }
30979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030980 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030981#endif
30982
Daniel Veillard42595322004-11-08 10:52:06 +000030983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030984}
30985
30986
30987static int
30988test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030990
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030991#ifdef LIBXML_READER_ENABLED
30992 int mem_base;
30993 xmlChar * ret_val;
30994 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30995 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030996
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030997 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30998 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030999 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031000
31001 ret_val = xmlTextReaderValue(reader);
31002 desret_xmlChar_ptr(ret_val);
31003 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031004 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031005 xmlResetLastError();
31006 if (mem_base != xmlMemBlocks()) {
31007 printf("Leak of %d blocks found in xmlTextReaderValue",
31008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031009 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031010 printf(" %d", n_reader);
31011 printf("\n");
31012 }
31013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031014 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031015#endif
31016
Daniel Veillard42595322004-11-08 10:52:06 +000031017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031018}
31019
31020
31021static int
31022test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031024
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031025#ifdef LIBXML_READER_ENABLED
31026 int mem_base;
31027 xmlChar * ret_val;
31028 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31029 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031030
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031031 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031033 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031034
31035 ret_val = xmlTextReaderXmlLang(reader);
31036 desret_xmlChar_ptr(ret_val);
31037 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031038 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031039 xmlResetLastError();
31040 if (mem_base != xmlMemBlocks()) {
31041 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031043 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031044 printf(" %d", n_reader);
31045 printf("\n");
31046 }
31047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031048 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031049#endif
31050
Daniel Veillard42595322004-11-08 10:52:06 +000031051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031052}
31053
31054static int
31055test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031057
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031058 if (quiet == 0) printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031059 test_ret += test_xmlNewTextReader();
31060 test_ret += test_xmlNewTextReaderFilename();
31061 test_ret += test_xmlReaderForDoc();
31062 test_ret += test_xmlReaderForFile();
31063 test_ret += test_xmlReaderForMemory();
31064 test_ret += test_xmlReaderNewDoc();
31065 test_ret += test_xmlReaderNewFile();
31066 test_ret += test_xmlReaderNewMemory();
31067 test_ret += test_xmlReaderNewWalker();
31068 test_ret += test_xmlReaderWalker();
31069 test_ret += test_xmlTextReaderAttributeCount();
31070 test_ret += test_xmlTextReaderBaseUri();
31071 test_ret += test_xmlTextReaderClose();
31072 test_ret += test_xmlTextReaderConstBaseUri();
31073 test_ret += test_xmlTextReaderConstEncoding();
31074 test_ret += test_xmlTextReaderConstLocalName();
31075 test_ret += test_xmlTextReaderConstName();
31076 test_ret += test_xmlTextReaderConstNamespaceUri();
31077 test_ret += test_xmlTextReaderConstPrefix();
31078 test_ret += test_xmlTextReaderConstString();
31079 test_ret += test_xmlTextReaderConstValue();
31080 test_ret += test_xmlTextReaderConstXmlLang();
31081 test_ret += test_xmlTextReaderConstXmlVersion();
31082 test_ret += test_xmlTextReaderCurrentDoc();
31083 test_ret += test_xmlTextReaderCurrentNode();
31084 test_ret += test_xmlTextReaderDepth();
31085 test_ret += test_xmlTextReaderExpand();
31086 test_ret += test_xmlTextReaderGetAttribute();
31087 test_ret += test_xmlTextReaderGetAttributeNo();
31088 test_ret += test_xmlTextReaderGetAttributeNs();
31089 test_ret += test_xmlTextReaderGetErrorHandler();
31090 test_ret += test_xmlTextReaderGetParserProp();
31091 test_ret += test_xmlTextReaderGetRemainder();
31092 test_ret += test_xmlTextReaderHasAttributes();
31093 test_ret += test_xmlTextReaderHasValue();
31094 test_ret += test_xmlTextReaderIsDefault();
31095 test_ret += test_xmlTextReaderIsEmptyElement();
31096 test_ret += test_xmlTextReaderIsNamespaceDecl();
31097 test_ret += test_xmlTextReaderIsValid();
31098 test_ret += test_xmlTextReaderLocalName();
31099 test_ret += test_xmlTextReaderLocatorBaseURI();
31100 test_ret += test_xmlTextReaderLocatorLineNumber();
31101 test_ret += test_xmlTextReaderLookupNamespace();
31102 test_ret += test_xmlTextReaderMoveToAttribute();
31103 test_ret += test_xmlTextReaderMoveToAttributeNo();
31104 test_ret += test_xmlTextReaderMoveToAttributeNs();
31105 test_ret += test_xmlTextReaderMoveToElement();
31106 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31107 test_ret += test_xmlTextReaderMoveToNextAttribute();
31108 test_ret += test_xmlTextReaderName();
31109 test_ret += test_xmlTextReaderNamespaceUri();
31110 test_ret += test_xmlTextReaderNext();
31111 test_ret += test_xmlTextReaderNextSibling();
31112 test_ret += test_xmlTextReaderNodeType();
31113 test_ret += test_xmlTextReaderNormalization();
31114 test_ret += test_xmlTextReaderPrefix();
31115 test_ret += test_xmlTextReaderPreserve();
31116 test_ret += test_xmlTextReaderPreservePattern();
31117 test_ret += test_xmlTextReaderQuoteChar();
31118 test_ret += test_xmlTextReaderRead();
31119 test_ret += test_xmlTextReaderReadAttributeValue();
31120 test_ret += test_xmlTextReaderReadState();
31121 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31122 test_ret += test_xmlTextReaderRelaxNGValidate();
31123 test_ret += test_xmlTextReaderSetErrorHandler();
31124 test_ret += test_xmlTextReaderSetParserProp();
31125 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31126 test_ret += test_xmlTextReaderStandalone();
31127 test_ret += test_xmlTextReaderValue();
31128 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031129
Daniel Veillard42595322004-11-08 10:52:06 +000031130 if (test_ret != 0)
31131 printf("Module xmlreader: %d errors\n", test_ret);
31132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031133}
Daniel Veillarda521d282004-11-09 14:59:59 +000031134#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031135
Daniel Veillarda82b1822004-11-08 16:24:57 +000031136#define gen_nb_xmlRegExecCtxtPtr 1
31137static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31138 return(NULL);
31139}
31140static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31141}
Daniel Veillarda521d282004-11-09 14:59:59 +000031142#endif
31143
Daniel Veillarda82b1822004-11-08 16:24:57 +000031144
31145static int
31146test_xmlRegExecPushString(void) {
31147 int test_ret = 0;
31148
31149#ifdef LIBXML_REGEXP_ENABLED
31150 int mem_base;
31151 int ret_val;
31152 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31153 int n_exec;
31154 xmlChar * value; /* a string token input */
31155 int n_value;
31156 void * data; /* data associated to the token to reuse in callbacks */
31157 int n_data;
31158
31159 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31160 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31161 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31162 mem_base = xmlMemBlocks();
31163 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31164 value = gen_const_xmlChar_ptr(n_value, 1);
31165 data = gen_userdata(n_data, 2);
31166
William M. Brackf13f77f2004-11-12 16:03:48 +000031167 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031168 desret_int(ret_val);
31169 call_tests++;
31170 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031171 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031172 des_userdata(n_data, data, 2);
31173 xmlResetLastError();
31174 if (mem_base != xmlMemBlocks()) {
31175 printf("Leak of %d blocks found in xmlRegExecPushString",
31176 xmlMemBlocks() - mem_base);
31177 test_ret++;
31178 printf(" %d", n_exec);
31179 printf(" %d", n_value);
31180 printf(" %d", n_data);
31181 printf("\n");
31182 }
31183 }
31184 }
31185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031186 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031187#endif
31188
Daniel Veillarda82b1822004-11-08 16:24:57 +000031189 return(test_ret);
31190}
31191
31192
31193static int
31194test_xmlRegExecPushString2(void) {
31195 int test_ret = 0;
31196
31197#ifdef LIBXML_REGEXP_ENABLED
31198 int mem_base;
31199 int ret_val;
31200 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31201 int n_exec;
31202 xmlChar * value; /* the first string token input */
31203 int n_value;
31204 xmlChar * value2; /* the second string token input */
31205 int n_value2;
31206 void * data; /* data associated to the token to reuse in callbacks */
31207 int n_data;
31208
31209 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31210 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31211 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31212 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31213 mem_base = xmlMemBlocks();
31214 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31215 value = gen_const_xmlChar_ptr(n_value, 1);
31216 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31217 data = gen_userdata(n_data, 3);
31218
William M. Brackf13f77f2004-11-12 16:03:48 +000031219 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031220 desret_int(ret_val);
31221 call_tests++;
31222 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031223 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31224 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031225 des_userdata(n_data, data, 3);
31226 xmlResetLastError();
31227 if (mem_base != xmlMemBlocks()) {
31228 printf("Leak of %d blocks found in xmlRegExecPushString2",
31229 xmlMemBlocks() - mem_base);
31230 test_ret++;
31231 printf(" %d", n_exec);
31232 printf(" %d", n_value);
31233 printf(" %d", n_value2);
31234 printf(" %d", n_data);
31235 printf("\n");
31236 }
31237 }
31238 }
31239 }
31240 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031241 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031242#endif
31243
Daniel Veillarda82b1822004-11-08 16:24:57 +000031244 return(test_ret);
31245}
31246
Daniel Veillarda521d282004-11-09 14:59:59 +000031247#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031248
31249#define gen_nb_xmlRegexpPtr 1
31250static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31251 return(NULL);
31252}
31253static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31254}
Daniel Veillarda521d282004-11-09 14:59:59 +000031255#endif
31256
Daniel Veillarda82b1822004-11-08 16:24:57 +000031257
31258static int
31259test_xmlRegNewExecCtxt(void) {
31260 int test_ret = 0;
31261
31262
31263 /* missing type support */
31264 return(test_ret);
31265}
31266
31267
31268static int
31269test_xmlRegexpCompile(void) {
31270 int test_ret = 0;
31271
31272
31273 /* missing type support */
31274 return(test_ret);
31275}
31276
31277
31278static int
31279test_xmlRegexpExec(void) {
31280 int test_ret = 0;
31281
31282#ifdef LIBXML_REGEXP_ENABLED
31283 int mem_base;
31284 int ret_val;
31285 xmlRegexpPtr comp; /* the compiled regular expression */
31286 int n_comp;
31287 xmlChar * content; /* the value to check against the regular expression */
31288 int n_content;
31289
31290 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31291 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31292 mem_base = xmlMemBlocks();
31293 comp = gen_xmlRegexpPtr(n_comp, 0);
31294 content = gen_const_xmlChar_ptr(n_content, 1);
31295
William M. Brackf13f77f2004-11-12 16:03:48 +000031296 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031297 desret_int(ret_val);
31298 call_tests++;
31299 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031300 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031301 xmlResetLastError();
31302 if (mem_base != xmlMemBlocks()) {
31303 printf("Leak of %d blocks found in xmlRegexpExec",
31304 xmlMemBlocks() - mem_base);
31305 test_ret++;
31306 printf(" %d", n_comp);
31307 printf(" %d", n_content);
31308 printf("\n");
31309 }
31310 }
31311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031312 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031313#endif
31314
Daniel Veillarda82b1822004-11-08 16:24:57 +000031315 return(test_ret);
31316}
31317
31318
31319static int
31320test_xmlRegexpIsDeterminist(void) {
31321 int test_ret = 0;
31322
31323#ifdef LIBXML_REGEXP_ENABLED
31324 int mem_base;
31325 int ret_val;
31326 xmlRegexpPtr comp; /* the compiled regular expression */
31327 int n_comp;
31328
31329 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31330 mem_base = xmlMemBlocks();
31331 comp = gen_xmlRegexpPtr(n_comp, 0);
31332
31333 ret_val = xmlRegexpIsDeterminist(comp);
31334 desret_int(ret_val);
31335 call_tests++;
31336 des_xmlRegexpPtr(n_comp, comp, 0);
31337 xmlResetLastError();
31338 if (mem_base != xmlMemBlocks()) {
31339 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31340 xmlMemBlocks() - mem_base);
31341 test_ret++;
31342 printf(" %d", n_comp);
31343 printf("\n");
31344 }
31345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031346 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031347#endif
31348
Daniel Veillarda82b1822004-11-08 16:24:57 +000031349 return(test_ret);
31350}
31351
31352
31353static int
31354test_xmlRegexpPrint(void) {
31355 int test_ret = 0;
31356
31357#ifdef LIBXML_REGEXP_ENABLED
31358 int mem_base;
31359 FILE * output; /* the file for the output debug */
31360 int n_output;
31361 xmlRegexpPtr regexp; /* the compiled regexp */
31362 int n_regexp;
31363
31364 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31365 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31366 mem_base = xmlMemBlocks();
31367 output = gen_FILE_ptr(n_output, 0);
31368 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31369
31370 xmlRegexpPrint(output, regexp);
31371 call_tests++;
31372 des_FILE_ptr(n_output, output, 0);
31373 des_xmlRegexpPtr(n_regexp, regexp, 1);
31374 xmlResetLastError();
31375 if (mem_base != xmlMemBlocks()) {
31376 printf("Leak of %d blocks found in xmlRegexpPrint",
31377 xmlMemBlocks() - mem_base);
31378 test_ret++;
31379 printf(" %d", n_output);
31380 printf(" %d", n_regexp);
31381 printf("\n");
31382 }
31383 }
31384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031385 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031386#endif
31387
Daniel Veillarda82b1822004-11-08 16:24:57 +000031388 return(test_ret);
31389}
31390
31391static int
31392test_xmlregexp(void) {
31393 int test_ret = 0;
31394
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031395 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031396 test_ret += test_xmlRegExecPushString();
31397 test_ret += test_xmlRegExecPushString2();
31398 test_ret += test_xmlRegNewExecCtxt();
31399 test_ret += test_xmlRegexpCompile();
31400 test_ret += test_xmlRegexpExec();
31401 test_ret += test_xmlRegexpIsDeterminist();
31402 test_ret += test_xmlRegexpPrint();
31403
31404 if (test_ret != 0)
31405 printf("Module xmlregexp: %d errors\n", test_ret);
31406 return(test_ret);
31407}
Daniel Veillarda521d282004-11-09 14:59:59 +000031408#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031409
Daniel Veillardce682bc2004-11-05 17:22:25 +000031410#define gen_nb_xmlSaveCtxtPtr 1
31411static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31412 return(NULL);
31413}
31414static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31415}
Daniel Veillarda521d282004-11-09 14:59:59 +000031416#endif
31417
Daniel Veillardce682bc2004-11-05 17:22:25 +000031418
Daniel Veillardd93f6252004-11-02 15:53:51 +000031419static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031420test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031422
Daniel Veillardce682bc2004-11-05 17:22:25 +000031423#ifdef LIBXML_OUTPUT_ENABLED
31424 int mem_base;
31425 int ret_val;
31426 xmlSaveCtxtPtr ctxt; /* a document saving context */
31427 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031428
Daniel Veillardce682bc2004-11-05 17:22:25 +000031429 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31430 mem_base = xmlMemBlocks();
31431 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31432
31433 ret_val = xmlSaveClose(ctxt);
31434 desret_int(ret_val);
31435 call_tests++;
31436 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31437 xmlResetLastError();
31438 if (mem_base != xmlMemBlocks()) {
31439 printf("Leak of %d blocks found in xmlSaveClose",
31440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031441 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031442 printf(" %d", n_ctxt);
31443 printf("\n");
31444 }
31445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031446 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031447#endif
31448
Daniel Veillard42595322004-11-08 10:52:06 +000031449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031450}
31451
31452
31453static int
31454test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031456
Daniel Veillardce682bc2004-11-05 17:22:25 +000031457#ifdef LIBXML_OUTPUT_ENABLED
31458 int mem_base;
31459 long ret_val;
31460 xmlSaveCtxtPtr ctxt; /* a document saving context */
31461 int n_ctxt;
31462 xmlDocPtr doc; /* a document */
31463 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031464
Daniel Veillardce682bc2004-11-05 17:22:25 +000031465 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31466 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31467 mem_base = xmlMemBlocks();
31468 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31469 doc = gen_xmlDocPtr(n_doc, 1);
31470
31471 ret_val = xmlSaveDoc(ctxt, doc);
31472 desret_long(ret_val);
31473 call_tests++;
31474 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31475 des_xmlDocPtr(n_doc, doc, 1);
31476 xmlResetLastError();
31477 if (mem_base != xmlMemBlocks()) {
31478 printf("Leak of %d blocks found in xmlSaveDoc",
31479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031481 printf(" %d", n_ctxt);
31482 printf(" %d", n_doc);
31483 printf("\n");
31484 }
31485 }
31486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031487 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031488#endif
31489
Daniel Veillard42595322004-11-08 10:52:06 +000031490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031491}
31492
31493
31494static int
31495test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031497
Daniel Veillardce682bc2004-11-05 17:22:25 +000031498#ifdef LIBXML_OUTPUT_ENABLED
31499 int mem_base;
31500 int ret_val;
31501 xmlSaveCtxtPtr ctxt; /* a document saving context */
31502 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031503
Daniel Veillardce682bc2004-11-05 17:22:25 +000031504 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31505 mem_base = xmlMemBlocks();
31506 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31507
31508 ret_val = xmlSaveFlush(ctxt);
31509 desret_int(ret_val);
31510 call_tests++;
31511 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31512 xmlResetLastError();
31513 if (mem_base != xmlMemBlocks()) {
31514 printf("Leak of %d blocks found in xmlSaveFlush",
31515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031516 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031517 printf(" %d", n_ctxt);
31518 printf("\n");
31519 }
31520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031521 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031522#endif
31523
Daniel Veillard42595322004-11-08 10:52:06 +000031524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031525}
31526
31527
31528static int
31529test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031531
31532
31533 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031535}
31536
31537
31538static int
31539test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031541
31542
31543 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031545}
31546
31547
31548static int
31549test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031551
31552
31553 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031555}
31556
31557
31558static int
31559test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031560 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031561
31562
31563 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031565}
31566
31567
31568static int
31569test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031571
Daniel Veillardce682bc2004-11-05 17:22:25 +000031572#ifdef LIBXML_OUTPUT_ENABLED
31573 int mem_base;
31574 long ret_val;
31575 xmlSaveCtxtPtr ctxt; /* a document saving context */
31576 int n_ctxt;
31577 xmlNodePtr node; /* a document */
31578 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031579
Daniel Veillardce682bc2004-11-05 17:22:25 +000031580 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31581 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31582 mem_base = xmlMemBlocks();
31583 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31584 node = gen_xmlNodePtr(n_node, 1);
31585
31586 ret_val = xmlSaveTree(ctxt, node);
31587 desret_long(ret_val);
31588 call_tests++;
31589 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31590 des_xmlNodePtr(n_node, node, 1);
31591 xmlResetLastError();
31592 if (mem_base != xmlMemBlocks()) {
31593 printf("Leak of %d blocks found in xmlSaveTree",
31594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031595 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031596 printf(" %d", n_ctxt);
31597 printf(" %d", n_node);
31598 printf("\n");
31599 }
31600 }
31601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031602 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031603#endif
31604
Daniel Veillard42595322004-11-08 10:52:06 +000031605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031606}
31607
31608static int
31609test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031611
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031612 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031613 test_ret += test_xmlSaveClose();
31614 test_ret += test_xmlSaveDoc();
31615 test_ret += test_xmlSaveFlush();
31616 test_ret += test_xmlSaveSetAttrEscape();
31617 test_ret += test_xmlSaveSetEscape();
31618 test_ret += test_xmlSaveToFd();
31619 test_ret += test_xmlSaveToFilename();
31620 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031621
Daniel Veillard42595322004-11-08 10:52:06 +000031622 if (test_ret != 0)
31623 printf("Module xmlsave: %d errors\n", test_ret);
31624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031625}
Daniel Veillarda521d282004-11-09 14:59:59 +000031626#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031627
Daniel Veillardce682bc2004-11-05 17:22:25 +000031628#define gen_nb_xmlSchemaPtr 1
31629static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31630 return(NULL);
31631}
31632static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31633}
Daniel Veillarda521d282004-11-09 14:59:59 +000031634#endif
31635
Daniel Veillardce682bc2004-11-05 17:22:25 +000031636
Daniel Veillardd93f6252004-11-02 15:53:51 +000031637static int
31638test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031640
Daniel Veillardce682bc2004-11-05 17:22:25 +000031641#ifdef LIBXML_SCHEMAS_ENABLED
31642#ifdef LIBXML_OUTPUT_ENABLED
31643 int mem_base;
31644 FILE * output; /* the file output */
31645 int n_output;
31646 xmlSchemaPtr schema; /* a schema structure */
31647 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031648
Daniel Veillardce682bc2004-11-05 17:22:25 +000031649 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31650 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31651 mem_base = xmlMemBlocks();
31652 output = gen_FILE_ptr(n_output, 0);
31653 schema = gen_xmlSchemaPtr(n_schema, 1);
31654
31655 xmlSchemaDump(output, schema);
31656 call_tests++;
31657 des_FILE_ptr(n_output, output, 0);
31658 des_xmlSchemaPtr(n_schema, schema, 1);
31659 xmlResetLastError();
31660 if (mem_base != xmlMemBlocks()) {
31661 printf("Leak of %d blocks found in xmlSchemaDump",
31662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031663 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031664 printf(" %d", n_output);
31665 printf(" %d", n_schema);
31666 printf("\n");
31667 }
31668 }
31669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031670 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031671#endif
31672#endif
31673
Daniel Veillard42595322004-11-08 10:52:06 +000031674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031675}
31676
Daniel Veillarda521d282004-11-09 14:59:59 +000031677#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031678
Daniel Veillardce682bc2004-11-05 17:22:25 +000031679#define gen_nb_xmlSchemaParserCtxtPtr 1
31680static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31681 return(NULL);
31682}
31683static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31684}
Daniel Veillarda521d282004-11-09 14:59:59 +000031685#endif
31686
31687#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031688
31689#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31690static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31691 return(NULL);
31692}
31693static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31694}
Daniel Veillarda521d282004-11-09 14:59:59 +000031695#endif
31696
31697#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031698
31699#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31700static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31701 return(NULL);
31702}
31703static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31704}
Daniel Veillarda521d282004-11-09 14:59:59 +000031705#endif
31706
Daniel Veillardce682bc2004-11-05 17:22:25 +000031707
Daniel Veillardd93f6252004-11-02 15:53:51 +000031708static int
31709test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031711
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031712#ifdef LIBXML_SCHEMAS_ENABLED
31713 int mem_base;
31714 int ret_val;
31715 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31716 int n_ctxt;
31717 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31718 int n_err;
31719 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31720 int n_warn;
31721 void ** ctx; /* contextual data for the callbacks result */
31722 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031723
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031724 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31725 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31726 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31727 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31728 mem_base = xmlMemBlocks();
31729 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31730 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31731 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31732 ctx = gen_void_ptr_ptr(n_ctx, 3);
31733
31734 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31735 desret_int(ret_val);
31736 call_tests++;
31737 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31738 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31739 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31740 des_void_ptr_ptr(n_ctx, ctx, 3);
31741 xmlResetLastError();
31742 if (mem_base != xmlMemBlocks()) {
31743 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031745 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031746 printf(" %d", n_ctxt);
31747 printf(" %d", n_err);
31748 printf(" %d", n_warn);
31749 printf(" %d", n_ctx);
31750 printf("\n");
31751 }
31752 }
31753 }
31754 }
31755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031756 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031757#endif
31758
Daniel Veillard42595322004-11-08 10:52:06 +000031759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031760}
31761
Daniel Veillarda521d282004-11-09 14:59:59 +000031762#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031763
Daniel Veillardce682bc2004-11-05 17:22:25 +000031764#define gen_nb_xmlSchemaValidCtxtPtr 1
31765static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31766 return(NULL);
31767}
31768static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31769}
Daniel Veillarda521d282004-11-09 14:59:59 +000031770#endif
31771
Daniel Veillardce682bc2004-11-05 17:22:25 +000031772
Daniel Veillardd93f6252004-11-02 15:53:51 +000031773static int
31774test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031776
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031777#ifdef LIBXML_SCHEMAS_ENABLED
31778 int mem_base;
31779 int ret_val;
31780 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31781 int n_ctxt;
31782 xmlSchemaValidityErrorFunc * err; /* the error function result */
31783 int n_err;
31784 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31785 int n_warn;
31786 void ** ctx; /* the functions context result */
31787 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031788
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031789 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31790 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31791 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31792 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31793 mem_base = xmlMemBlocks();
31794 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31795 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31796 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31797 ctx = gen_void_ptr_ptr(n_ctx, 3);
31798
31799 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31800 desret_int(ret_val);
31801 call_tests++;
31802 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31803 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31804 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31805 des_void_ptr_ptr(n_ctx, ctx, 3);
31806 xmlResetLastError();
31807 if (mem_base != xmlMemBlocks()) {
31808 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031810 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031811 printf(" %d", n_ctxt);
31812 printf(" %d", n_err);
31813 printf(" %d", n_warn);
31814 printf(" %d", n_ctx);
31815 printf("\n");
31816 }
31817 }
31818 }
31819 }
31820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031821 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031822#endif
31823
Daniel Veillard42595322004-11-08 10:52:06 +000031824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031825}
31826
31827
31828static int
31829test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031830 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031831
Daniel Veillard42595322004-11-08 10:52:06 +000031832#ifdef LIBXML_SCHEMAS_ENABLED
31833 int mem_base;
31834 xmlSchemaParserCtxtPtr ret_val;
31835 xmlDocPtr doc; /* a preparsed document tree */
31836 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031837
Daniel Veillard42595322004-11-08 10:52:06 +000031838 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31839 mem_base = xmlMemBlocks();
31840 doc = gen_xmlDocPtr(n_doc, 0);
31841
31842 ret_val = xmlSchemaNewDocParserCtxt(doc);
31843 desret_xmlSchemaParserCtxtPtr(ret_val);
31844 call_tests++;
31845 des_xmlDocPtr(n_doc, doc, 0);
31846 xmlResetLastError();
31847 if (mem_base != xmlMemBlocks()) {
31848 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31849 xmlMemBlocks() - mem_base);
31850 test_ret++;
31851 printf(" %d", n_doc);
31852 printf("\n");
31853 }
31854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031855 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031856#endif
31857
Daniel Veillard42595322004-11-08 10:52:06 +000031858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031859}
31860
31861
31862static int
31863test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031865
Daniel Veillard42595322004-11-08 10:52:06 +000031866#ifdef LIBXML_SCHEMAS_ENABLED
31867 int mem_base;
31868 xmlSchemaParserCtxtPtr ret_val;
31869 char * buffer; /* a pointer to a char array containing the schemas */
31870 int n_buffer;
31871 int size; /* the size of the array */
31872 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031873
Daniel Veillard42595322004-11-08 10:52:06 +000031874 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31875 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31876 mem_base = xmlMemBlocks();
31877 buffer = gen_const_char_ptr(n_buffer, 0);
31878 size = gen_int(n_size, 1);
31879
William M. Brackf13f77f2004-11-12 16:03:48 +000031880 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000031881 desret_xmlSchemaParserCtxtPtr(ret_val);
31882 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031883 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031884 des_int(n_size, size, 1);
31885 xmlResetLastError();
31886 if (mem_base != xmlMemBlocks()) {
31887 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31888 xmlMemBlocks() - mem_base);
31889 test_ret++;
31890 printf(" %d", n_buffer);
31891 printf(" %d", n_size);
31892 printf("\n");
31893 }
31894 }
31895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031896 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031897#endif
31898
Daniel Veillard42595322004-11-08 10:52:06 +000031899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031900}
31901
31902
31903static int
31904test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031906
Daniel Veillard42595322004-11-08 10:52:06 +000031907#ifdef LIBXML_SCHEMAS_ENABLED
31908 int mem_base;
31909 xmlSchemaParserCtxtPtr ret_val;
31910 char * URL; /* the location of the schema */
31911 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031912
Daniel Veillard42595322004-11-08 10:52:06 +000031913 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31914 mem_base = xmlMemBlocks();
31915 URL = gen_const_char_ptr(n_URL, 0);
31916
William M. Brackf13f77f2004-11-12 16:03:48 +000031917 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000031918 desret_xmlSchemaParserCtxtPtr(ret_val);
31919 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031920 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031921 xmlResetLastError();
31922 if (mem_base != xmlMemBlocks()) {
31923 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31924 xmlMemBlocks() - mem_base);
31925 test_ret++;
31926 printf(" %d", n_URL);
31927 printf("\n");
31928 }
31929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031930 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031931#endif
31932
Daniel Veillard42595322004-11-08 10:52:06 +000031933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031934}
31935
31936
31937static int
31938test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031940
31941
31942 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031944}
31945
31946
31947static int
31948test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031950
31951
31952 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031954}
31955
31956
31957static int
31958test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031960
31961
31962 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031964}
31965
31966
31967static int
31968test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031970
31971
31972 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031974}
31975
31976
31977static int
31978test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031980
Daniel Veillardce682bc2004-11-05 17:22:25 +000031981#ifdef LIBXML_SCHEMAS_ENABLED
31982 int mem_base;
31983 int ret_val;
31984 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31985 int n_ctxt;
31986 int options; /* a combination of xmlSchemaValidOption */
31987 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031988
Daniel Veillardce682bc2004-11-05 17:22:25 +000031989 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31990 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31991 mem_base = xmlMemBlocks();
31992 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31993 options = gen_int(n_options, 1);
31994
31995 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31996 desret_int(ret_val);
31997 call_tests++;
31998 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31999 des_int(n_options, options, 1);
32000 xmlResetLastError();
32001 if (mem_base != xmlMemBlocks()) {
32002 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032004 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032005 printf(" %d", n_ctxt);
32006 printf(" %d", n_options);
32007 printf("\n");
32008 }
32009 }
32010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032011 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032012#endif
32013
Daniel Veillard42595322004-11-08 10:52:06 +000032014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032015}
32016
32017
32018static int
32019test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032021
Daniel Veillardce682bc2004-11-05 17:22:25 +000032022#ifdef LIBXML_SCHEMAS_ENABLED
32023 int mem_base;
32024 int ret_val;
32025 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32026 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032027
Daniel Veillardce682bc2004-11-05 17:22:25 +000032028 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32029 mem_base = xmlMemBlocks();
32030 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32031
32032 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32033 desret_int(ret_val);
32034 call_tests++;
32035 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32036 xmlResetLastError();
32037 if (mem_base != xmlMemBlocks()) {
32038 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032040 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032041 printf(" %d", n_ctxt);
32042 printf("\n");
32043 }
32044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032045 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032046#endif
32047
Daniel Veillard42595322004-11-08 10:52:06 +000032048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032049}
32050
32051
32052static int
32053test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032055
Daniel Veillardce682bc2004-11-05 17:22:25 +000032056#ifdef LIBXML_SCHEMAS_ENABLED
32057 int mem_base;
32058 int ret_val;
32059 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32060 int n_ctxt;
32061 xmlDocPtr doc; /* a parsed document tree */
32062 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032063
Daniel Veillardce682bc2004-11-05 17:22:25 +000032064 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32065 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32066 mem_base = xmlMemBlocks();
32067 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32068 doc = gen_xmlDocPtr(n_doc, 1);
32069
32070 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32071 desret_int(ret_val);
32072 call_tests++;
32073 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32074 des_xmlDocPtr(n_doc, doc, 1);
32075 xmlResetLastError();
32076 if (mem_base != xmlMemBlocks()) {
32077 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032079 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032080 printf(" %d", n_ctxt);
32081 printf(" %d", n_doc);
32082 printf("\n");
32083 }
32084 }
32085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032086 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032087#endif
32088
Daniel Veillard42595322004-11-08 10:52:06 +000032089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032090}
32091
32092
32093static int
32094test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032096
Daniel Veillardce682bc2004-11-05 17:22:25 +000032097#ifdef LIBXML_SCHEMAS_ENABLED
32098 int mem_base;
32099 int ret_val;
32100 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32101 int n_ctxt;
32102 xmlNodePtr elem; /* an element node */
32103 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032104
Daniel Veillardce682bc2004-11-05 17:22:25 +000032105 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32106 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32107 mem_base = xmlMemBlocks();
32108 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32109 elem = gen_xmlNodePtr(n_elem, 1);
32110
32111 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32112 desret_int(ret_val);
32113 call_tests++;
32114 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32115 des_xmlNodePtr(n_elem, elem, 1);
32116 xmlResetLastError();
32117 if (mem_base != xmlMemBlocks()) {
32118 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032120 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032121 printf(" %d", n_ctxt);
32122 printf(" %d", n_elem);
32123 printf("\n");
32124 }
32125 }
32126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032127 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032128#endif
32129
Daniel Veillard42595322004-11-08 10:52:06 +000032130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032131}
32132
32133
32134static int
32135test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032137
Daniel Veillardce682bc2004-11-05 17:22:25 +000032138#ifdef LIBXML_SCHEMAS_ENABLED
32139 int mem_base;
32140 int ret_val;
32141 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32142 int n_ctxt;
32143 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32144 int n_input;
32145 xmlCharEncoding enc; /* an optional encoding information */
32146 int n_enc;
32147 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32148 int n_sax;
32149 void * user_data; /* the context to provide to the SAX handler. */
32150 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032151
Daniel Veillardce682bc2004-11-05 17:22:25 +000032152 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32153 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32154 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32155 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32156 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32157 mem_base = xmlMemBlocks();
32158 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32159 input = gen_xmlParserInputBufferPtr(n_input, 1);
32160 enc = gen_xmlCharEncoding(n_enc, 2);
32161 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32162 user_data = gen_userdata(n_user_data, 4);
32163
32164 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32165 desret_int(ret_val);
32166 call_tests++;
32167 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32168 des_xmlParserInputBufferPtr(n_input, input, 1);
32169 des_xmlCharEncoding(n_enc, enc, 2);
32170 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32171 des_userdata(n_user_data, user_data, 4);
32172 xmlResetLastError();
32173 if (mem_base != xmlMemBlocks()) {
32174 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032176 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032177 printf(" %d", n_ctxt);
32178 printf(" %d", n_input);
32179 printf(" %d", n_enc);
32180 printf(" %d", n_sax);
32181 printf(" %d", n_user_data);
32182 printf("\n");
32183 }
32184 }
32185 }
32186 }
32187 }
32188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032189 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032190#endif
32191
Daniel Veillard42595322004-11-08 10:52:06 +000032192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032193}
32194
32195static int
32196test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032198
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032199 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032200 test_ret += test_xmlSchemaDump();
32201 test_ret += test_xmlSchemaGetParserErrors();
32202 test_ret += test_xmlSchemaGetValidErrors();
32203 test_ret += test_xmlSchemaNewDocParserCtxt();
32204 test_ret += test_xmlSchemaNewMemParserCtxt();
32205 test_ret += test_xmlSchemaNewParserCtxt();
32206 test_ret += test_xmlSchemaNewValidCtxt();
32207 test_ret += test_xmlSchemaParse();
32208 test_ret += test_xmlSchemaSetParserErrors();
32209 test_ret += test_xmlSchemaSetValidErrors();
32210 test_ret += test_xmlSchemaSetValidOptions();
32211 test_ret += test_xmlSchemaValidCtxtGetOptions();
32212 test_ret += test_xmlSchemaValidateDoc();
32213 test_ret += test_xmlSchemaValidateOneElement();
32214 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032215
Daniel Veillard42595322004-11-08 10:52:06 +000032216 if (test_ret != 0)
32217 printf("Module xmlschemas: %d errors\n", test_ret);
32218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032219}
Daniel Veillarda521d282004-11-09 14:59:59 +000032220#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032221
Daniel Veillardce682bc2004-11-05 17:22:25 +000032222#define gen_nb_xmlSchemaFacetPtr 1
32223static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32224 return(NULL);
32225}
32226static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32227}
Daniel Veillarda521d282004-11-09 14:59:59 +000032228#endif
32229
32230#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032231
32232#define gen_nb_xmlSchemaTypePtr 1
32233static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32234 return(NULL);
32235}
32236static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32237}
Daniel Veillarda521d282004-11-09 14:59:59 +000032238#endif
32239
Daniel Veillardce682bc2004-11-05 17:22:25 +000032240
Daniel Veillardd93f6252004-11-02 15:53:51 +000032241static int
32242test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032244
Daniel Veillardce682bc2004-11-05 17:22:25 +000032245#ifdef LIBXML_SCHEMAS_ENABLED
32246 int mem_base;
32247 int ret_val;
32248 xmlSchemaFacetPtr facet; /* the facet */
32249 int n_facet;
32250 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32251 int n_typeDecl;
32252 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32253 int n_ctxt;
32254 xmlChar * name; /* name of the type */
32255 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032256
Daniel Veillardce682bc2004-11-05 17:22:25 +000032257 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32258 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32259 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32260 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32261 mem_base = xmlMemBlocks();
32262 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32263 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32264 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32265 name = gen_const_xmlChar_ptr(n_name, 3);
32266
William M. Brackf13f77f2004-11-12 16:03:48 +000032267 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032268 desret_int(ret_val);
32269 call_tests++;
32270 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32271 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32272 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032273 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032274 xmlResetLastError();
32275 if (mem_base != xmlMemBlocks()) {
32276 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032278 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032279 printf(" %d", n_facet);
32280 printf(" %d", n_typeDecl);
32281 printf(" %d", n_ctxt);
32282 printf(" %d", n_name);
32283 printf("\n");
32284 }
32285 }
32286 }
32287 }
32288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032289 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032290#endif
32291
Daniel Veillard42595322004-11-08 10:52:06 +000032292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032293}
32294
32295
32296static int
32297test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032299
32300#ifdef LIBXML_SCHEMAS_ENABLED
32301 int mem_base;
32302
32303 mem_base = xmlMemBlocks();
32304
32305 xmlSchemaCleanupTypes();
32306 call_tests++;
32307 xmlResetLastError();
32308 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032309 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032311 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032312 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032314 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032315#endif
32316
Daniel Veillard42595322004-11-08 10:52:06 +000032317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032318}
32319
32320
32321static int
32322test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032324
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032325#ifdef LIBXML_SCHEMAS_ENABLED
32326 int mem_base;
32327 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032328 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032329 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032330
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032331 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032333 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032334
William M. Brackf13f77f2004-11-12 16:03:48 +000032335 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032336 desret_xmlChar_ptr(ret_val);
32337 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032338 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032339 xmlResetLastError();
32340 if (mem_base != xmlMemBlocks()) {
32341 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032343 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032344 printf(" %d", n_value);
32345 printf("\n");
32346 }
32347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032348 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032349#endif
32350
Daniel Veillard42595322004-11-08 10:52:06 +000032351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032352}
32353
Daniel Veillarda521d282004-11-09 14:59:59 +000032354#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032355
Daniel Veillardce682bc2004-11-05 17:22:25 +000032356#define gen_nb_xmlSchemaValPtr 1
32357static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32358 return(NULL);
32359}
32360static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32361}
Daniel Veillarda521d282004-11-09 14:59:59 +000032362#endif
32363
Daniel Veillardce682bc2004-11-05 17:22:25 +000032364
Daniel Veillardd93f6252004-11-02 15:53:51 +000032365static int
32366test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032368
Daniel Veillardce682bc2004-11-05 17:22:25 +000032369#ifdef LIBXML_SCHEMAS_ENABLED
32370 int mem_base;
32371 int ret_val;
32372 xmlSchemaValPtr x; /* a first value */
32373 int n_x;
32374 xmlSchemaValPtr y; /* a second value */
32375 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032376
Daniel Veillardce682bc2004-11-05 17:22:25 +000032377 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32378 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32379 mem_base = xmlMemBlocks();
32380 x = gen_xmlSchemaValPtr(n_x, 0);
32381 y = gen_xmlSchemaValPtr(n_y, 1);
32382
32383 ret_val = xmlSchemaCompareValues(x, y);
32384 desret_int(ret_val);
32385 call_tests++;
32386 des_xmlSchemaValPtr(n_x, x, 0);
32387 des_xmlSchemaValPtr(n_y, y, 1);
32388 xmlResetLastError();
32389 if (mem_base != xmlMemBlocks()) {
32390 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032392 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032393 printf(" %d", n_x);
32394 printf(" %d", n_y);
32395 printf("\n");
32396 }
32397 }
32398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032399 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032400#endif
32401
Daniel Veillard42595322004-11-08 10:52:06 +000032402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032403}
32404
32405
32406static int
32407test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032409
Daniel Veillard42595322004-11-08 10:52:06 +000032410#ifdef LIBXML_SCHEMAS_ENABLED
32411 int mem_base;
32412 xmlSchemaTypePtr ret_val;
32413 xmlSchemaTypePtr type; /* the built-in simple type. */
32414 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032415
Daniel Veillard42595322004-11-08 10:52:06 +000032416 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32417 mem_base = xmlMemBlocks();
32418 type = gen_xmlSchemaTypePtr(n_type, 0);
32419
32420 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32421 desret_xmlSchemaTypePtr(ret_val);
32422 call_tests++;
32423 des_xmlSchemaTypePtr(n_type, type, 0);
32424 xmlResetLastError();
32425 if (mem_base != xmlMemBlocks()) {
32426 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32427 xmlMemBlocks() - mem_base);
32428 test_ret++;
32429 printf(" %d", n_type);
32430 printf("\n");
32431 }
32432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032433 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032434#endif
32435
Daniel Veillard42595322004-11-08 10:52:06 +000032436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032437}
32438
32439
32440static int
32441test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032443
Daniel Veillard42595322004-11-08 10:52:06 +000032444#ifdef LIBXML_SCHEMAS_ENABLED
32445 xmlSchemaTypePtr ret_val;
32446 xmlSchemaValType type; /* the type of the built in type */
32447 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032448
Daniel Veillard42595322004-11-08 10:52:06 +000032449 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32450 type = gen_xmlSchemaValType(n_type, 0);
32451
32452 ret_val = xmlSchemaGetBuiltInType(type);
32453 desret_xmlSchemaTypePtr(ret_val);
32454 call_tests++;
32455 des_xmlSchemaValType(n_type, type, 0);
32456 xmlResetLastError();
32457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032458 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032459#endif
32460
Daniel Veillard42595322004-11-08 10:52:06 +000032461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032462}
32463
32464
32465static int
32466test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032468
32469
32470 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032472}
32473
32474
32475static int
32476test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032478
Daniel Veillard42595322004-11-08 10:52:06 +000032479#ifdef LIBXML_SCHEMAS_ENABLED
32480 int mem_base;
32481 xmlSchemaTypePtr ret_val;
32482 xmlChar * name; /* the type name */
32483 int n_name;
32484 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32485 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032486
Daniel Veillard42595322004-11-08 10:52:06 +000032487 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32488 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32489 mem_base = xmlMemBlocks();
32490 name = gen_const_xmlChar_ptr(n_name, 0);
32491 ns = gen_const_xmlChar_ptr(n_ns, 1);
32492
William M. Brackf13f77f2004-11-12 16:03:48 +000032493 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032494 desret_xmlSchemaTypePtr(ret_val);
32495 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032496 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32497 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032498 xmlResetLastError();
32499 if (mem_base != xmlMemBlocks()) {
32500 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32501 xmlMemBlocks() - mem_base);
32502 test_ret++;
32503 printf(" %d", n_name);
32504 printf(" %d", n_ns);
32505 printf("\n");
32506 }
32507 }
32508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032509 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032510#endif
32511
Daniel Veillard42595322004-11-08 10:52:06 +000032512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032513}
32514
32515
32516static int
32517test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032519
32520#ifdef LIBXML_SCHEMAS_ENABLED
32521
32522
32523 xmlSchemaInitTypes();
32524 call_tests++;
32525 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032526 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032527#endif
32528
Daniel Veillard42595322004-11-08 10:52:06 +000032529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032530}
32531
32532
32533static int
32534test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032536
Daniel Veillardce682bc2004-11-05 17:22:25 +000032537#ifdef LIBXML_SCHEMAS_ENABLED
32538 int mem_base;
32539 int ret_val;
32540 xmlSchemaTypePtr type; /* the built-in type */
32541 int n_type;
32542 int facetType; /* the facet type */
32543 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032544
Daniel Veillardce682bc2004-11-05 17:22:25 +000032545 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32546 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32547 mem_base = xmlMemBlocks();
32548 type = gen_xmlSchemaTypePtr(n_type, 0);
32549 facetType = gen_int(n_facetType, 1);
32550
32551 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32552 desret_int(ret_val);
32553 call_tests++;
32554 des_xmlSchemaTypePtr(n_type, type, 0);
32555 des_int(n_facetType, facetType, 1);
32556 xmlResetLastError();
32557 if (mem_base != xmlMemBlocks()) {
32558 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032560 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032561 printf(" %d", n_type);
32562 printf(" %d", n_facetType);
32563 printf("\n");
32564 }
32565 }
32566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032567 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032568#endif
32569
Daniel Veillard42595322004-11-08 10:52:06 +000032570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032571}
32572
32573
32574static int
32575test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032577
32578
32579 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032581}
32582
Daniel Veillarda521d282004-11-09 14:59:59 +000032583#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032584
Daniel Veillardce682bc2004-11-05 17:22:25 +000032585#define gen_nb_xmlSchemaValPtr_ptr 1
32586static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32587 return(NULL);
32588}
32589static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32590}
Daniel Veillarda521d282004-11-09 14:59:59 +000032591#endif
32592
Daniel Veillardce682bc2004-11-05 17:22:25 +000032593
Daniel Veillardd93f6252004-11-02 15:53:51 +000032594static int
32595test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032597
Daniel Veillardce682bc2004-11-05 17:22:25 +000032598#ifdef LIBXML_SCHEMAS_ENABLED
32599 int mem_base;
32600 int ret_val;
32601 xmlSchemaTypePtr type; /* the predefined type */
32602 int n_type;
32603 xmlChar * value; /* the value to check */
32604 int n_value;
32605 xmlSchemaValPtr * val; /* the return computed value */
32606 int n_val;
32607 xmlNodePtr node; /* the node containing the value */
32608 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032609
Daniel Veillardce682bc2004-11-05 17:22:25 +000032610 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32611 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32612 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32613 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32614 mem_base = xmlMemBlocks();
32615 type = gen_xmlSchemaTypePtr(n_type, 0);
32616 value = gen_const_xmlChar_ptr(n_value, 1);
32617 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32618 node = gen_xmlNodePtr(n_node, 3);
32619
William M. Brackf13f77f2004-11-12 16:03:48 +000032620 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032621 desret_int(ret_val);
32622 call_tests++;
32623 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032624 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032625 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32626 des_xmlNodePtr(n_node, node, 3);
32627 xmlResetLastError();
32628 if (mem_base != xmlMemBlocks()) {
32629 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032631 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032632 printf(" %d", n_type);
32633 printf(" %d", n_value);
32634 printf(" %d", n_val);
32635 printf(" %d", n_node);
32636 printf("\n");
32637 }
32638 }
32639 }
32640 }
32641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032642 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032643#endif
32644
Daniel Veillard42595322004-11-08 10:52:06 +000032645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032646}
32647
32648
32649static int
32650test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032652
Daniel Veillardce682bc2004-11-05 17:22:25 +000032653#ifdef LIBXML_SCHEMAS_ENABLED
32654 int mem_base;
32655 int ret_val;
32656 xmlSchemaTypePtr type; /* the predefined type */
32657 int n_type;
32658 xmlChar * value; /* the value to check */
32659 int n_value;
32660 xmlSchemaValPtr * val; /* the return computed value */
32661 int n_val;
32662 xmlNodePtr node; /* the node containing the value */
32663 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032664
Daniel Veillardce682bc2004-11-05 17:22:25 +000032665 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32666 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32667 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32668 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32669 mem_base = xmlMemBlocks();
32670 type = gen_xmlSchemaTypePtr(n_type, 0);
32671 value = gen_const_xmlChar_ptr(n_value, 1);
32672 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32673 node = gen_xmlNodePtr(n_node, 3);
32674
William M. Brackf13f77f2004-11-12 16:03:48 +000032675 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032676 desret_int(ret_val);
32677 call_tests++;
32678 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032679 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032680 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32681 des_xmlNodePtr(n_node, node, 3);
32682 xmlResetLastError();
32683 if (mem_base != xmlMemBlocks()) {
32684 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032686 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032687 printf(" %d", n_type);
32688 printf(" %d", n_value);
32689 printf(" %d", n_val);
32690 printf(" %d", n_node);
32691 printf("\n");
32692 }
32693 }
32694 }
32695 }
32696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032697 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032698#endif
32699
Daniel Veillard42595322004-11-08 10:52:06 +000032700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032701}
32702
32703
32704static int
32705test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032707
Daniel Veillardce682bc2004-11-05 17:22:25 +000032708#ifdef LIBXML_SCHEMAS_ENABLED
32709 int mem_base;
32710 int ret_val;
32711 xmlSchemaTypePtr base; /* the base type */
32712 int n_base;
32713 xmlSchemaFacetPtr facet; /* the facet to check */
32714 int n_facet;
32715 xmlChar * value; /* the lexical repr of the value to validate */
32716 int n_value;
32717 xmlSchemaValPtr val; /* the precomputed value */
32718 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032719
Daniel Veillardce682bc2004-11-05 17:22:25 +000032720 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32721 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32722 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32723 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32724 mem_base = xmlMemBlocks();
32725 base = gen_xmlSchemaTypePtr(n_base, 0);
32726 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32727 value = gen_const_xmlChar_ptr(n_value, 2);
32728 val = gen_xmlSchemaValPtr(n_val, 3);
32729
William M. Brackf13f77f2004-11-12 16:03:48 +000032730 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032731 desret_int(ret_val);
32732 call_tests++;
32733 des_xmlSchemaTypePtr(n_base, base, 0);
32734 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032735 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032736 des_xmlSchemaValPtr(n_val, val, 3);
32737 xmlResetLastError();
32738 if (mem_base != xmlMemBlocks()) {
32739 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032741 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032742 printf(" %d", n_base);
32743 printf(" %d", n_facet);
32744 printf(" %d", n_value);
32745 printf(" %d", n_val);
32746 printf("\n");
32747 }
32748 }
32749 }
32750 }
32751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032752 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032753#endif
32754
Daniel Veillard42595322004-11-08 10:52:06 +000032755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032756}
32757
32758
32759static int
32760test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032762
Daniel Veillardce682bc2004-11-05 17:22:25 +000032763#ifdef LIBXML_SCHEMAS_ENABLED
32764 int mem_base;
32765 int ret_val;
32766 xmlSchemaTypePtr type; /* the built-in type */
32767 int n_type;
32768 xmlSchemaFacetPtr facet; /* the facet to check */
32769 int n_facet;
32770 xmlChar * value; /* the lexical repr. of the value to be validated */
32771 int n_value;
32772 xmlSchemaValPtr val; /* the precomputed value */
32773 int n_val;
32774 unsigned long * length; /* the actual length of the value */
32775 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032776
Daniel Veillardce682bc2004-11-05 17:22:25 +000032777 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32778 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32779 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32780 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32781 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32782 mem_base = xmlMemBlocks();
32783 type = gen_xmlSchemaTypePtr(n_type, 0);
32784 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32785 value = gen_const_xmlChar_ptr(n_value, 2);
32786 val = gen_xmlSchemaValPtr(n_val, 3);
32787 length = gen_unsigned_long_ptr(n_length, 4);
32788
William M. Brackf13f77f2004-11-12 16:03:48 +000032789 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032790 desret_int(ret_val);
32791 call_tests++;
32792 des_xmlSchemaTypePtr(n_type, type, 0);
32793 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032794 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032795 des_xmlSchemaValPtr(n_val, val, 3);
32796 des_unsigned_long_ptr(n_length, length, 4);
32797 xmlResetLastError();
32798 if (mem_base != xmlMemBlocks()) {
32799 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032801 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032802 printf(" %d", n_type);
32803 printf(" %d", n_facet);
32804 printf(" %d", n_value);
32805 printf(" %d", n_val);
32806 printf(" %d", n_length);
32807 printf("\n");
32808 }
32809 }
32810 }
32811 }
32812 }
32813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032814 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032815#endif
32816
Daniel Veillard42595322004-11-08 10:52:06 +000032817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032818}
32819
32820
32821static int
32822test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032824
Daniel Veillardce682bc2004-11-05 17:22:25 +000032825#ifdef LIBXML_SCHEMAS_ENABLED
32826 int mem_base;
32827 int ret_val;
32828 xmlSchemaFacetPtr facet; /* the facet to check */
32829 int n_facet;
32830 xmlChar * value; /* the lexical repr of the value to validate */
32831 int n_value;
32832 unsigned long actualLen; /* the number of list items */
32833 int n_actualLen;
32834 unsigned long * expectedLen; /* the resulting expected number of list items */
32835 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032836
Daniel Veillardce682bc2004-11-05 17:22:25 +000032837 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32838 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32839 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32840 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32841 mem_base = xmlMemBlocks();
32842 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32843 value = gen_const_xmlChar_ptr(n_value, 1);
32844 actualLen = gen_unsigned_long(n_actualLen, 2);
32845 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32846
William M. Brackf13f77f2004-11-12 16:03:48 +000032847 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032848 desret_int(ret_val);
32849 call_tests++;
32850 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032851 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032852 des_unsigned_long(n_actualLen, actualLen, 2);
32853 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32854 xmlResetLastError();
32855 if (mem_base != xmlMemBlocks()) {
32856 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032858 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032859 printf(" %d", n_facet);
32860 printf(" %d", n_value);
32861 printf(" %d", n_actualLen);
32862 printf(" %d", n_expectedLen);
32863 printf("\n");
32864 }
32865 }
32866 }
32867 }
32868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032869 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032870#endif
32871
Daniel Veillard42595322004-11-08 10:52:06 +000032872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032873}
32874
32875
32876static int
32877test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032879
Daniel Veillardce682bc2004-11-05 17:22:25 +000032880#ifdef LIBXML_SCHEMAS_ENABLED
32881 int mem_base;
32882 int ret_val;
32883 xmlSchemaTypePtr type; /* the predefined type */
32884 int n_type;
32885 xmlChar * value; /* the value to check */
32886 int n_value;
32887 xmlSchemaValPtr * val; /* the return computed value */
32888 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032889
Daniel Veillardce682bc2004-11-05 17:22:25 +000032890 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32891 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32892 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32893 mem_base = xmlMemBlocks();
32894 type = gen_xmlSchemaTypePtr(n_type, 0);
32895 value = gen_const_xmlChar_ptr(n_value, 1);
32896 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32897
William M. Brackf13f77f2004-11-12 16:03:48 +000032898 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032899 desret_int(ret_val);
32900 call_tests++;
32901 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032902 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032903 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32904 xmlResetLastError();
32905 if (mem_base != xmlMemBlocks()) {
32906 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032908 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032909 printf(" %d", n_type);
32910 printf(" %d", n_value);
32911 printf(" %d", n_val);
32912 printf("\n");
32913 }
32914 }
32915 }
32916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032917 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032918#endif
32919
Daniel Veillard42595322004-11-08 10:52:06 +000032920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032921}
32922
32923static int
32924test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032926
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032927 if (quiet == 0) printf("Testing xmlschemastypes : 15 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032928 test_ret += test_xmlSchemaCheckFacet();
32929 test_ret += test_xmlSchemaCleanupTypes();
32930 test_ret += test_xmlSchemaCollapseString();
32931 test_ret += test_xmlSchemaCompareValues();
32932 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32933 test_ret += test_xmlSchemaGetBuiltInType();
32934 test_ret += test_xmlSchemaGetFacetValueAsULong();
32935 test_ret += test_xmlSchemaGetPredefinedType();
32936 test_ret += test_xmlSchemaInitTypes();
32937 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32938 test_ret += test_xmlSchemaNewFacet();
32939 test_ret += test_xmlSchemaValPredefTypeNode();
32940 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32941 test_ret += test_xmlSchemaValidateFacet();
32942 test_ret += test_xmlSchemaValidateLengthFacet();
32943 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32944 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032945
Daniel Veillard42595322004-11-08 10:52:06 +000032946 if (test_ret != 0)
32947 printf("Module xmlschemastypes: %d errors\n", test_ret);
32948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032949}
32950
32951static int
32952test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032954
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032955 int mem_base;
32956 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032957 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032958 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032959
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032960 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032962 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032963
William M. Brackf13f77f2004-11-12 16:03:48 +000032964 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032965 desret_xmlChar_ptr(ret_val);
32966 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032967 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032968 xmlResetLastError();
32969 if (mem_base != xmlMemBlocks()) {
32970 printf("Leak of %d blocks found in xmlCharStrdup",
32971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032972 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032973 printf(" %d", n_cur);
32974 printf("\n");
32975 }
32976 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032978
Daniel Veillard42595322004-11-08 10:52:06 +000032979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032980}
32981
32982
32983static int
32984test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032986
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032987 int mem_base;
32988 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032989 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032990 int n_cur;
32991 int len; /* the len of @cur */
32992 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032993
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032994 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32995 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032997 cur = gen_const_char_ptr(n_cur, 0);
32998 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032999
William M. Brackf13f77f2004-11-12 16:03:48 +000033000 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033001 desret_xmlChar_ptr(ret_val);
33002 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033003 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033004 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033005 xmlResetLastError();
33006 if (mem_base != xmlMemBlocks()) {
33007 printf("Leak of %d blocks found in xmlCharStrndup",
33008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033009 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033010 printf(" %d", n_cur);
33011 printf(" %d", n_len);
33012 printf("\n");
33013 }
33014 }
33015 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033016 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033017
Daniel Veillard42595322004-11-08 10:52:06 +000033018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033019}
33020
33021
33022static int
33023test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033025
Daniel Veillardce682bc2004-11-05 17:22:25 +000033026 int mem_base;
33027 int ret_val;
33028 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33029 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033030
Daniel Veillardce682bc2004-11-05 17:22:25 +000033031 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33032 mem_base = xmlMemBlocks();
33033 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33034
William M. Brackf13f77f2004-11-12 16:03:48 +000033035 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033036 desret_int(ret_val);
33037 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033038 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033039 xmlResetLastError();
33040 if (mem_base != xmlMemBlocks()) {
33041 printf("Leak of %d blocks found in xmlCheckUTF8",
33042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033043 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033044 printf(" %d", n_utf);
33045 printf("\n");
33046 }
33047 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033049
Daniel Veillard42595322004-11-08 10:52:06 +000033050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033051}
33052
33053
33054static int
33055test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033057
Daniel Veillardce682bc2004-11-05 17:22:25 +000033058 int mem_base;
33059 int ret_val;
33060 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33061 int n_utf;
33062 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. */
33063 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033064
Daniel Veillardce682bc2004-11-05 17:22:25 +000033065 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33066 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33067 mem_base = xmlMemBlocks();
33068 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33069 len = gen_int_ptr(n_len, 1);
33070
William M. Brackf13f77f2004-11-12 16:03:48 +000033071 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033072 desret_int(ret_val);
33073 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033074 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033075 des_int_ptr(n_len, len, 1);
33076 xmlResetLastError();
33077 if (mem_base != xmlMemBlocks()) {
33078 printf("Leak of %d blocks found in xmlGetUTF8Char",
33079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033080 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033081 printf(" %d", n_utf);
33082 printf(" %d", n_len);
33083 printf("\n");
33084 }
33085 }
33086 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033087 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033088
Daniel Veillard42595322004-11-08 10:52:06 +000033089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033090}
33091
33092
33093static int
33094test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033096
33097 int mem_base;
33098 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033099 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033100 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033101 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033102 int n_str2;
33103
33104 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33105 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033107 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33108 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033109
William M. Brackf13f77f2004-11-12 16:03:48 +000033110 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033111 desret_int(ret_val);
33112 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033113 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33114 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033115 xmlResetLastError();
33116 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033117 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033119 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033120 printf(" %d", n_str1);
33121 printf(" %d", n_str2);
33122 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033123 }
33124 }
33125 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033126 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033127
Daniel Veillard42595322004-11-08 10:52:06 +000033128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033129}
33130
33131
33132static int
33133test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033135
33136
33137 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033139}
33140
33141
33142static int
33143test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033145
33146 int mem_base;
33147 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033148 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033149 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033150 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033151 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033152 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033153 int n_str;
33154
33155 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33156 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33157 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33158 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033159 pref = gen_const_xmlChar_ptr(n_pref, 0);
33160 name = gen_const_xmlChar_ptr(n_name, 1);
33161 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033162
William M. Brackf13f77f2004-11-12 16:03:48 +000033163 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033164 desret_int(ret_val);
33165 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033166 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33167 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33168 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033169 xmlResetLastError();
33170 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033171 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033173 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033174 printf(" %d", n_pref);
33175 printf(" %d", n_name);
33176 printf(" %d", n_str);
33177 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033178 }
33179 }
33180 }
33181 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033182 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033183
Daniel Veillard42595322004-11-08 10:52:06 +000033184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033185}
33186
33187
33188static int
33189test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033191
33192
33193 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033195}
33196
33197
33198static int
33199test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033201
33202 int mem_base;
33203 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033204 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033205 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033206 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033207 int n_str2;
33208
33209 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33210 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033212 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33213 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033214
William M. Brackf13f77f2004-11-12 16:03:48 +000033215 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033216 desret_int(ret_val);
33217 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033218 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33219 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033220 xmlResetLastError();
33221 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033222 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033224 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033225 printf(" %d", n_str1);
33226 printf(" %d", n_str2);
33227 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033228 }
33229 }
33230 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033231 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033232
Daniel Veillard42595322004-11-08 10:52:06 +000033233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033234}
33235
33236
33237static int
33238test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033240
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033241 int mem_base;
33242 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033243 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033244 int n_str;
33245 xmlChar * val; /* the xmlChar to search (needle) */
33246 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033247
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033248 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33249 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33250 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033251 str = gen_const_xmlChar_ptr(n_str, 0);
33252 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033253
William M. Brackf13f77f2004-11-12 16:03:48 +000033254 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033255 desret_const_xmlChar_ptr(ret_val);
33256 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033257 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033258 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033259 xmlResetLastError();
33260 if (mem_base != xmlMemBlocks()) {
33261 printf("Leak of %d blocks found in xmlStrcasestr",
33262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033263 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033264 printf(" %d", n_str);
33265 printf(" %d", n_val);
33266 printf("\n");
33267 }
33268 }
33269 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033270 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033271
Daniel Veillard42595322004-11-08 10:52:06 +000033272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033273}
33274
33275
33276static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033277test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033279
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033280 int mem_base;
33281 const xmlChar * ret_val;
33282 xmlChar * str; /* the xmlChar * array */
33283 int n_str;
33284 xmlChar val; /* the xmlChar to search */
33285 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033286
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033287 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33288 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33289 mem_base = xmlMemBlocks();
33290 str = gen_const_xmlChar_ptr(n_str, 0);
33291 val = gen_xmlChar(n_val, 1);
33292
William M. Brackf13f77f2004-11-12 16:03:48 +000033293 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033294 desret_const_xmlChar_ptr(ret_val);
33295 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033296 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033297 des_xmlChar(n_val, val, 1);
33298 xmlResetLastError();
33299 if (mem_base != xmlMemBlocks()) {
33300 printf("Leak of %d blocks found in xmlStrchr",
33301 xmlMemBlocks() - mem_base);
33302 test_ret++;
33303 printf(" %d", n_str);
33304 printf(" %d", n_val);
33305 printf("\n");
33306 }
33307 }
33308 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033310
Daniel Veillard42595322004-11-08 10:52:06 +000033311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033312}
33313
33314
33315static int
33316test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033318
33319 int mem_base;
33320 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033321 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033322 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033323 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033324 int n_str2;
33325
33326 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33327 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33328 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033329 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33330 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033331
William M. Brackf13f77f2004-11-12 16:03:48 +000033332 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033333 desret_int(ret_val);
33334 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033335 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33336 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033337 xmlResetLastError();
33338 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033339 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033341 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033342 printf(" %d", n_str1);
33343 printf(" %d", n_str2);
33344 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033345 }
33346 }
33347 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033348 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033349
Daniel Veillard42595322004-11-08 10:52:06 +000033350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033351}
33352
33353
33354static int
33355test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033357
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033358 int mem_base;
33359 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033360 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033361 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033362
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033363 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033365 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033366
William M. Brackf13f77f2004-11-12 16:03:48 +000033367 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033368 desret_xmlChar_ptr(ret_val);
33369 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033370 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033371 xmlResetLastError();
33372 if (mem_base != xmlMemBlocks()) {
33373 printf("Leak of %d blocks found in xmlStrdup",
33374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033375 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033376 printf(" %d", n_cur);
33377 printf("\n");
33378 }
33379 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033380 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033381
Daniel Veillard42595322004-11-08 10:52:06 +000033382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033383}
33384
33385
33386static int
33387test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033389
33390 int mem_base;
33391 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033392 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033393 int n_str;
33394
33395 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33396 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033397 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033398
William M. Brackf13f77f2004-11-12 16:03:48 +000033399 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033400 desret_int(ret_val);
33401 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033402 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033403 xmlResetLastError();
33404 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033405 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033407 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033408 printf(" %d", n_str);
33409 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033410 }
33411 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033413
Daniel Veillard42595322004-11-08 10:52:06 +000033414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033415}
33416
33417
33418static int
33419test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033421
33422 int mem_base;
33423 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033424 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033425 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033426 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033427 int n_str2;
33428 int len; /* the max comparison length */
33429 int n_len;
33430
33431 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33432 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33433 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33434 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033435 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33436 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33437 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033438
William M. Brackf13f77f2004-11-12 16:03:48 +000033439 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033440 desret_int(ret_val);
33441 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033442 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33443 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033444 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033445 xmlResetLastError();
33446 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033447 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033449 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033450 printf(" %d", n_str1);
33451 printf(" %d", n_str2);
33452 printf(" %d", n_len);
33453 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033454 }
33455 }
33456 }
33457 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033458 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033459
Daniel Veillard42595322004-11-08 10:52:06 +000033460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033461}
33462
33463
33464static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033465test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033467
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033468 int mem_base;
33469 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033470 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033471 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033472 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033473 int n_str2;
33474 int len; /* the len of @str2 */
33475 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033476
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033477 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33478 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33479 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033481 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33482 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33483 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033484
William M. Brackf13f77f2004-11-12 16:03:48 +000033485 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033486 desret_xmlChar_ptr(ret_val);
33487 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033488 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33489 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033490 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033491 xmlResetLastError();
33492 if (mem_base != xmlMemBlocks()) {
33493 printf("Leak of %d blocks found in xmlStrncatNew",
33494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033495 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033496 printf(" %d", n_str1);
33497 printf(" %d", n_str2);
33498 printf(" %d", n_len);
33499 printf("\n");
33500 }
33501 }
33502 }
33503 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033505
Daniel Veillard42595322004-11-08 10:52:06 +000033506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033507}
33508
33509
33510static int
33511test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033513
33514 int mem_base;
33515 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033516 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033517 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033518 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033519 int n_str2;
33520 int len; /* the max comparison length */
33521 int n_len;
33522
33523 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33524 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33525 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33526 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033527 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33528 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33529 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033530
William M. Brackf13f77f2004-11-12 16:03:48 +000033531 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033532 desret_int(ret_val);
33533 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033534 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33535 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033536 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033537 xmlResetLastError();
33538 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033539 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033541 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033542 printf(" %d", n_str1);
33543 printf(" %d", n_str2);
33544 printf(" %d", n_len);
33545 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033546 }
33547 }
33548 }
33549 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033550 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033551
Daniel Veillard42595322004-11-08 10:52:06 +000033552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033553}
33554
33555
33556static int
33557test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033559
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033560 int mem_base;
33561 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033562 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033563 int n_cur;
33564 int len; /* the len of @cur */
33565 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033566
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033567 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33568 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33569 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033570 cur = gen_const_xmlChar_ptr(n_cur, 0);
33571 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033572
William M. Brackf13f77f2004-11-12 16:03:48 +000033573 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033574 desret_xmlChar_ptr(ret_val);
33575 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033576 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033577 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033578 xmlResetLastError();
33579 if (mem_base != xmlMemBlocks()) {
33580 printf("Leak of %d blocks found in xmlStrndup",
33581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033582 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033583 printf(" %d", n_cur);
33584 printf(" %d", n_len);
33585 printf("\n");
33586 }
33587 }
33588 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033589 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033590
Daniel Veillard42595322004-11-08 10:52:06 +000033591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033592}
33593
33594
33595static int
33596test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033598
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033599 int mem_base;
33600 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033601 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033602 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033603 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033604 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033605
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033606 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33607 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33608 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033609 str = gen_const_xmlChar_ptr(n_str, 0);
33610 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033611
William M. Brackf13f77f2004-11-12 16:03:48 +000033612 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033613 desret_const_xmlChar_ptr(ret_val);
33614 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033615 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33616 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033617 xmlResetLastError();
33618 if (mem_base != xmlMemBlocks()) {
33619 printf("Leak of %d blocks found in xmlStrstr",
33620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033621 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033622 printf(" %d", n_str);
33623 printf(" %d", n_val);
33624 printf("\n");
33625 }
33626 }
33627 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033628 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033629
Daniel Veillard42595322004-11-08 10:52:06 +000033630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033631}
33632
33633
33634static int
33635test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033637
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033638 int mem_base;
33639 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033640 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033641 int n_str;
33642 int start; /* the index of the first char (zero based) */
33643 int n_start;
33644 int len; /* the length of the substring */
33645 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033646
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033647 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33648 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33649 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033651 str = gen_const_xmlChar_ptr(n_str, 0);
33652 start = gen_int(n_start, 1);
33653 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033654
William M. Brackf13f77f2004-11-12 16:03:48 +000033655 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033656 desret_xmlChar_ptr(ret_val);
33657 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033658 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033659 des_int(n_start, start, 1);
33660 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033661 xmlResetLastError();
33662 if (mem_base != xmlMemBlocks()) {
33663 printf("Leak of %d blocks found in xmlStrsub",
33664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033665 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033666 printf(" %d", n_str);
33667 printf(" %d", n_start);
33668 printf(" %d", n_len);
33669 printf("\n");
33670 }
33671 }
33672 }
33673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033675
Daniel Veillard42595322004-11-08 10:52:06 +000033676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033677}
33678
33679
33680static int
33681test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033683
33684 int mem_base;
33685 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033686 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033687 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033688 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033689 int n_utf2;
33690
33691 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33692 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33693 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033694 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33695 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033696
William M. Brackf13f77f2004-11-12 16:03:48 +000033697 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033698 desret_int(ret_val);
33699 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033700 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33701 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033702 xmlResetLastError();
33703 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033704 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033706 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033707 printf(" %d", n_utf1);
33708 printf(" %d", n_utf2);
33709 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033710 }
33711 }
33712 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033713 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033714
Daniel Veillard42595322004-11-08 10:52:06 +000033715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033716}
33717
33718
33719static int
33720test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033722
33723 int mem_base;
33724 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033725 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033726 int n_utf;
33727
33728 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33729 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033730 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033731
William M. Brackf13f77f2004-11-12 16:03:48 +000033732 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033733 desret_int(ret_val);
33734 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033735 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033736 xmlResetLastError();
33737 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033738 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033740 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033741 printf(" %d", n_utf);
33742 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033743 }
33744 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033745 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033746
Daniel Veillard42595322004-11-08 10:52:06 +000033747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033748}
33749
33750
33751static int
33752test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033754
33755 int mem_base;
33756 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033757 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033758 int n_utf;
33759
33760 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33761 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033762 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033763
William M. Brackf13f77f2004-11-12 16:03:48 +000033764 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033765 desret_int(ret_val);
33766 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033767 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033768 xmlResetLastError();
33769 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033770 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033772 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033773 printf(" %d", n_utf);
33774 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033775 }
33776 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033778
Daniel Veillard42595322004-11-08 10:52:06 +000033779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033780}
33781
33782
33783static int
33784test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033786
33787 int mem_base;
33788 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033789 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033790 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033791 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033792 int n_utfchar;
33793
33794 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33795 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033797 utf = gen_const_xmlChar_ptr(n_utf, 0);
33798 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033799
William M. Brackf13f77f2004-11-12 16:03:48 +000033800 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033801 desret_int(ret_val);
33802 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033803 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
33804 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033805 xmlResetLastError();
33806 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033807 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033809 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033810 printf(" %d", n_utf);
33811 printf(" %d", n_utfchar);
33812 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033813 }
33814 }
33815 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033816 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033817
Daniel Veillard42595322004-11-08 10:52:06 +000033818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033819}
33820
33821
33822static int
33823test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033825
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033826 int mem_base;
33827 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033828 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033829 int n_utf;
33830 int len; /* the len of @utf (in chars) */
33831 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033832
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033833 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33834 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033836 utf = gen_const_xmlChar_ptr(n_utf, 0);
33837 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033838
William M. Brackf13f77f2004-11-12 16:03:48 +000033839 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033840 desret_xmlChar_ptr(ret_val);
33841 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033842 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033843 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033844 xmlResetLastError();
33845 if (mem_base != xmlMemBlocks()) {
33846 printf("Leak of %d blocks found in xmlUTF8Strndup",
33847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033848 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033849 printf(" %d", n_utf);
33850 printf(" %d", n_len);
33851 printf("\n");
33852 }
33853 }
33854 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033855 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033856
Daniel Veillard42595322004-11-08 10:52:06 +000033857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033858}
33859
33860
33861static int
33862test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033864
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033865 int mem_base;
33866 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033867 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033868 int n_utf;
33869 int pos; /* the position of the desired UTF8 char (in chars) */
33870 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033871
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033872 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33873 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33874 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033875 utf = gen_const_xmlChar_ptr(n_utf, 0);
33876 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033877
William M. Brackf13f77f2004-11-12 16:03:48 +000033878 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033879 desret_const_xmlChar_ptr(ret_val);
33880 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033881 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033882 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033883 xmlResetLastError();
33884 if (mem_base != xmlMemBlocks()) {
33885 printf("Leak of %d blocks found in xmlUTF8Strpos",
33886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033887 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033888 printf(" %d", n_utf);
33889 printf(" %d", n_pos);
33890 printf("\n");
33891 }
33892 }
33893 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033894 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033895
Daniel Veillard42595322004-11-08 10:52:06 +000033896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033897}
33898
33899
33900static int
33901test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033903
33904 int mem_base;
33905 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033906 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033907 int n_utf;
33908 int len; /* the number of characters in the array */
33909 int n_len;
33910
33911 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33912 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033914 utf = gen_const_xmlChar_ptr(n_utf, 0);
33915 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033916
William M. Brackf13f77f2004-11-12 16:03:48 +000033917 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033918 desret_int(ret_val);
33919 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033920 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033921 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033922 xmlResetLastError();
33923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033924 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033927 printf(" %d", n_utf);
33928 printf(" %d", n_len);
33929 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033930 }
33931 }
33932 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033933 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033934
Daniel Veillard42595322004-11-08 10:52:06 +000033935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033936}
33937
33938
33939static int
33940test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033942
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033943 int mem_base;
33944 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033945 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033946 int n_utf;
33947 int start; /* relative pos of first char */
33948 int n_start;
33949 int len; /* total number to copy */
33950 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033951
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033952 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33953 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33954 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033956 utf = gen_const_xmlChar_ptr(n_utf, 0);
33957 start = gen_int(n_start, 1);
33958 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033959
William M. Brackf13f77f2004-11-12 16:03:48 +000033960 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033961 desret_xmlChar_ptr(ret_val);
33962 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033963 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033964 des_int(n_start, start, 1);
33965 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033966 xmlResetLastError();
33967 if (mem_base != xmlMemBlocks()) {
33968 printf("Leak of %d blocks found in xmlUTF8Strsub",
33969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033970 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033971 printf(" %d", n_utf);
33972 printf(" %d", n_start);
33973 printf(" %d", n_len);
33974 printf("\n");
33975 }
33976 }
33977 }
33978 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033979 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033980
Daniel Veillard42595322004-11-08 10:52:06 +000033981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033982}
33983
33984static int
33985test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033987
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033988 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033989 test_ret += test_xmlCharStrdup();
33990 test_ret += test_xmlCharStrndup();
33991 test_ret += test_xmlCheckUTF8();
33992 test_ret += test_xmlGetUTF8Char();
33993 test_ret += test_xmlStrEqual();
33994 test_ret += test_xmlStrPrintf();
33995 test_ret += test_xmlStrQEqual();
33996 test_ret += test_xmlStrVPrintf();
33997 test_ret += test_xmlStrcasecmp();
33998 test_ret += test_xmlStrcasestr();
33999 test_ret += test_xmlStrchr();
34000 test_ret += test_xmlStrcmp();
34001 test_ret += test_xmlStrdup();
34002 test_ret += test_xmlStrlen();
34003 test_ret += test_xmlStrncasecmp();
34004 test_ret += test_xmlStrncatNew();
34005 test_ret += test_xmlStrncmp();
34006 test_ret += test_xmlStrndup();
34007 test_ret += test_xmlStrstr();
34008 test_ret += test_xmlStrsub();
34009 test_ret += test_xmlUTF8Charcmp();
34010 test_ret += test_xmlUTF8Size();
34011 test_ret += test_xmlUTF8Strlen();
34012 test_ret += test_xmlUTF8Strloc();
34013 test_ret += test_xmlUTF8Strndup();
34014 test_ret += test_xmlUTF8Strpos();
34015 test_ret += test_xmlUTF8Strsize();
34016 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034017
Daniel Veillard42595322004-11-08 10:52:06 +000034018 if (test_ret != 0)
34019 printf("Module xmlstring: %d errors\n", test_ret);
34020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034021}
34022
34023static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034024test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034025 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034026
34027#ifdef LIBXML_UNICODE_ENABLED
34028 int mem_base;
34029 int ret_val;
34030 int code; /* UCS code point */
34031 int n_code;
34032
34033 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34034 mem_base = xmlMemBlocks();
34035 code = gen_int(n_code, 0);
34036
34037 ret_val = xmlUCSIsAegeanNumbers(code);
34038 desret_int(ret_val);
34039 call_tests++;
34040 des_int(n_code, code, 0);
34041 xmlResetLastError();
34042 if (mem_base != xmlMemBlocks()) {
34043 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034045 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034046 printf(" %d", n_code);
34047 printf("\n");
34048 }
34049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034050 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034051#endif
34052
Daniel Veillard42595322004-11-08 10:52:06 +000034053 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034054}
34055
34056
34057static int
34058test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034059 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034060
34061#ifdef LIBXML_UNICODE_ENABLED
34062 int mem_base;
34063 int ret_val;
34064 int code; /* UCS code point */
34065 int n_code;
34066
34067 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34068 mem_base = xmlMemBlocks();
34069 code = gen_int(n_code, 0);
34070
34071 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34072 desret_int(ret_val);
34073 call_tests++;
34074 des_int(n_code, code, 0);
34075 xmlResetLastError();
34076 if (mem_base != xmlMemBlocks()) {
34077 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034079 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034080 printf(" %d", n_code);
34081 printf("\n");
34082 }
34083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034084 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034085#endif
34086
Daniel Veillard42595322004-11-08 10:52:06 +000034087 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034088}
34089
34090
34091static int
34092test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034093 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034094
34095#ifdef LIBXML_UNICODE_ENABLED
34096 int mem_base;
34097 int ret_val;
34098 int code; /* UCS code point */
34099 int n_code;
34100
34101 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34102 mem_base = xmlMemBlocks();
34103 code = gen_int(n_code, 0);
34104
34105 ret_val = xmlUCSIsArabic(code);
34106 desret_int(ret_val);
34107 call_tests++;
34108 des_int(n_code, code, 0);
34109 xmlResetLastError();
34110 if (mem_base != xmlMemBlocks()) {
34111 printf("Leak of %d blocks found in xmlUCSIsArabic",
34112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034113 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034114 printf(" %d", n_code);
34115 printf("\n");
34116 }
34117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034118 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034119#endif
34120
Daniel Veillard42595322004-11-08 10:52:06 +000034121 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034122}
34123
34124
34125static int
34126test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034127 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034128
34129#ifdef LIBXML_UNICODE_ENABLED
34130 int mem_base;
34131 int ret_val;
34132 int code; /* UCS code point */
34133 int n_code;
34134
34135 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34136 mem_base = xmlMemBlocks();
34137 code = gen_int(n_code, 0);
34138
34139 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34140 desret_int(ret_val);
34141 call_tests++;
34142 des_int(n_code, code, 0);
34143 xmlResetLastError();
34144 if (mem_base != xmlMemBlocks()) {
34145 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034147 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034148 printf(" %d", n_code);
34149 printf("\n");
34150 }
34151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034152 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034153#endif
34154
Daniel Veillard42595322004-11-08 10:52:06 +000034155 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034156}
34157
34158
34159static int
34160test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034161 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034162
34163#ifdef LIBXML_UNICODE_ENABLED
34164 int mem_base;
34165 int ret_val;
34166 int code; /* UCS code point */
34167 int n_code;
34168
34169 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34170 mem_base = xmlMemBlocks();
34171 code = gen_int(n_code, 0);
34172
34173 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34174 desret_int(ret_val);
34175 call_tests++;
34176 des_int(n_code, code, 0);
34177 xmlResetLastError();
34178 if (mem_base != xmlMemBlocks()) {
34179 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034181 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034182 printf(" %d", n_code);
34183 printf("\n");
34184 }
34185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034186 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034187#endif
34188
Daniel Veillard42595322004-11-08 10:52:06 +000034189 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034190}
34191
34192
34193static int
34194test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034195 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034196
34197#ifdef LIBXML_UNICODE_ENABLED
34198 int mem_base;
34199 int ret_val;
34200 int code; /* UCS code point */
34201 int n_code;
34202
34203 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34204 mem_base = xmlMemBlocks();
34205 code = gen_int(n_code, 0);
34206
34207 ret_val = xmlUCSIsArmenian(code);
34208 desret_int(ret_val);
34209 call_tests++;
34210 des_int(n_code, code, 0);
34211 xmlResetLastError();
34212 if (mem_base != xmlMemBlocks()) {
34213 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034215 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034216 printf(" %d", n_code);
34217 printf("\n");
34218 }
34219 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034220 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034221#endif
34222
Daniel Veillard42595322004-11-08 10:52:06 +000034223 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034224}
34225
34226
34227static int
34228test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034229 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034230
34231#ifdef LIBXML_UNICODE_ENABLED
34232 int mem_base;
34233 int ret_val;
34234 int code; /* UCS code point */
34235 int n_code;
34236
34237 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34238 mem_base = xmlMemBlocks();
34239 code = gen_int(n_code, 0);
34240
34241 ret_val = xmlUCSIsArrows(code);
34242 desret_int(ret_val);
34243 call_tests++;
34244 des_int(n_code, code, 0);
34245 xmlResetLastError();
34246 if (mem_base != xmlMemBlocks()) {
34247 printf("Leak of %d blocks found in xmlUCSIsArrows",
34248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034249 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034250 printf(" %d", n_code);
34251 printf("\n");
34252 }
34253 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034254 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034255#endif
34256
Daniel Veillard42595322004-11-08 10:52:06 +000034257 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034258}
34259
34260
34261static int
34262test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034263 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034264
34265#ifdef LIBXML_UNICODE_ENABLED
34266 int mem_base;
34267 int ret_val;
34268 int code; /* UCS code point */
34269 int n_code;
34270
34271 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34272 mem_base = xmlMemBlocks();
34273 code = gen_int(n_code, 0);
34274
34275 ret_val = xmlUCSIsBasicLatin(code);
34276 desret_int(ret_val);
34277 call_tests++;
34278 des_int(n_code, code, 0);
34279 xmlResetLastError();
34280 if (mem_base != xmlMemBlocks()) {
34281 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034283 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034284 printf(" %d", n_code);
34285 printf("\n");
34286 }
34287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034288 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034289#endif
34290
Daniel Veillard42595322004-11-08 10:52:06 +000034291 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034292}
34293
34294
34295static int
34296test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034297 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034298
34299#ifdef LIBXML_UNICODE_ENABLED
34300 int mem_base;
34301 int ret_val;
34302 int code; /* UCS code point */
34303 int n_code;
34304
34305 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34306 mem_base = xmlMemBlocks();
34307 code = gen_int(n_code, 0);
34308
34309 ret_val = xmlUCSIsBengali(code);
34310 desret_int(ret_val);
34311 call_tests++;
34312 des_int(n_code, code, 0);
34313 xmlResetLastError();
34314 if (mem_base != xmlMemBlocks()) {
34315 printf("Leak of %d blocks found in xmlUCSIsBengali",
34316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034317 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034318 printf(" %d", n_code);
34319 printf("\n");
34320 }
34321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034322 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034323#endif
34324
Daniel Veillard42595322004-11-08 10:52:06 +000034325 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034326}
34327
34328
34329static int
34330test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034331 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034332
34333#ifdef LIBXML_UNICODE_ENABLED
34334 int mem_base;
34335 int ret_val;
34336 int code; /* UCS code point */
34337 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034338 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034339 int n_block;
34340
34341 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34342 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34343 mem_base = xmlMemBlocks();
34344 code = gen_int(n_code, 0);
34345 block = gen_const_char_ptr(n_block, 1);
34346
William M. Brackf13f77f2004-11-12 16:03:48 +000034347 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034348 desret_int(ret_val);
34349 call_tests++;
34350 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034351 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034352 xmlResetLastError();
34353 if (mem_base != xmlMemBlocks()) {
34354 printf("Leak of %d blocks found in xmlUCSIsBlock",
34355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034356 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034357 printf(" %d", n_code);
34358 printf(" %d", n_block);
34359 printf("\n");
34360 }
34361 }
34362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034363 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034364#endif
34365
Daniel Veillard42595322004-11-08 10:52:06 +000034366 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034367}
34368
34369
34370static int
34371test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034372 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034373
34374#ifdef LIBXML_UNICODE_ENABLED
34375 int mem_base;
34376 int ret_val;
34377 int code; /* UCS code point */
34378 int n_code;
34379
34380 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34381 mem_base = xmlMemBlocks();
34382 code = gen_int(n_code, 0);
34383
34384 ret_val = xmlUCSIsBlockElements(code);
34385 desret_int(ret_val);
34386 call_tests++;
34387 des_int(n_code, code, 0);
34388 xmlResetLastError();
34389 if (mem_base != xmlMemBlocks()) {
34390 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034392 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034393 printf(" %d", n_code);
34394 printf("\n");
34395 }
34396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034397 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034398#endif
34399
Daniel Veillard42595322004-11-08 10:52:06 +000034400 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034401}
34402
34403
34404static int
34405test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034406 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034407
34408#ifdef LIBXML_UNICODE_ENABLED
34409 int mem_base;
34410 int ret_val;
34411 int code; /* UCS code point */
34412 int n_code;
34413
34414 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34415 mem_base = xmlMemBlocks();
34416 code = gen_int(n_code, 0);
34417
34418 ret_val = xmlUCSIsBopomofo(code);
34419 desret_int(ret_val);
34420 call_tests++;
34421 des_int(n_code, code, 0);
34422 xmlResetLastError();
34423 if (mem_base != xmlMemBlocks()) {
34424 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034426 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034427 printf(" %d", n_code);
34428 printf("\n");
34429 }
34430 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034431 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034432#endif
34433
Daniel Veillard42595322004-11-08 10:52:06 +000034434 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034435}
34436
34437
34438static int
34439test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034440 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034441
34442#ifdef LIBXML_UNICODE_ENABLED
34443 int mem_base;
34444 int ret_val;
34445 int code; /* UCS code point */
34446 int n_code;
34447
34448 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34449 mem_base = xmlMemBlocks();
34450 code = gen_int(n_code, 0);
34451
34452 ret_val = xmlUCSIsBopomofoExtended(code);
34453 desret_int(ret_val);
34454 call_tests++;
34455 des_int(n_code, code, 0);
34456 xmlResetLastError();
34457 if (mem_base != xmlMemBlocks()) {
34458 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034460 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034461 printf(" %d", n_code);
34462 printf("\n");
34463 }
34464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034465 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034466#endif
34467
Daniel Veillard42595322004-11-08 10:52:06 +000034468 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034469}
34470
34471
34472static int
34473test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034474 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034475
34476#ifdef LIBXML_UNICODE_ENABLED
34477 int mem_base;
34478 int ret_val;
34479 int code; /* UCS code point */
34480 int n_code;
34481
34482 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34483 mem_base = xmlMemBlocks();
34484 code = gen_int(n_code, 0);
34485
34486 ret_val = xmlUCSIsBoxDrawing(code);
34487 desret_int(ret_val);
34488 call_tests++;
34489 des_int(n_code, code, 0);
34490 xmlResetLastError();
34491 if (mem_base != xmlMemBlocks()) {
34492 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34493 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034494 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034495 printf(" %d", n_code);
34496 printf("\n");
34497 }
34498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034499 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034500#endif
34501
Daniel Veillard42595322004-11-08 10:52:06 +000034502 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034503}
34504
34505
34506static int
34507test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034508 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034509
34510#ifdef LIBXML_UNICODE_ENABLED
34511 int mem_base;
34512 int ret_val;
34513 int code; /* UCS code point */
34514 int n_code;
34515
34516 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34517 mem_base = xmlMemBlocks();
34518 code = gen_int(n_code, 0);
34519
34520 ret_val = xmlUCSIsBraillePatterns(code);
34521 desret_int(ret_val);
34522 call_tests++;
34523 des_int(n_code, code, 0);
34524 xmlResetLastError();
34525 if (mem_base != xmlMemBlocks()) {
34526 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034528 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034529 printf(" %d", n_code);
34530 printf("\n");
34531 }
34532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034533 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034534#endif
34535
Daniel Veillard42595322004-11-08 10:52:06 +000034536 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034537}
34538
34539
34540static int
34541test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034542 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034543
34544#ifdef LIBXML_UNICODE_ENABLED
34545 int mem_base;
34546 int ret_val;
34547 int code; /* UCS code point */
34548 int n_code;
34549
34550 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34551 mem_base = xmlMemBlocks();
34552 code = gen_int(n_code, 0);
34553
34554 ret_val = xmlUCSIsBuhid(code);
34555 desret_int(ret_val);
34556 call_tests++;
34557 des_int(n_code, code, 0);
34558 xmlResetLastError();
34559 if (mem_base != xmlMemBlocks()) {
34560 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034562 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034563 printf(" %d", n_code);
34564 printf("\n");
34565 }
34566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034567 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034568#endif
34569
Daniel Veillard42595322004-11-08 10:52:06 +000034570 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034571}
34572
34573
34574static int
34575test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034576 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034577
34578#ifdef LIBXML_UNICODE_ENABLED
34579 int mem_base;
34580 int ret_val;
34581 int code; /* UCS code point */
34582 int n_code;
34583
34584 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34585 mem_base = xmlMemBlocks();
34586 code = gen_int(n_code, 0);
34587
34588 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34589 desret_int(ret_val);
34590 call_tests++;
34591 des_int(n_code, code, 0);
34592 xmlResetLastError();
34593 if (mem_base != xmlMemBlocks()) {
34594 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034596 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034597 printf(" %d", n_code);
34598 printf("\n");
34599 }
34600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034601 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034602#endif
34603
Daniel Veillard42595322004-11-08 10:52:06 +000034604 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034605}
34606
34607
34608static int
34609test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034610 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034611
34612#ifdef LIBXML_UNICODE_ENABLED
34613 int mem_base;
34614 int ret_val;
34615 int code; /* UCS code point */
34616 int n_code;
34617
34618 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34619 mem_base = xmlMemBlocks();
34620 code = gen_int(n_code, 0);
34621
34622 ret_val = xmlUCSIsCJKCompatibility(code);
34623 desret_int(ret_val);
34624 call_tests++;
34625 des_int(n_code, code, 0);
34626 xmlResetLastError();
34627 if (mem_base != xmlMemBlocks()) {
34628 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034630 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034631 printf(" %d", n_code);
34632 printf("\n");
34633 }
34634 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034635 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034636#endif
34637
Daniel Veillard42595322004-11-08 10:52:06 +000034638 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034639}
34640
34641
34642static int
34643test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034644 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034645
34646#ifdef LIBXML_UNICODE_ENABLED
34647 int mem_base;
34648 int ret_val;
34649 int code; /* UCS code point */
34650 int n_code;
34651
34652 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34653 mem_base = xmlMemBlocks();
34654 code = gen_int(n_code, 0);
34655
34656 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34657 desret_int(ret_val);
34658 call_tests++;
34659 des_int(n_code, code, 0);
34660 xmlResetLastError();
34661 if (mem_base != xmlMemBlocks()) {
34662 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034664 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034665 printf(" %d", n_code);
34666 printf("\n");
34667 }
34668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034669 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034670#endif
34671
Daniel Veillard42595322004-11-08 10:52:06 +000034672 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034673}
34674
34675
34676static int
34677test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034678 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034679
34680#ifdef LIBXML_UNICODE_ENABLED
34681 int mem_base;
34682 int ret_val;
34683 int code; /* UCS code point */
34684 int n_code;
34685
34686 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34687 mem_base = xmlMemBlocks();
34688 code = gen_int(n_code, 0);
34689
34690 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34691 desret_int(ret_val);
34692 call_tests++;
34693 des_int(n_code, code, 0);
34694 xmlResetLastError();
34695 if (mem_base != xmlMemBlocks()) {
34696 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034698 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034699 printf(" %d", n_code);
34700 printf("\n");
34701 }
34702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034703 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034704#endif
34705
Daniel Veillard42595322004-11-08 10:52:06 +000034706 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034707}
34708
34709
34710static int
34711test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034712 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034713
34714#ifdef LIBXML_UNICODE_ENABLED
34715 int mem_base;
34716 int ret_val;
34717 int code; /* UCS code point */
34718 int n_code;
34719
34720 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34721 mem_base = xmlMemBlocks();
34722 code = gen_int(n_code, 0);
34723
34724 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34725 desret_int(ret_val);
34726 call_tests++;
34727 des_int(n_code, code, 0);
34728 xmlResetLastError();
34729 if (mem_base != xmlMemBlocks()) {
34730 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034732 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034733 printf(" %d", n_code);
34734 printf("\n");
34735 }
34736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034737 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034738#endif
34739
Daniel Veillard42595322004-11-08 10:52:06 +000034740 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034741}
34742
34743
34744static int
34745test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034746 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034747
34748#ifdef LIBXML_UNICODE_ENABLED
34749 int mem_base;
34750 int ret_val;
34751 int code; /* UCS code point */
34752 int n_code;
34753
34754 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34755 mem_base = xmlMemBlocks();
34756 code = gen_int(n_code, 0);
34757
34758 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34759 desret_int(ret_val);
34760 call_tests++;
34761 des_int(n_code, code, 0);
34762 xmlResetLastError();
34763 if (mem_base != xmlMemBlocks()) {
34764 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034766 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034767 printf(" %d", n_code);
34768 printf("\n");
34769 }
34770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034771 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034772#endif
34773
Daniel Veillard42595322004-11-08 10:52:06 +000034774 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034775}
34776
34777
34778static int
34779test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034780 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034781
34782#ifdef LIBXML_UNICODE_ENABLED
34783 int mem_base;
34784 int ret_val;
34785 int code; /* UCS code point */
34786 int n_code;
34787
34788 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34789 mem_base = xmlMemBlocks();
34790 code = gen_int(n_code, 0);
34791
34792 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34793 desret_int(ret_val);
34794 call_tests++;
34795 des_int(n_code, code, 0);
34796 xmlResetLastError();
34797 if (mem_base != xmlMemBlocks()) {
34798 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034800 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034801 printf(" %d", n_code);
34802 printf("\n");
34803 }
34804 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034805 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034806#endif
34807
Daniel Veillard42595322004-11-08 10:52:06 +000034808 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034809}
34810
34811
34812static int
34813test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034814 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034815
34816#ifdef LIBXML_UNICODE_ENABLED
34817 int mem_base;
34818 int ret_val;
34819 int code; /* UCS code point */
34820 int n_code;
34821
34822 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34823 mem_base = xmlMemBlocks();
34824 code = gen_int(n_code, 0);
34825
34826 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34827 desret_int(ret_val);
34828 call_tests++;
34829 des_int(n_code, code, 0);
34830 xmlResetLastError();
34831 if (mem_base != xmlMemBlocks()) {
34832 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034834 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034835 printf(" %d", n_code);
34836 printf("\n");
34837 }
34838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034839 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034840#endif
34841
Daniel Veillard42595322004-11-08 10:52:06 +000034842 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034843}
34844
34845
34846static int
34847test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034848 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034849
34850#ifdef LIBXML_UNICODE_ENABLED
34851 int mem_base;
34852 int ret_val;
34853 int code; /* UCS code point */
34854 int n_code;
34855
34856 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34857 mem_base = xmlMemBlocks();
34858 code = gen_int(n_code, 0);
34859
34860 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34861 desret_int(ret_val);
34862 call_tests++;
34863 des_int(n_code, code, 0);
34864 xmlResetLastError();
34865 if (mem_base != xmlMemBlocks()) {
34866 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034868 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034869 printf(" %d", n_code);
34870 printf("\n");
34871 }
34872 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034873 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034874#endif
34875
Daniel Veillard42595322004-11-08 10:52:06 +000034876 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034877}
34878
34879
34880static int
34881test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034882 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034883
34884#ifdef LIBXML_UNICODE_ENABLED
34885 int mem_base;
34886 int ret_val;
34887 int code; /* UCS code point */
34888 int n_code;
34889
34890 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34891 mem_base = xmlMemBlocks();
34892 code = gen_int(n_code, 0);
34893
34894 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34895 desret_int(ret_val);
34896 call_tests++;
34897 des_int(n_code, code, 0);
34898 xmlResetLastError();
34899 if (mem_base != xmlMemBlocks()) {
34900 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034902 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034903 printf(" %d", n_code);
34904 printf("\n");
34905 }
34906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034907 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034908#endif
34909
Daniel Veillard42595322004-11-08 10:52:06 +000034910 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034911}
34912
34913
34914static int
34915test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034916 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034917
34918#ifdef LIBXML_UNICODE_ENABLED
34919 int mem_base;
34920 int ret_val;
34921 int code; /* UCS code point */
34922 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034923 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034924 int n_cat;
34925
34926 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34927 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34928 mem_base = xmlMemBlocks();
34929 code = gen_int(n_code, 0);
34930 cat = gen_const_char_ptr(n_cat, 1);
34931
William M. Brackf13f77f2004-11-12 16:03:48 +000034932 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034933 desret_int(ret_val);
34934 call_tests++;
34935 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034936 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034937 xmlResetLastError();
34938 if (mem_base != xmlMemBlocks()) {
34939 printf("Leak of %d blocks found in xmlUCSIsCat",
34940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034941 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034942 printf(" %d", n_code);
34943 printf(" %d", n_cat);
34944 printf("\n");
34945 }
34946 }
34947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034948 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034949#endif
34950
Daniel Veillard42595322004-11-08 10:52:06 +000034951 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034952}
34953
34954
34955static int
34956test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034957 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034958
34959#ifdef LIBXML_UNICODE_ENABLED
34960 int mem_base;
34961 int ret_val;
34962 int code; /* UCS code point */
34963 int n_code;
34964
34965 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34966 mem_base = xmlMemBlocks();
34967 code = gen_int(n_code, 0);
34968
34969 ret_val = xmlUCSIsCatC(code);
34970 desret_int(ret_val);
34971 call_tests++;
34972 des_int(n_code, code, 0);
34973 xmlResetLastError();
34974 if (mem_base != xmlMemBlocks()) {
34975 printf("Leak of %d blocks found in xmlUCSIsCatC",
34976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034977 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034978 printf(" %d", n_code);
34979 printf("\n");
34980 }
34981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034982 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034983#endif
34984
Daniel Veillard42595322004-11-08 10:52:06 +000034985 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034986}
34987
34988
34989static int
34990test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034991 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034992
34993#ifdef LIBXML_UNICODE_ENABLED
34994 int mem_base;
34995 int ret_val;
34996 int code; /* UCS code point */
34997 int n_code;
34998
34999 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35000 mem_base = xmlMemBlocks();
35001 code = gen_int(n_code, 0);
35002
35003 ret_val = xmlUCSIsCatCc(code);
35004 desret_int(ret_val);
35005 call_tests++;
35006 des_int(n_code, code, 0);
35007 xmlResetLastError();
35008 if (mem_base != xmlMemBlocks()) {
35009 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035011 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035012 printf(" %d", n_code);
35013 printf("\n");
35014 }
35015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035016 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035017#endif
35018
Daniel Veillard42595322004-11-08 10:52:06 +000035019 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035020}
35021
35022
35023static int
35024test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035025 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035026
35027#ifdef LIBXML_UNICODE_ENABLED
35028 int mem_base;
35029 int ret_val;
35030 int code; /* UCS code point */
35031 int n_code;
35032
35033 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35034 mem_base = xmlMemBlocks();
35035 code = gen_int(n_code, 0);
35036
35037 ret_val = xmlUCSIsCatCf(code);
35038 desret_int(ret_val);
35039 call_tests++;
35040 des_int(n_code, code, 0);
35041 xmlResetLastError();
35042 if (mem_base != xmlMemBlocks()) {
35043 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035045 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035046 printf(" %d", n_code);
35047 printf("\n");
35048 }
35049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035050 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035051#endif
35052
Daniel Veillard42595322004-11-08 10:52:06 +000035053 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035054}
35055
35056
35057static int
35058test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035059 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035060
35061#ifdef LIBXML_UNICODE_ENABLED
35062 int mem_base;
35063 int ret_val;
35064 int code; /* UCS code point */
35065 int n_code;
35066
35067 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35068 mem_base = xmlMemBlocks();
35069 code = gen_int(n_code, 0);
35070
35071 ret_val = xmlUCSIsCatCo(code);
35072 desret_int(ret_val);
35073 call_tests++;
35074 des_int(n_code, code, 0);
35075 xmlResetLastError();
35076 if (mem_base != xmlMemBlocks()) {
35077 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035079 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035080 printf(" %d", n_code);
35081 printf("\n");
35082 }
35083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035084 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035085#endif
35086
Daniel Veillard42595322004-11-08 10:52:06 +000035087 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035088}
35089
35090
35091static int
35092test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035093 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035094
35095#ifdef LIBXML_UNICODE_ENABLED
35096 int mem_base;
35097 int ret_val;
35098 int code; /* UCS code point */
35099 int n_code;
35100
35101 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35102 mem_base = xmlMemBlocks();
35103 code = gen_int(n_code, 0);
35104
35105 ret_val = xmlUCSIsCatCs(code);
35106 desret_int(ret_val);
35107 call_tests++;
35108 des_int(n_code, code, 0);
35109 xmlResetLastError();
35110 if (mem_base != xmlMemBlocks()) {
35111 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035113 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035114 printf(" %d", n_code);
35115 printf("\n");
35116 }
35117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035118 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035119#endif
35120
Daniel Veillard42595322004-11-08 10:52:06 +000035121 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035122}
35123
35124
35125static int
35126test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035127 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035128
35129#ifdef LIBXML_UNICODE_ENABLED
35130 int mem_base;
35131 int ret_val;
35132 int code; /* UCS code point */
35133 int n_code;
35134
35135 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35136 mem_base = xmlMemBlocks();
35137 code = gen_int(n_code, 0);
35138
35139 ret_val = xmlUCSIsCatL(code);
35140 desret_int(ret_val);
35141 call_tests++;
35142 des_int(n_code, code, 0);
35143 xmlResetLastError();
35144 if (mem_base != xmlMemBlocks()) {
35145 printf("Leak of %d blocks found in xmlUCSIsCatL",
35146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035147 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035148 printf(" %d", n_code);
35149 printf("\n");
35150 }
35151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035152 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035153#endif
35154
Daniel Veillard42595322004-11-08 10:52:06 +000035155 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035156}
35157
35158
35159static int
35160test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035161 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035162
35163#ifdef LIBXML_UNICODE_ENABLED
35164 int mem_base;
35165 int ret_val;
35166 int code; /* UCS code point */
35167 int n_code;
35168
35169 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35170 mem_base = xmlMemBlocks();
35171 code = gen_int(n_code, 0);
35172
35173 ret_val = xmlUCSIsCatLl(code);
35174 desret_int(ret_val);
35175 call_tests++;
35176 des_int(n_code, code, 0);
35177 xmlResetLastError();
35178 if (mem_base != xmlMemBlocks()) {
35179 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035181 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035182 printf(" %d", n_code);
35183 printf("\n");
35184 }
35185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035186 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035187#endif
35188
Daniel Veillard42595322004-11-08 10:52:06 +000035189 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035190}
35191
35192
35193static int
35194test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035195 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035196
35197#ifdef LIBXML_UNICODE_ENABLED
35198 int mem_base;
35199 int ret_val;
35200 int code; /* UCS code point */
35201 int n_code;
35202
35203 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35204 mem_base = xmlMemBlocks();
35205 code = gen_int(n_code, 0);
35206
35207 ret_val = xmlUCSIsCatLm(code);
35208 desret_int(ret_val);
35209 call_tests++;
35210 des_int(n_code, code, 0);
35211 xmlResetLastError();
35212 if (mem_base != xmlMemBlocks()) {
35213 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035215 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035216 printf(" %d", n_code);
35217 printf("\n");
35218 }
35219 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035220 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035221#endif
35222
Daniel Veillard42595322004-11-08 10:52:06 +000035223 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035224}
35225
35226
35227static int
35228test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035229 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035230
35231#ifdef LIBXML_UNICODE_ENABLED
35232 int mem_base;
35233 int ret_val;
35234 int code; /* UCS code point */
35235 int n_code;
35236
35237 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35238 mem_base = xmlMemBlocks();
35239 code = gen_int(n_code, 0);
35240
35241 ret_val = xmlUCSIsCatLo(code);
35242 desret_int(ret_val);
35243 call_tests++;
35244 des_int(n_code, code, 0);
35245 xmlResetLastError();
35246 if (mem_base != xmlMemBlocks()) {
35247 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035249 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035250 printf(" %d", n_code);
35251 printf("\n");
35252 }
35253 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035254 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035255#endif
35256
Daniel Veillard42595322004-11-08 10:52:06 +000035257 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035258}
35259
35260
35261static int
35262test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035263 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035264
35265#ifdef LIBXML_UNICODE_ENABLED
35266 int mem_base;
35267 int ret_val;
35268 int code; /* UCS code point */
35269 int n_code;
35270
35271 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35272 mem_base = xmlMemBlocks();
35273 code = gen_int(n_code, 0);
35274
35275 ret_val = xmlUCSIsCatLt(code);
35276 desret_int(ret_val);
35277 call_tests++;
35278 des_int(n_code, code, 0);
35279 xmlResetLastError();
35280 if (mem_base != xmlMemBlocks()) {
35281 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035283 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035284 printf(" %d", n_code);
35285 printf("\n");
35286 }
35287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035288 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035289#endif
35290
Daniel Veillard42595322004-11-08 10:52:06 +000035291 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035292}
35293
35294
35295static int
35296test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035297 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035298
35299#ifdef LIBXML_UNICODE_ENABLED
35300 int mem_base;
35301 int ret_val;
35302 int code; /* UCS code point */
35303 int n_code;
35304
35305 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35306 mem_base = xmlMemBlocks();
35307 code = gen_int(n_code, 0);
35308
35309 ret_val = xmlUCSIsCatLu(code);
35310 desret_int(ret_val);
35311 call_tests++;
35312 des_int(n_code, code, 0);
35313 xmlResetLastError();
35314 if (mem_base != xmlMemBlocks()) {
35315 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035317 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035318 printf(" %d", n_code);
35319 printf("\n");
35320 }
35321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035322 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035323#endif
35324
Daniel Veillard42595322004-11-08 10:52:06 +000035325 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035326}
35327
35328
35329static int
35330test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035331 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035332
35333#ifdef LIBXML_UNICODE_ENABLED
35334 int mem_base;
35335 int ret_val;
35336 int code; /* UCS code point */
35337 int n_code;
35338
35339 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35340 mem_base = xmlMemBlocks();
35341 code = gen_int(n_code, 0);
35342
35343 ret_val = xmlUCSIsCatM(code);
35344 desret_int(ret_val);
35345 call_tests++;
35346 des_int(n_code, code, 0);
35347 xmlResetLastError();
35348 if (mem_base != xmlMemBlocks()) {
35349 printf("Leak of %d blocks found in xmlUCSIsCatM",
35350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035351 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035352 printf(" %d", n_code);
35353 printf("\n");
35354 }
35355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035356 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035357#endif
35358
Daniel Veillard42595322004-11-08 10:52:06 +000035359 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035360}
35361
35362
35363static int
35364test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035365 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035366
35367#ifdef LIBXML_UNICODE_ENABLED
35368 int mem_base;
35369 int ret_val;
35370 int code; /* UCS code point */
35371 int n_code;
35372
35373 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35374 mem_base = xmlMemBlocks();
35375 code = gen_int(n_code, 0);
35376
35377 ret_val = xmlUCSIsCatMc(code);
35378 desret_int(ret_val);
35379 call_tests++;
35380 des_int(n_code, code, 0);
35381 xmlResetLastError();
35382 if (mem_base != xmlMemBlocks()) {
35383 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035385 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035386 printf(" %d", n_code);
35387 printf("\n");
35388 }
35389 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035390 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035391#endif
35392
Daniel Veillard42595322004-11-08 10:52:06 +000035393 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035394}
35395
35396
35397static int
35398test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035399 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035400
35401#ifdef LIBXML_UNICODE_ENABLED
35402 int mem_base;
35403 int ret_val;
35404 int code; /* UCS code point */
35405 int n_code;
35406
35407 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35408 mem_base = xmlMemBlocks();
35409 code = gen_int(n_code, 0);
35410
35411 ret_val = xmlUCSIsCatMe(code);
35412 desret_int(ret_val);
35413 call_tests++;
35414 des_int(n_code, code, 0);
35415 xmlResetLastError();
35416 if (mem_base != xmlMemBlocks()) {
35417 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035419 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035420 printf(" %d", n_code);
35421 printf("\n");
35422 }
35423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035424 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035425#endif
35426
Daniel Veillard42595322004-11-08 10:52:06 +000035427 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035428}
35429
35430
35431static int
35432test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035433 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035434
35435#ifdef LIBXML_UNICODE_ENABLED
35436 int mem_base;
35437 int ret_val;
35438 int code; /* UCS code point */
35439 int n_code;
35440
35441 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35442 mem_base = xmlMemBlocks();
35443 code = gen_int(n_code, 0);
35444
35445 ret_val = xmlUCSIsCatMn(code);
35446 desret_int(ret_val);
35447 call_tests++;
35448 des_int(n_code, code, 0);
35449 xmlResetLastError();
35450 if (mem_base != xmlMemBlocks()) {
35451 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035453 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035454 printf(" %d", n_code);
35455 printf("\n");
35456 }
35457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035458 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035459#endif
35460
Daniel Veillard42595322004-11-08 10:52:06 +000035461 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035462}
35463
35464
35465static int
35466test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035467 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035468
35469#ifdef LIBXML_UNICODE_ENABLED
35470 int mem_base;
35471 int ret_val;
35472 int code; /* UCS code point */
35473 int n_code;
35474
35475 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35476 mem_base = xmlMemBlocks();
35477 code = gen_int(n_code, 0);
35478
35479 ret_val = xmlUCSIsCatN(code);
35480 desret_int(ret_val);
35481 call_tests++;
35482 des_int(n_code, code, 0);
35483 xmlResetLastError();
35484 if (mem_base != xmlMemBlocks()) {
35485 printf("Leak of %d blocks found in xmlUCSIsCatN",
35486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035487 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035488 printf(" %d", n_code);
35489 printf("\n");
35490 }
35491 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035492 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035493#endif
35494
Daniel Veillard42595322004-11-08 10:52:06 +000035495 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035496}
35497
35498
35499static int
35500test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035501 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035502
35503#ifdef LIBXML_UNICODE_ENABLED
35504 int mem_base;
35505 int ret_val;
35506 int code; /* UCS code point */
35507 int n_code;
35508
35509 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35510 mem_base = xmlMemBlocks();
35511 code = gen_int(n_code, 0);
35512
35513 ret_val = xmlUCSIsCatNd(code);
35514 desret_int(ret_val);
35515 call_tests++;
35516 des_int(n_code, code, 0);
35517 xmlResetLastError();
35518 if (mem_base != xmlMemBlocks()) {
35519 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035521 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035522 printf(" %d", n_code);
35523 printf("\n");
35524 }
35525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035526 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035527#endif
35528
Daniel Veillard42595322004-11-08 10:52:06 +000035529 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035530}
35531
35532
35533static int
35534test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035535 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035536
35537#ifdef LIBXML_UNICODE_ENABLED
35538 int mem_base;
35539 int ret_val;
35540 int code; /* UCS code point */
35541 int n_code;
35542
35543 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35544 mem_base = xmlMemBlocks();
35545 code = gen_int(n_code, 0);
35546
35547 ret_val = xmlUCSIsCatNl(code);
35548 desret_int(ret_val);
35549 call_tests++;
35550 des_int(n_code, code, 0);
35551 xmlResetLastError();
35552 if (mem_base != xmlMemBlocks()) {
35553 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035555 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035556 printf(" %d", n_code);
35557 printf("\n");
35558 }
35559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035560 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035561#endif
35562
Daniel Veillard42595322004-11-08 10:52:06 +000035563 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035564}
35565
35566
35567static int
35568test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035569 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035570
35571#ifdef LIBXML_UNICODE_ENABLED
35572 int mem_base;
35573 int ret_val;
35574 int code; /* UCS code point */
35575 int n_code;
35576
35577 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35578 mem_base = xmlMemBlocks();
35579 code = gen_int(n_code, 0);
35580
35581 ret_val = xmlUCSIsCatNo(code);
35582 desret_int(ret_val);
35583 call_tests++;
35584 des_int(n_code, code, 0);
35585 xmlResetLastError();
35586 if (mem_base != xmlMemBlocks()) {
35587 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035589 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035590 printf(" %d", n_code);
35591 printf("\n");
35592 }
35593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035594 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035595#endif
35596
Daniel Veillard42595322004-11-08 10:52:06 +000035597 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035598}
35599
35600
35601static int
35602test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035603 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035604
35605#ifdef LIBXML_UNICODE_ENABLED
35606 int mem_base;
35607 int ret_val;
35608 int code; /* UCS code point */
35609 int n_code;
35610
35611 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35612 mem_base = xmlMemBlocks();
35613 code = gen_int(n_code, 0);
35614
35615 ret_val = xmlUCSIsCatP(code);
35616 desret_int(ret_val);
35617 call_tests++;
35618 des_int(n_code, code, 0);
35619 xmlResetLastError();
35620 if (mem_base != xmlMemBlocks()) {
35621 printf("Leak of %d blocks found in xmlUCSIsCatP",
35622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035623 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035624 printf(" %d", n_code);
35625 printf("\n");
35626 }
35627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035628 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035629#endif
35630
Daniel Veillard42595322004-11-08 10:52:06 +000035631 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035632}
35633
35634
35635static int
35636test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035637 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035638
35639#ifdef LIBXML_UNICODE_ENABLED
35640 int mem_base;
35641 int ret_val;
35642 int code; /* UCS code point */
35643 int n_code;
35644
35645 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35646 mem_base = xmlMemBlocks();
35647 code = gen_int(n_code, 0);
35648
35649 ret_val = xmlUCSIsCatPc(code);
35650 desret_int(ret_val);
35651 call_tests++;
35652 des_int(n_code, code, 0);
35653 xmlResetLastError();
35654 if (mem_base != xmlMemBlocks()) {
35655 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035657 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035658 printf(" %d", n_code);
35659 printf("\n");
35660 }
35661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035662 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035663#endif
35664
Daniel Veillard42595322004-11-08 10:52:06 +000035665 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035666}
35667
35668
35669static int
35670test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035671 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035672
35673#ifdef LIBXML_UNICODE_ENABLED
35674 int mem_base;
35675 int ret_val;
35676 int code; /* UCS code point */
35677 int n_code;
35678
35679 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35680 mem_base = xmlMemBlocks();
35681 code = gen_int(n_code, 0);
35682
35683 ret_val = xmlUCSIsCatPd(code);
35684 desret_int(ret_val);
35685 call_tests++;
35686 des_int(n_code, code, 0);
35687 xmlResetLastError();
35688 if (mem_base != xmlMemBlocks()) {
35689 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035691 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035692 printf(" %d", n_code);
35693 printf("\n");
35694 }
35695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035696 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035697#endif
35698
Daniel Veillard42595322004-11-08 10:52:06 +000035699 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035700}
35701
35702
35703static int
35704test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035705 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035706
35707#ifdef LIBXML_UNICODE_ENABLED
35708 int mem_base;
35709 int ret_val;
35710 int code; /* UCS code point */
35711 int n_code;
35712
35713 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35714 mem_base = xmlMemBlocks();
35715 code = gen_int(n_code, 0);
35716
35717 ret_val = xmlUCSIsCatPe(code);
35718 desret_int(ret_val);
35719 call_tests++;
35720 des_int(n_code, code, 0);
35721 xmlResetLastError();
35722 if (mem_base != xmlMemBlocks()) {
35723 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035725 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035726 printf(" %d", n_code);
35727 printf("\n");
35728 }
35729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035730 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035731#endif
35732
Daniel Veillard42595322004-11-08 10:52:06 +000035733 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035734}
35735
35736
35737static int
35738test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035739 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035740
35741#ifdef LIBXML_UNICODE_ENABLED
35742 int mem_base;
35743 int ret_val;
35744 int code; /* UCS code point */
35745 int n_code;
35746
35747 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35748 mem_base = xmlMemBlocks();
35749 code = gen_int(n_code, 0);
35750
35751 ret_val = xmlUCSIsCatPf(code);
35752 desret_int(ret_val);
35753 call_tests++;
35754 des_int(n_code, code, 0);
35755 xmlResetLastError();
35756 if (mem_base != xmlMemBlocks()) {
35757 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035759 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035760 printf(" %d", n_code);
35761 printf("\n");
35762 }
35763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035764 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035765#endif
35766
Daniel Veillard42595322004-11-08 10:52:06 +000035767 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035768}
35769
35770
35771static int
35772test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035773 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035774
35775#ifdef LIBXML_UNICODE_ENABLED
35776 int mem_base;
35777 int ret_val;
35778 int code; /* UCS code point */
35779 int n_code;
35780
35781 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35782 mem_base = xmlMemBlocks();
35783 code = gen_int(n_code, 0);
35784
35785 ret_val = xmlUCSIsCatPi(code);
35786 desret_int(ret_val);
35787 call_tests++;
35788 des_int(n_code, code, 0);
35789 xmlResetLastError();
35790 if (mem_base != xmlMemBlocks()) {
35791 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035793 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035794 printf(" %d", n_code);
35795 printf("\n");
35796 }
35797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035798 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035799#endif
35800
Daniel Veillard42595322004-11-08 10:52:06 +000035801 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035802}
35803
35804
35805static int
35806test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035807 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035808
35809#ifdef LIBXML_UNICODE_ENABLED
35810 int mem_base;
35811 int ret_val;
35812 int code; /* UCS code point */
35813 int n_code;
35814
35815 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35816 mem_base = xmlMemBlocks();
35817 code = gen_int(n_code, 0);
35818
35819 ret_val = xmlUCSIsCatPo(code);
35820 desret_int(ret_val);
35821 call_tests++;
35822 des_int(n_code, code, 0);
35823 xmlResetLastError();
35824 if (mem_base != xmlMemBlocks()) {
35825 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035827 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035828 printf(" %d", n_code);
35829 printf("\n");
35830 }
35831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035832 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035833#endif
35834
Daniel Veillard42595322004-11-08 10:52:06 +000035835 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035836}
35837
35838
35839static int
35840test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035841 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035842
35843#ifdef LIBXML_UNICODE_ENABLED
35844 int mem_base;
35845 int ret_val;
35846 int code; /* UCS code point */
35847 int n_code;
35848
35849 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35850 mem_base = xmlMemBlocks();
35851 code = gen_int(n_code, 0);
35852
35853 ret_val = xmlUCSIsCatPs(code);
35854 desret_int(ret_val);
35855 call_tests++;
35856 des_int(n_code, code, 0);
35857 xmlResetLastError();
35858 if (mem_base != xmlMemBlocks()) {
35859 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035861 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035862 printf(" %d", n_code);
35863 printf("\n");
35864 }
35865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035866 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035867#endif
35868
Daniel Veillard42595322004-11-08 10:52:06 +000035869 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035870}
35871
35872
35873static int
35874test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035875 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035876
35877#ifdef LIBXML_UNICODE_ENABLED
35878 int mem_base;
35879 int ret_val;
35880 int code; /* UCS code point */
35881 int n_code;
35882
35883 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35884 mem_base = xmlMemBlocks();
35885 code = gen_int(n_code, 0);
35886
35887 ret_val = xmlUCSIsCatS(code);
35888 desret_int(ret_val);
35889 call_tests++;
35890 des_int(n_code, code, 0);
35891 xmlResetLastError();
35892 if (mem_base != xmlMemBlocks()) {
35893 printf("Leak of %d blocks found in xmlUCSIsCatS",
35894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035895 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035896 printf(" %d", n_code);
35897 printf("\n");
35898 }
35899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035900 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035901#endif
35902
Daniel Veillard42595322004-11-08 10:52:06 +000035903 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035904}
35905
35906
35907static int
35908test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035909 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035910
35911#ifdef LIBXML_UNICODE_ENABLED
35912 int mem_base;
35913 int ret_val;
35914 int code; /* UCS code point */
35915 int n_code;
35916
35917 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35918 mem_base = xmlMemBlocks();
35919 code = gen_int(n_code, 0);
35920
35921 ret_val = xmlUCSIsCatSc(code);
35922 desret_int(ret_val);
35923 call_tests++;
35924 des_int(n_code, code, 0);
35925 xmlResetLastError();
35926 if (mem_base != xmlMemBlocks()) {
35927 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035929 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035930 printf(" %d", n_code);
35931 printf("\n");
35932 }
35933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035934 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035935#endif
35936
Daniel Veillard42595322004-11-08 10:52:06 +000035937 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035938}
35939
35940
35941static int
35942test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035943 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035944
35945#ifdef LIBXML_UNICODE_ENABLED
35946 int mem_base;
35947 int ret_val;
35948 int code; /* UCS code point */
35949 int n_code;
35950
35951 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35952 mem_base = xmlMemBlocks();
35953 code = gen_int(n_code, 0);
35954
35955 ret_val = xmlUCSIsCatSk(code);
35956 desret_int(ret_val);
35957 call_tests++;
35958 des_int(n_code, code, 0);
35959 xmlResetLastError();
35960 if (mem_base != xmlMemBlocks()) {
35961 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035963 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035964 printf(" %d", n_code);
35965 printf("\n");
35966 }
35967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035968 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035969#endif
35970
Daniel Veillard42595322004-11-08 10:52:06 +000035971 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035972}
35973
35974
35975static int
35976test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035977 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035978
35979#ifdef LIBXML_UNICODE_ENABLED
35980 int mem_base;
35981 int ret_val;
35982 int code; /* UCS code point */
35983 int n_code;
35984
35985 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35986 mem_base = xmlMemBlocks();
35987 code = gen_int(n_code, 0);
35988
35989 ret_val = xmlUCSIsCatSm(code);
35990 desret_int(ret_val);
35991 call_tests++;
35992 des_int(n_code, code, 0);
35993 xmlResetLastError();
35994 if (mem_base != xmlMemBlocks()) {
35995 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035997 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035998 printf(" %d", n_code);
35999 printf("\n");
36000 }
36001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036002 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036003#endif
36004
Daniel Veillard42595322004-11-08 10:52:06 +000036005 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036006}
36007
36008
36009static int
36010test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036011 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036012
36013#ifdef LIBXML_UNICODE_ENABLED
36014 int mem_base;
36015 int ret_val;
36016 int code; /* UCS code point */
36017 int n_code;
36018
36019 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36020 mem_base = xmlMemBlocks();
36021 code = gen_int(n_code, 0);
36022
36023 ret_val = xmlUCSIsCatSo(code);
36024 desret_int(ret_val);
36025 call_tests++;
36026 des_int(n_code, code, 0);
36027 xmlResetLastError();
36028 if (mem_base != xmlMemBlocks()) {
36029 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036031 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036032 printf(" %d", n_code);
36033 printf("\n");
36034 }
36035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036036 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036037#endif
36038
Daniel Veillard42595322004-11-08 10:52:06 +000036039 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036040}
36041
36042
36043static int
36044test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036045 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036046
36047#ifdef LIBXML_UNICODE_ENABLED
36048 int mem_base;
36049 int ret_val;
36050 int code; /* UCS code point */
36051 int n_code;
36052
36053 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36054 mem_base = xmlMemBlocks();
36055 code = gen_int(n_code, 0);
36056
36057 ret_val = xmlUCSIsCatZ(code);
36058 desret_int(ret_val);
36059 call_tests++;
36060 des_int(n_code, code, 0);
36061 xmlResetLastError();
36062 if (mem_base != xmlMemBlocks()) {
36063 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036065 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036066 printf(" %d", n_code);
36067 printf("\n");
36068 }
36069 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036070 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036071#endif
36072
Daniel Veillard42595322004-11-08 10:52:06 +000036073 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036074}
36075
36076
36077static int
36078test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036079 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036080
36081#ifdef LIBXML_UNICODE_ENABLED
36082 int mem_base;
36083 int ret_val;
36084 int code; /* UCS code point */
36085 int n_code;
36086
36087 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36088 mem_base = xmlMemBlocks();
36089 code = gen_int(n_code, 0);
36090
36091 ret_val = xmlUCSIsCatZl(code);
36092 desret_int(ret_val);
36093 call_tests++;
36094 des_int(n_code, code, 0);
36095 xmlResetLastError();
36096 if (mem_base != xmlMemBlocks()) {
36097 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036099 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036100 printf(" %d", n_code);
36101 printf("\n");
36102 }
36103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036104 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036105#endif
36106
Daniel Veillard42595322004-11-08 10:52:06 +000036107 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036108}
36109
36110
36111static int
36112test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036113 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036114
36115#ifdef LIBXML_UNICODE_ENABLED
36116 int mem_base;
36117 int ret_val;
36118 int code; /* UCS code point */
36119 int n_code;
36120
36121 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36122 mem_base = xmlMemBlocks();
36123 code = gen_int(n_code, 0);
36124
36125 ret_val = xmlUCSIsCatZp(code);
36126 desret_int(ret_val);
36127 call_tests++;
36128 des_int(n_code, code, 0);
36129 xmlResetLastError();
36130 if (mem_base != xmlMemBlocks()) {
36131 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036133 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036134 printf(" %d", n_code);
36135 printf("\n");
36136 }
36137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036138 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036139#endif
36140
Daniel Veillard42595322004-11-08 10:52:06 +000036141 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036142}
36143
36144
36145static int
36146test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036147 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036148
36149#ifdef LIBXML_UNICODE_ENABLED
36150 int mem_base;
36151 int ret_val;
36152 int code; /* UCS code point */
36153 int n_code;
36154
36155 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36156 mem_base = xmlMemBlocks();
36157 code = gen_int(n_code, 0);
36158
36159 ret_val = xmlUCSIsCatZs(code);
36160 desret_int(ret_val);
36161 call_tests++;
36162 des_int(n_code, code, 0);
36163 xmlResetLastError();
36164 if (mem_base != xmlMemBlocks()) {
36165 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036167 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036168 printf(" %d", n_code);
36169 printf("\n");
36170 }
36171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036172 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036173#endif
36174
Daniel Veillard42595322004-11-08 10:52:06 +000036175 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036176}
36177
36178
36179static int
36180test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036181 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036182
36183#ifdef LIBXML_UNICODE_ENABLED
36184 int mem_base;
36185 int ret_val;
36186 int code; /* UCS code point */
36187 int n_code;
36188
36189 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36190 mem_base = xmlMemBlocks();
36191 code = gen_int(n_code, 0);
36192
36193 ret_val = xmlUCSIsCherokee(code);
36194 desret_int(ret_val);
36195 call_tests++;
36196 des_int(n_code, code, 0);
36197 xmlResetLastError();
36198 if (mem_base != xmlMemBlocks()) {
36199 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036201 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036202 printf(" %d", n_code);
36203 printf("\n");
36204 }
36205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036206 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036207#endif
36208
Daniel Veillard42595322004-11-08 10:52:06 +000036209 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036210}
36211
36212
36213static int
36214test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036215 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036216
36217#ifdef LIBXML_UNICODE_ENABLED
36218 int mem_base;
36219 int ret_val;
36220 int code; /* UCS code point */
36221 int n_code;
36222
36223 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36224 mem_base = xmlMemBlocks();
36225 code = gen_int(n_code, 0);
36226
36227 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36228 desret_int(ret_val);
36229 call_tests++;
36230 des_int(n_code, code, 0);
36231 xmlResetLastError();
36232 if (mem_base != xmlMemBlocks()) {
36233 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036235 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036236 printf(" %d", n_code);
36237 printf("\n");
36238 }
36239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036240 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036241#endif
36242
Daniel Veillard42595322004-11-08 10:52:06 +000036243 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036244}
36245
36246
36247static int
36248test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036249 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036250
36251#ifdef LIBXML_UNICODE_ENABLED
36252 int mem_base;
36253 int ret_val;
36254 int code; /* UCS code point */
36255 int n_code;
36256
36257 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36258 mem_base = xmlMemBlocks();
36259 code = gen_int(n_code, 0);
36260
36261 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36262 desret_int(ret_val);
36263 call_tests++;
36264 des_int(n_code, code, 0);
36265 xmlResetLastError();
36266 if (mem_base != xmlMemBlocks()) {
36267 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036269 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036270 printf(" %d", n_code);
36271 printf("\n");
36272 }
36273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036274 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036275#endif
36276
Daniel Veillard42595322004-11-08 10:52:06 +000036277 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036278}
36279
36280
36281static int
36282test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036283 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036284
36285#ifdef LIBXML_UNICODE_ENABLED
36286 int mem_base;
36287 int ret_val;
36288 int code; /* UCS code point */
36289 int n_code;
36290
36291 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36292 mem_base = xmlMemBlocks();
36293 code = gen_int(n_code, 0);
36294
36295 ret_val = xmlUCSIsCombiningHalfMarks(code);
36296 desret_int(ret_val);
36297 call_tests++;
36298 des_int(n_code, code, 0);
36299 xmlResetLastError();
36300 if (mem_base != xmlMemBlocks()) {
36301 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036303 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036304 printf(" %d", n_code);
36305 printf("\n");
36306 }
36307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036308 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036309#endif
36310
Daniel Veillard42595322004-11-08 10:52:06 +000036311 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036312}
36313
36314
36315static int
36316test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036317 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036318
36319#ifdef LIBXML_UNICODE_ENABLED
36320 int mem_base;
36321 int ret_val;
36322 int code; /* UCS code point */
36323 int n_code;
36324
36325 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36326 mem_base = xmlMemBlocks();
36327 code = gen_int(n_code, 0);
36328
36329 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36330 desret_int(ret_val);
36331 call_tests++;
36332 des_int(n_code, code, 0);
36333 xmlResetLastError();
36334 if (mem_base != xmlMemBlocks()) {
36335 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036337 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036338 printf(" %d", n_code);
36339 printf("\n");
36340 }
36341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036342 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036343#endif
36344
Daniel Veillard42595322004-11-08 10:52:06 +000036345 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036346}
36347
36348
36349static int
36350test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036351 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036352
36353#ifdef LIBXML_UNICODE_ENABLED
36354 int mem_base;
36355 int ret_val;
36356 int code; /* UCS code point */
36357 int n_code;
36358
36359 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36360 mem_base = xmlMemBlocks();
36361 code = gen_int(n_code, 0);
36362
36363 ret_val = xmlUCSIsControlPictures(code);
36364 desret_int(ret_val);
36365 call_tests++;
36366 des_int(n_code, code, 0);
36367 xmlResetLastError();
36368 if (mem_base != xmlMemBlocks()) {
36369 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036371 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036372 printf(" %d", n_code);
36373 printf("\n");
36374 }
36375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036376 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036377#endif
36378
Daniel Veillard42595322004-11-08 10:52:06 +000036379 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036380}
36381
36382
36383static int
36384test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036385 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036386
36387#ifdef LIBXML_UNICODE_ENABLED
36388 int mem_base;
36389 int ret_val;
36390 int code; /* UCS code point */
36391 int n_code;
36392
36393 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36394 mem_base = xmlMemBlocks();
36395 code = gen_int(n_code, 0);
36396
36397 ret_val = xmlUCSIsCurrencySymbols(code);
36398 desret_int(ret_val);
36399 call_tests++;
36400 des_int(n_code, code, 0);
36401 xmlResetLastError();
36402 if (mem_base != xmlMemBlocks()) {
36403 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036405 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036406 printf(" %d", n_code);
36407 printf("\n");
36408 }
36409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036410 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036411#endif
36412
Daniel Veillard42595322004-11-08 10:52:06 +000036413 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036414}
36415
36416
36417static int
36418test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036419 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036420
36421#ifdef LIBXML_UNICODE_ENABLED
36422 int mem_base;
36423 int ret_val;
36424 int code; /* UCS code point */
36425 int n_code;
36426
36427 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36428 mem_base = xmlMemBlocks();
36429 code = gen_int(n_code, 0);
36430
36431 ret_val = xmlUCSIsCypriotSyllabary(code);
36432 desret_int(ret_val);
36433 call_tests++;
36434 des_int(n_code, code, 0);
36435 xmlResetLastError();
36436 if (mem_base != xmlMemBlocks()) {
36437 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036439 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036440 printf(" %d", n_code);
36441 printf("\n");
36442 }
36443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036444 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036445#endif
36446
Daniel Veillard42595322004-11-08 10:52:06 +000036447 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036448}
36449
36450
36451static int
36452test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036453 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036454
36455#ifdef LIBXML_UNICODE_ENABLED
36456 int mem_base;
36457 int ret_val;
36458 int code; /* UCS code point */
36459 int n_code;
36460
36461 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36462 mem_base = xmlMemBlocks();
36463 code = gen_int(n_code, 0);
36464
36465 ret_val = xmlUCSIsCyrillic(code);
36466 desret_int(ret_val);
36467 call_tests++;
36468 des_int(n_code, code, 0);
36469 xmlResetLastError();
36470 if (mem_base != xmlMemBlocks()) {
36471 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036473 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036474 printf(" %d", n_code);
36475 printf("\n");
36476 }
36477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036478 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036479#endif
36480
Daniel Veillard42595322004-11-08 10:52:06 +000036481 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036482}
36483
36484
36485static int
36486test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036487 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036488
36489#ifdef LIBXML_UNICODE_ENABLED
36490 int mem_base;
36491 int ret_val;
36492 int code; /* UCS code point */
36493 int n_code;
36494
36495 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36496 mem_base = xmlMemBlocks();
36497 code = gen_int(n_code, 0);
36498
36499 ret_val = xmlUCSIsCyrillicSupplement(code);
36500 desret_int(ret_val);
36501 call_tests++;
36502 des_int(n_code, code, 0);
36503 xmlResetLastError();
36504 if (mem_base != xmlMemBlocks()) {
36505 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036507 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036508 printf(" %d", n_code);
36509 printf("\n");
36510 }
36511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036512 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036513#endif
36514
Daniel Veillard42595322004-11-08 10:52:06 +000036515 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036516}
36517
36518
36519static int
36520test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036521 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036522
36523#ifdef LIBXML_UNICODE_ENABLED
36524 int mem_base;
36525 int ret_val;
36526 int code; /* UCS code point */
36527 int n_code;
36528
36529 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36530 mem_base = xmlMemBlocks();
36531 code = gen_int(n_code, 0);
36532
36533 ret_val = xmlUCSIsDeseret(code);
36534 desret_int(ret_val);
36535 call_tests++;
36536 des_int(n_code, code, 0);
36537 xmlResetLastError();
36538 if (mem_base != xmlMemBlocks()) {
36539 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036541 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036542 printf(" %d", n_code);
36543 printf("\n");
36544 }
36545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036546 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036547#endif
36548
Daniel Veillard42595322004-11-08 10:52:06 +000036549 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036550}
36551
36552
36553static int
36554test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036555 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036556
36557#ifdef LIBXML_UNICODE_ENABLED
36558 int mem_base;
36559 int ret_val;
36560 int code; /* UCS code point */
36561 int n_code;
36562
36563 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36564 mem_base = xmlMemBlocks();
36565 code = gen_int(n_code, 0);
36566
36567 ret_val = xmlUCSIsDevanagari(code);
36568 desret_int(ret_val);
36569 call_tests++;
36570 des_int(n_code, code, 0);
36571 xmlResetLastError();
36572 if (mem_base != xmlMemBlocks()) {
36573 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036575 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036576 printf(" %d", n_code);
36577 printf("\n");
36578 }
36579 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036580 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036581#endif
36582
Daniel Veillard42595322004-11-08 10:52:06 +000036583 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036584}
36585
36586
36587static int
36588test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036589 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036590
36591#ifdef LIBXML_UNICODE_ENABLED
36592 int mem_base;
36593 int ret_val;
36594 int code; /* UCS code point */
36595 int n_code;
36596
36597 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36598 mem_base = xmlMemBlocks();
36599 code = gen_int(n_code, 0);
36600
36601 ret_val = xmlUCSIsDingbats(code);
36602 desret_int(ret_val);
36603 call_tests++;
36604 des_int(n_code, code, 0);
36605 xmlResetLastError();
36606 if (mem_base != xmlMemBlocks()) {
36607 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036609 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036610 printf(" %d", n_code);
36611 printf("\n");
36612 }
36613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036614 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036615#endif
36616
Daniel Veillard42595322004-11-08 10:52:06 +000036617 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036618}
36619
36620
36621static int
36622test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036623 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036624
36625#ifdef LIBXML_UNICODE_ENABLED
36626 int mem_base;
36627 int ret_val;
36628 int code; /* UCS code point */
36629 int n_code;
36630
36631 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36632 mem_base = xmlMemBlocks();
36633 code = gen_int(n_code, 0);
36634
36635 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36636 desret_int(ret_val);
36637 call_tests++;
36638 des_int(n_code, code, 0);
36639 xmlResetLastError();
36640 if (mem_base != xmlMemBlocks()) {
36641 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036643 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036644 printf(" %d", n_code);
36645 printf("\n");
36646 }
36647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036648 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036649#endif
36650
Daniel Veillard42595322004-11-08 10:52:06 +000036651 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036652}
36653
36654
36655static int
36656test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036657 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036658
36659#ifdef LIBXML_UNICODE_ENABLED
36660 int mem_base;
36661 int ret_val;
36662 int code; /* UCS code point */
36663 int n_code;
36664
36665 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36666 mem_base = xmlMemBlocks();
36667 code = gen_int(n_code, 0);
36668
36669 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36670 desret_int(ret_val);
36671 call_tests++;
36672 des_int(n_code, code, 0);
36673 xmlResetLastError();
36674 if (mem_base != xmlMemBlocks()) {
36675 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036677 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036678 printf(" %d", n_code);
36679 printf("\n");
36680 }
36681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036682 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036683#endif
36684
Daniel Veillard42595322004-11-08 10:52:06 +000036685 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036686}
36687
36688
36689static int
36690test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036691 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036692
36693#ifdef LIBXML_UNICODE_ENABLED
36694 int mem_base;
36695 int ret_val;
36696 int code; /* UCS code point */
36697 int n_code;
36698
36699 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36700 mem_base = xmlMemBlocks();
36701 code = gen_int(n_code, 0);
36702
36703 ret_val = xmlUCSIsEthiopic(code);
36704 desret_int(ret_val);
36705 call_tests++;
36706 des_int(n_code, code, 0);
36707 xmlResetLastError();
36708 if (mem_base != xmlMemBlocks()) {
36709 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036711 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036712 printf(" %d", n_code);
36713 printf("\n");
36714 }
36715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036716 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036717#endif
36718
Daniel Veillard42595322004-11-08 10:52:06 +000036719 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036720}
36721
36722
36723static int
36724test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036725 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036726
36727#ifdef LIBXML_UNICODE_ENABLED
36728 int mem_base;
36729 int ret_val;
36730 int code; /* UCS code point */
36731 int n_code;
36732
36733 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36734 mem_base = xmlMemBlocks();
36735 code = gen_int(n_code, 0);
36736
36737 ret_val = xmlUCSIsGeneralPunctuation(code);
36738 desret_int(ret_val);
36739 call_tests++;
36740 des_int(n_code, code, 0);
36741 xmlResetLastError();
36742 if (mem_base != xmlMemBlocks()) {
36743 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036745 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036746 printf(" %d", n_code);
36747 printf("\n");
36748 }
36749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036750 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036751#endif
36752
Daniel Veillard42595322004-11-08 10:52:06 +000036753 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036754}
36755
36756
36757static int
36758test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036759 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036760
36761#ifdef LIBXML_UNICODE_ENABLED
36762 int mem_base;
36763 int ret_val;
36764 int code; /* UCS code point */
36765 int n_code;
36766
36767 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36768 mem_base = xmlMemBlocks();
36769 code = gen_int(n_code, 0);
36770
36771 ret_val = xmlUCSIsGeometricShapes(code);
36772 desret_int(ret_val);
36773 call_tests++;
36774 des_int(n_code, code, 0);
36775 xmlResetLastError();
36776 if (mem_base != xmlMemBlocks()) {
36777 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036779 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036780 printf(" %d", n_code);
36781 printf("\n");
36782 }
36783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036784 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036785#endif
36786
Daniel Veillard42595322004-11-08 10:52:06 +000036787 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036788}
36789
36790
36791static int
36792test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036793 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036794
36795#ifdef LIBXML_UNICODE_ENABLED
36796 int mem_base;
36797 int ret_val;
36798 int code; /* UCS code point */
36799 int n_code;
36800
36801 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36802 mem_base = xmlMemBlocks();
36803 code = gen_int(n_code, 0);
36804
36805 ret_val = xmlUCSIsGeorgian(code);
36806 desret_int(ret_val);
36807 call_tests++;
36808 des_int(n_code, code, 0);
36809 xmlResetLastError();
36810 if (mem_base != xmlMemBlocks()) {
36811 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036813 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036814 printf(" %d", n_code);
36815 printf("\n");
36816 }
36817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036818 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036819#endif
36820
Daniel Veillard42595322004-11-08 10:52:06 +000036821 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036822}
36823
36824
36825static int
36826test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036827 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036828
36829#ifdef LIBXML_UNICODE_ENABLED
36830 int mem_base;
36831 int ret_val;
36832 int code; /* UCS code point */
36833 int n_code;
36834
36835 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36836 mem_base = xmlMemBlocks();
36837 code = gen_int(n_code, 0);
36838
36839 ret_val = xmlUCSIsGothic(code);
36840 desret_int(ret_val);
36841 call_tests++;
36842 des_int(n_code, code, 0);
36843 xmlResetLastError();
36844 if (mem_base != xmlMemBlocks()) {
36845 printf("Leak of %d blocks found in xmlUCSIsGothic",
36846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036847 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036848 printf(" %d", n_code);
36849 printf("\n");
36850 }
36851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036852 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036853#endif
36854
Daniel Veillard42595322004-11-08 10:52:06 +000036855 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036856}
36857
36858
36859static int
36860test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036861 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036862
36863#ifdef LIBXML_UNICODE_ENABLED
36864 int mem_base;
36865 int ret_val;
36866 int code; /* UCS code point */
36867 int n_code;
36868
36869 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36870 mem_base = xmlMemBlocks();
36871 code = gen_int(n_code, 0);
36872
36873 ret_val = xmlUCSIsGreek(code);
36874 desret_int(ret_val);
36875 call_tests++;
36876 des_int(n_code, code, 0);
36877 xmlResetLastError();
36878 if (mem_base != xmlMemBlocks()) {
36879 printf("Leak of %d blocks found in xmlUCSIsGreek",
36880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036881 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036882 printf(" %d", n_code);
36883 printf("\n");
36884 }
36885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036886 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036887#endif
36888
Daniel Veillard42595322004-11-08 10:52:06 +000036889 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036890}
36891
36892
36893static int
36894test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036895 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036896
36897#ifdef LIBXML_UNICODE_ENABLED
36898 int mem_base;
36899 int ret_val;
36900 int code; /* UCS code point */
36901 int n_code;
36902
36903 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36904 mem_base = xmlMemBlocks();
36905 code = gen_int(n_code, 0);
36906
36907 ret_val = xmlUCSIsGreekExtended(code);
36908 desret_int(ret_val);
36909 call_tests++;
36910 des_int(n_code, code, 0);
36911 xmlResetLastError();
36912 if (mem_base != xmlMemBlocks()) {
36913 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036915 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036916 printf(" %d", n_code);
36917 printf("\n");
36918 }
36919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036920 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036921#endif
36922
Daniel Veillard42595322004-11-08 10:52:06 +000036923 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036924}
36925
36926
36927static int
36928test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036929 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036930
36931#ifdef LIBXML_UNICODE_ENABLED
36932 int mem_base;
36933 int ret_val;
36934 int code; /* UCS code point */
36935 int n_code;
36936
36937 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36938 mem_base = xmlMemBlocks();
36939 code = gen_int(n_code, 0);
36940
36941 ret_val = xmlUCSIsGreekandCoptic(code);
36942 desret_int(ret_val);
36943 call_tests++;
36944 des_int(n_code, code, 0);
36945 xmlResetLastError();
36946 if (mem_base != xmlMemBlocks()) {
36947 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036949 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036950 printf(" %d", n_code);
36951 printf("\n");
36952 }
36953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036954 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036955#endif
36956
Daniel Veillard42595322004-11-08 10:52:06 +000036957 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036958}
36959
36960
36961static int
36962test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036963 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036964
36965#ifdef LIBXML_UNICODE_ENABLED
36966 int mem_base;
36967 int ret_val;
36968 int code; /* UCS code point */
36969 int n_code;
36970
36971 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36972 mem_base = xmlMemBlocks();
36973 code = gen_int(n_code, 0);
36974
36975 ret_val = xmlUCSIsGujarati(code);
36976 desret_int(ret_val);
36977 call_tests++;
36978 des_int(n_code, code, 0);
36979 xmlResetLastError();
36980 if (mem_base != xmlMemBlocks()) {
36981 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036983 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036984 printf(" %d", n_code);
36985 printf("\n");
36986 }
36987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036988 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036989#endif
36990
Daniel Veillard42595322004-11-08 10:52:06 +000036991 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036992}
36993
36994
36995static int
36996test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036997 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036998
36999#ifdef LIBXML_UNICODE_ENABLED
37000 int mem_base;
37001 int ret_val;
37002 int code; /* UCS code point */
37003 int n_code;
37004
37005 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37006 mem_base = xmlMemBlocks();
37007 code = gen_int(n_code, 0);
37008
37009 ret_val = xmlUCSIsGurmukhi(code);
37010 desret_int(ret_val);
37011 call_tests++;
37012 des_int(n_code, code, 0);
37013 xmlResetLastError();
37014 if (mem_base != xmlMemBlocks()) {
37015 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037017 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037018 printf(" %d", n_code);
37019 printf("\n");
37020 }
37021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037022 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037023#endif
37024
Daniel Veillard42595322004-11-08 10:52:06 +000037025 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037026}
37027
37028
37029static int
37030test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037031 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037032
37033#ifdef LIBXML_UNICODE_ENABLED
37034 int mem_base;
37035 int ret_val;
37036 int code; /* UCS code point */
37037 int n_code;
37038
37039 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37040 mem_base = xmlMemBlocks();
37041 code = gen_int(n_code, 0);
37042
37043 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37044 desret_int(ret_val);
37045 call_tests++;
37046 des_int(n_code, code, 0);
37047 xmlResetLastError();
37048 if (mem_base != xmlMemBlocks()) {
37049 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037051 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037052 printf(" %d", n_code);
37053 printf("\n");
37054 }
37055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037056 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037057#endif
37058
Daniel Veillard42595322004-11-08 10:52:06 +000037059 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037060}
37061
37062
37063static int
37064test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037065 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037066
37067#ifdef LIBXML_UNICODE_ENABLED
37068 int mem_base;
37069 int ret_val;
37070 int code; /* UCS code point */
37071 int n_code;
37072
37073 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37074 mem_base = xmlMemBlocks();
37075 code = gen_int(n_code, 0);
37076
37077 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37078 desret_int(ret_val);
37079 call_tests++;
37080 des_int(n_code, code, 0);
37081 xmlResetLastError();
37082 if (mem_base != xmlMemBlocks()) {
37083 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037085 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037086 printf(" %d", n_code);
37087 printf("\n");
37088 }
37089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037090 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037091#endif
37092
Daniel Veillard42595322004-11-08 10:52:06 +000037093 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037094}
37095
37096
37097static int
37098test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037099 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037100
37101#ifdef LIBXML_UNICODE_ENABLED
37102 int mem_base;
37103 int ret_val;
37104 int code; /* UCS code point */
37105 int n_code;
37106
37107 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37108 mem_base = xmlMemBlocks();
37109 code = gen_int(n_code, 0);
37110
37111 ret_val = xmlUCSIsHangulJamo(code);
37112 desret_int(ret_val);
37113 call_tests++;
37114 des_int(n_code, code, 0);
37115 xmlResetLastError();
37116 if (mem_base != xmlMemBlocks()) {
37117 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037119 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037120 printf(" %d", n_code);
37121 printf("\n");
37122 }
37123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037124 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037125#endif
37126
Daniel Veillard42595322004-11-08 10:52:06 +000037127 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037128}
37129
37130
37131static int
37132test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037133 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037134
37135#ifdef LIBXML_UNICODE_ENABLED
37136 int mem_base;
37137 int ret_val;
37138 int code; /* UCS code point */
37139 int n_code;
37140
37141 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37142 mem_base = xmlMemBlocks();
37143 code = gen_int(n_code, 0);
37144
37145 ret_val = xmlUCSIsHangulSyllables(code);
37146 desret_int(ret_val);
37147 call_tests++;
37148 des_int(n_code, code, 0);
37149 xmlResetLastError();
37150 if (mem_base != xmlMemBlocks()) {
37151 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037153 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037154 printf(" %d", n_code);
37155 printf("\n");
37156 }
37157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037158 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037159#endif
37160
Daniel Veillard42595322004-11-08 10:52:06 +000037161 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037162}
37163
37164
37165static int
37166test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037167 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037168
37169#ifdef LIBXML_UNICODE_ENABLED
37170 int mem_base;
37171 int ret_val;
37172 int code; /* UCS code point */
37173 int n_code;
37174
37175 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37176 mem_base = xmlMemBlocks();
37177 code = gen_int(n_code, 0);
37178
37179 ret_val = xmlUCSIsHanunoo(code);
37180 desret_int(ret_val);
37181 call_tests++;
37182 des_int(n_code, code, 0);
37183 xmlResetLastError();
37184 if (mem_base != xmlMemBlocks()) {
37185 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037187 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037188 printf(" %d", n_code);
37189 printf("\n");
37190 }
37191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037192 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037193#endif
37194
Daniel Veillard42595322004-11-08 10:52:06 +000037195 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037196}
37197
37198
37199static int
37200test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037201 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037202
37203#ifdef LIBXML_UNICODE_ENABLED
37204 int mem_base;
37205 int ret_val;
37206 int code; /* UCS code point */
37207 int n_code;
37208
37209 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37210 mem_base = xmlMemBlocks();
37211 code = gen_int(n_code, 0);
37212
37213 ret_val = xmlUCSIsHebrew(code);
37214 desret_int(ret_val);
37215 call_tests++;
37216 des_int(n_code, code, 0);
37217 xmlResetLastError();
37218 if (mem_base != xmlMemBlocks()) {
37219 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037221 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037222 printf(" %d", n_code);
37223 printf("\n");
37224 }
37225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037226 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037227#endif
37228
Daniel Veillard42595322004-11-08 10:52:06 +000037229 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037230}
37231
37232
37233static int
37234test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037235 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037236
37237#ifdef LIBXML_UNICODE_ENABLED
37238 int mem_base;
37239 int ret_val;
37240 int code; /* UCS code point */
37241 int n_code;
37242
37243 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37244 mem_base = xmlMemBlocks();
37245 code = gen_int(n_code, 0);
37246
37247 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37248 desret_int(ret_val);
37249 call_tests++;
37250 des_int(n_code, code, 0);
37251 xmlResetLastError();
37252 if (mem_base != xmlMemBlocks()) {
37253 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037255 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037256 printf(" %d", n_code);
37257 printf("\n");
37258 }
37259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037260 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037261#endif
37262
Daniel Veillard42595322004-11-08 10:52:06 +000037263 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037264}
37265
37266
37267static int
37268test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037269 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037270
37271#ifdef LIBXML_UNICODE_ENABLED
37272 int mem_base;
37273 int ret_val;
37274 int code; /* UCS code point */
37275 int n_code;
37276
37277 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37278 mem_base = xmlMemBlocks();
37279 code = gen_int(n_code, 0);
37280
37281 ret_val = xmlUCSIsHighSurrogates(code);
37282 desret_int(ret_val);
37283 call_tests++;
37284 des_int(n_code, code, 0);
37285 xmlResetLastError();
37286 if (mem_base != xmlMemBlocks()) {
37287 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037289 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037290 printf(" %d", n_code);
37291 printf("\n");
37292 }
37293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037294 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037295#endif
37296
Daniel Veillard42595322004-11-08 10:52:06 +000037297 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037298}
37299
37300
37301static int
37302test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037303 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037304
37305#ifdef LIBXML_UNICODE_ENABLED
37306 int mem_base;
37307 int ret_val;
37308 int code; /* UCS code point */
37309 int n_code;
37310
37311 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37312 mem_base = xmlMemBlocks();
37313 code = gen_int(n_code, 0);
37314
37315 ret_val = xmlUCSIsHiragana(code);
37316 desret_int(ret_val);
37317 call_tests++;
37318 des_int(n_code, code, 0);
37319 xmlResetLastError();
37320 if (mem_base != xmlMemBlocks()) {
37321 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037323 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037324 printf(" %d", n_code);
37325 printf("\n");
37326 }
37327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037328 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037329#endif
37330
Daniel Veillard42595322004-11-08 10:52:06 +000037331 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037332}
37333
37334
37335static int
37336test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037337 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037338
37339#ifdef LIBXML_UNICODE_ENABLED
37340 int mem_base;
37341 int ret_val;
37342 int code; /* UCS code point */
37343 int n_code;
37344
37345 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37346 mem_base = xmlMemBlocks();
37347 code = gen_int(n_code, 0);
37348
37349 ret_val = xmlUCSIsIPAExtensions(code);
37350 desret_int(ret_val);
37351 call_tests++;
37352 des_int(n_code, code, 0);
37353 xmlResetLastError();
37354 if (mem_base != xmlMemBlocks()) {
37355 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037357 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037358 printf(" %d", n_code);
37359 printf("\n");
37360 }
37361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037362 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037363#endif
37364
Daniel Veillard42595322004-11-08 10:52:06 +000037365 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037366}
37367
37368
37369static int
37370test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037371 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037372
37373#ifdef LIBXML_UNICODE_ENABLED
37374 int mem_base;
37375 int ret_val;
37376 int code; /* UCS code point */
37377 int n_code;
37378
37379 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37380 mem_base = xmlMemBlocks();
37381 code = gen_int(n_code, 0);
37382
37383 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37384 desret_int(ret_val);
37385 call_tests++;
37386 des_int(n_code, code, 0);
37387 xmlResetLastError();
37388 if (mem_base != xmlMemBlocks()) {
37389 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037391 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037392 printf(" %d", n_code);
37393 printf("\n");
37394 }
37395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037396 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037397#endif
37398
Daniel Veillard42595322004-11-08 10:52:06 +000037399 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037400}
37401
37402
37403static int
37404test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037405 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037406
37407#ifdef LIBXML_UNICODE_ENABLED
37408 int mem_base;
37409 int ret_val;
37410 int code; /* UCS code point */
37411 int n_code;
37412
37413 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37414 mem_base = xmlMemBlocks();
37415 code = gen_int(n_code, 0);
37416
37417 ret_val = xmlUCSIsKanbun(code);
37418 desret_int(ret_val);
37419 call_tests++;
37420 des_int(n_code, code, 0);
37421 xmlResetLastError();
37422 if (mem_base != xmlMemBlocks()) {
37423 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037425 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037426 printf(" %d", n_code);
37427 printf("\n");
37428 }
37429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037430 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037431#endif
37432
Daniel Veillard42595322004-11-08 10:52:06 +000037433 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037434}
37435
37436
37437static int
37438test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037439 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037440
37441#ifdef LIBXML_UNICODE_ENABLED
37442 int mem_base;
37443 int ret_val;
37444 int code; /* UCS code point */
37445 int n_code;
37446
37447 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37448 mem_base = xmlMemBlocks();
37449 code = gen_int(n_code, 0);
37450
37451 ret_val = xmlUCSIsKangxiRadicals(code);
37452 desret_int(ret_val);
37453 call_tests++;
37454 des_int(n_code, code, 0);
37455 xmlResetLastError();
37456 if (mem_base != xmlMemBlocks()) {
37457 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037459 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037460 printf(" %d", n_code);
37461 printf("\n");
37462 }
37463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037464 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037465#endif
37466
Daniel Veillard42595322004-11-08 10:52:06 +000037467 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037468}
37469
37470
37471static int
37472test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037473 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037474
37475#ifdef LIBXML_UNICODE_ENABLED
37476 int mem_base;
37477 int ret_val;
37478 int code; /* UCS code point */
37479 int n_code;
37480
37481 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37482 mem_base = xmlMemBlocks();
37483 code = gen_int(n_code, 0);
37484
37485 ret_val = xmlUCSIsKannada(code);
37486 desret_int(ret_val);
37487 call_tests++;
37488 des_int(n_code, code, 0);
37489 xmlResetLastError();
37490 if (mem_base != xmlMemBlocks()) {
37491 printf("Leak of %d blocks found in xmlUCSIsKannada",
37492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037493 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037494 printf(" %d", n_code);
37495 printf("\n");
37496 }
37497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037498 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037499#endif
37500
Daniel Veillard42595322004-11-08 10:52:06 +000037501 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037502}
37503
37504
37505static int
37506test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037507 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037508
37509#ifdef LIBXML_UNICODE_ENABLED
37510 int mem_base;
37511 int ret_val;
37512 int code; /* UCS code point */
37513 int n_code;
37514
37515 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37516 mem_base = xmlMemBlocks();
37517 code = gen_int(n_code, 0);
37518
37519 ret_val = xmlUCSIsKatakana(code);
37520 desret_int(ret_val);
37521 call_tests++;
37522 des_int(n_code, code, 0);
37523 xmlResetLastError();
37524 if (mem_base != xmlMemBlocks()) {
37525 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037527 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037528 printf(" %d", n_code);
37529 printf("\n");
37530 }
37531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037532 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037533#endif
37534
Daniel Veillard42595322004-11-08 10:52:06 +000037535 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037536}
37537
37538
37539static int
37540test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037541 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037542
37543#ifdef LIBXML_UNICODE_ENABLED
37544 int mem_base;
37545 int ret_val;
37546 int code; /* UCS code point */
37547 int n_code;
37548
37549 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37550 mem_base = xmlMemBlocks();
37551 code = gen_int(n_code, 0);
37552
37553 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37554 desret_int(ret_val);
37555 call_tests++;
37556 des_int(n_code, code, 0);
37557 xmlResetLastError();
37558 if (mem_base != xmlMemBlocks()) {
37559 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037561 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037562 printf(" %d", n_code);
37563 printf("\n");
37564 }
37565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037566 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037567#endif
37568
Daniel Veillard42595322004-11-08 10:52:06 +000037569 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037570}
37571
37572
37573static int
37574test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037575 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037576
37577#ifdef LIBXML_UNICODE_ENABLED
37578 int mem_base;
37579 int ret_val;
37580 int code; /* UCS code point */
37581 int n_code;
37582
37583 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37584 mem_base = xmlMemBlocks();
37585 code = gen_int(n_code, 0);
37586
37587 ret_val = xmlUCSIsKhmer(code);
37588 desret_int(ret_val);
37589 call_tests++;
37590 des_int(n_code, code, 0);
37591 xmlResetLastError();
37592 if (mem_base != xmlMemBlocks()) {
37593 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037595 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037596 printf(" %d", n_code);
37597 printf("\n");
37598 }
37599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037600 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037601#endif
37602
Daniel Veillard42595322004-11-08 10:52:06 +000037603 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037604}
37605
37606
37607static int
37608test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037609 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037610
37611#ifdef LIBXML_UNICODE_ENABLED
37612 int mem_base;
37613 int ret_val;
37614 int code; /* UCS code point */
37615 int n_code;
37616
37617 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37618 mem_base = xmlMemBlocks();
37619 code = gen_int(n_code, 0);
37620
37621 ret_val = xmlUCSIsKhmerSymbols(code);
37622 desret_int(ret_val);
37623 call_tests++;
37624 des_int(n_code, code, 0);
37625 xmlResetLastError();
37626 if (mem_base != xmlMemBlocks()) {
37627 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037629 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037630 printf(" %d", n_code);
37631 printf("\n");
37632 }
37633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037634 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037635#endif
37636
Daniel Veillard42595322004-11-08 10:52:06 +000037637 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037638}
37639
37640
37641static int
37642test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037643 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037644
37645#ifdef LIBXML_UNICODE_ENABLED
37646 int mem_base;
37647 int ret_val;
37648 int code; /* UCS code point */
37649 int n_code;
37650
37651 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37652 mem_base = xmlMemBlocks();
37653 code = gen_int(n_code, 0);
37654
37655 ret_val = xmlUCSIsLao(code);
37656 desret_int(ret_val);
37657 call_tests++;
37658 des_int(n_code, code, 0);
37659 xmlResetLastError();
37660 if (mem_base != xmlMemBlocks()) {
37661 printf("Leak of %d blocks found in xmlUCSIsLao",
37662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037663 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037664 printf(" %d", n_code);
37665 printf("\n");
37666 }
37667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037668 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037669#endif
37670
Daniel Veillard42595322004-11-08 10:52:06 +000037671 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037672}
37673
37674
37675static int
37676test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037677 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037678
37679#ifdef LIBXML_UNICODE_ENABLED
37680 int mem_base;
37681 int ret_val;
37682 int code; /* UCS code point */
37683 int n_code;
37684
37685 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37686 mem_base = xmlMemBlocks();
37687 code = gen_int(n_code, 0);
37688
37689 ret_val = xmlUCSIsLatin1Supplement(code);
37690 desret_int(ret_val);
37691 call_tests++;
37692 des_int(n_code, code, 0);
37693 xmlResetLastError();
37694 if (mem_base != xmlMemBlocks()) {
37695 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037697 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037698 printf(" %d", n_code);
37699 printf("\n");
37700 }
37701 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037702 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037703#endif
37704
Daniel Veillard42595322004-11-08 10:52:06 +000037705 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037706}
37707
37708
37709static int
37710test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037711 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037712
37713#ifdef LIBXML_UNICODE_ENABLED
37714 int mem_base;
37715 int ret_val;
37716 int code; /* UCS code point */
37717 int n_code;
37718
37719 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37720 mem_base = xmlMemBlocks();
37721 code = gen_int(n_code, 0);
37722
37723 ret_val = xmlUCSIsLatinExtendedA(code);
37724 desret_int(ret_val);
37725 call_tests++;
37726 des_int(n_code, code, 0);
37727 xmlResetLastError();
37728 if (mem_base != xmlMemBlocks()) {
37729 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037731 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037732 printf(" %d", n_code);
37733 printf("\n");
37734 }
37735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037736 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037737#endif
37738
Daniel Veillard42595322004-11-08 10:52:06 +000037739 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037740}
37741
37742
37743static int
37744test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037745 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037746
37747#ifdef LIBXML_UNICODE_ENABLED
37748 int mem_base;
37749 int ret_val;
37750 int code; /* UCS code point */
37751 int n_code;
37752
37753 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37754 mem_base = xmlMemBlocks();
37755 code = gen_int(n_code, 0);
37756
37757 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37758 desret_int(ret_val);
37759 call_tests++;
37760 des_int(n_code, code, 0);
37761 xmlResetLastError();
37762 if (mem_base != xmlMemBlocks()) {
37763 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037765 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037766 printf(" %d", n_code);
37767 printf("\n");
37768 }
37769 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037770 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037771#endif
37772
Daniel Veillard42595322004-11-08 10:52:06 +000037773 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037774}
37775
37776
37777static int
37778test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037779 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037780
37781#ifdef LIBXML_UNICODE_ENABLED
37782 int mem_base;
37783 int ret_val;
37784 int code; /* UCS code point */
37785 int n_code;
37786
37787 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37788 mem_base = xmlMemBlocks();
37789 code = gen_int(n_code, 0);
37790
37791 ret_val = xmlUCSIsLatinExtendedB(code);
37792 desret_int(ret_val);
37793 call_tests++;
37794 des_int(n_code, code, 0);
37795 xmlResetLastError();
37796 if (mem_base != xmlMemBlocks()) {
37797 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037799 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037800 printf(" %d", n_code);
37801 printf("\n");
37802 }
37803 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037804 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037805#endif
37806
Daniel Veillard42595322004-11-08 10:52:06 +000037807 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037808}
37809
37810
37811static int
37812test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037813 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037814
37815#ifdef LIBXML_UNICODE_ENABLED
37816 int mem_base;
37817 int ret_val;
37818 int code; /* UCS code point */
37819 int n_code;
37820
37821 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37822 mem_base = xmlMemBlocks();
37823 code = gen_int(n_code, 0);
37824
37825 ret_val = xmlUCSIsLetterlikeSymbols(code);
37826 desret_int(ret_val);
37827 call_tests++;
37828 des_int(n_code, code, 0);
37829 xmlResetLastError();
37830 if (mem_base != xmlMemBlocks()) {
37831 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037833 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037834 printf(" %d", n_code);
37835 printf("\n");
37836 }
37837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037838 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037839#endif
37840
Daniel Veillard42595322004-11-08 10:52:06 +000037841 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037842}
37843
37844
37845static int
37846test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037847 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037848
37849#ifdef LIBXML_UNICODE_ENABLED
37850 int mem_base;
37851 int ret_val;
37852 int code; /* UCS code point */
37853 int n_code;
37854
37855 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37856 mem_base = xmlMemBlocks();
37857 code = gen_int(n_code, 0);
37858
37859 ret_val = xmlUCSIsLimbu(code);
37860 desret_int(ret_val);
37861 call_tests++;
37862 des_int(n_code, code, 0);
37863 xmlResetLastError();
37864 if (mem_base != xmlMemBlocks()) {
37865 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037867 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037868 printf(" %d", n_code);
37869 printf("\n");
37870 }
37871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037872 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037873#endif
37874
Daniel Veillard42595322004-11-08 10:52:06 +000037875 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037876}
37877
37878
37879static int
37880test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037881 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037882
37883#ifdef LIBXML_UNICODE_ENABLED
37884 int mem_base;
37885 int ret_val;
37886 int code; /* UCS code point */
37887 int n_code;
37888
37889 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37890 mem_base = xmlMemBlocks();
37891 code = gen_int(n_code, 0);
37892
37893 ret_val = xmlUCSIsLinearBIdeograms(code);
37894 desret_int(ret_val);
37895 call_tests++;
37896 des_int(n_code, code, 0);
37897 xmlResetLastError();
37898 if (mem_base != xmlMemBlocks()) {
37899 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037901 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037902 printf(" %d", n_code);
37903 printf("\n");
37904 }
37905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037906 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037907#endif
37908
Daniel Veillard42595322004-11-08 10:52:06 +000037909 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037910}
37911
37912
37913static int
37914test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037915 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037916
37917#ifdef LIBXML_UNICODE_ENABLED
37918 int mem_base;
37919 int ret_val;
37920 int code; /* UCS code point */
37921 int n_code;
37922
37923 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37924 mem_base = xmlMemBlocks();
37925 code = gen_int(n_code, 0);
37926
37927 ret_val = xmlUCSIsLinearBSyllabary(code);
37928 desret_int(ret_val);
37929 call_tests++;
37930 des_int(n_code, code, 0);
37931 xmlResetLastError();
37932 if (mem_base != xmlMemBlocks()) {
37933 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037935 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037936 printf(" %d", n_code);
37937 printf("\n");
37938 }
37939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037940 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037941#endif
37942
Daniel Veillard42595322004-11-08 10:52:06 +000037943 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037944}
37945
37946
37947static int
37948test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037949 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037950
37951#ifdef LIBXML_UNICODE_ENABLED
37952 int mem_base;
37953 int ret_val;
37954 int code; /* UCS code point */
37955 int n_code;
37956
37957 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37958 mem_base = xmlMemBlocks();
37959 code = gen_int(n_code, 0);
37960
37961 ret_val = xmlUCSIsLowSurrogates(code);
37962 desret_int(ret_val);
37963 call_tests++;
37964 des_int(n_code, code, 0);
37965 xmlResetLastError();
37966 if (mem_base != xmlMemBlocks()) {
37967 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037969 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037970 printf(" %d", n_code);
37971 printf("\n");
37972 }
37973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037974 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037975#endif
37976
Daniel Veillard42595322004-11-08 10:52:06 +000037977 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037978}
37979
37980
37981static int
37982test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037983 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037984
37985#ifdef LIBXML_UNICODE_ENABLED
37986 int mem_base;
37987 int ret_val;
37988 int code; /* UCS code point */
37989 int n_code;
37990
37991 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37992 mem_base = xmlMemBlocks();
37993 code = gen_int(n_code, 0);
37994
37995 ret_val = xmlUCSIsMalayalam(code);
37996 desret_int(ret_val);
37997 call_tests++;
37998 des_int(n_code, code, 0);
37999 xmlResetLastError();
38000 if (mem_base != xmlMemBlocks()) {
38001 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038003 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038004 printf(" %d", n_code);
38005 printf("\n");
38006 }
38007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038008 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038009#endif
38010
Daniel Veillard42595322004-11-08 10:52:06 +000038011 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038012}
38013
38014
38015static int
38016test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038017 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038018
38019#ifdef LIBXML_UNICODE_ENABLED
38020 int mem_base;
38021 int ret_val;
38022 int code; /* UCS code point */
38023 int n_code;
38024
38025 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38026 mem_base = xmlMemBlocks();
38027 code = gen_int(n_code, 0);
38028
38029 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38030 desret_int(ret_val);
38031 call_tests++;
38032 des_int(n_code, code, 0);
38033 xmlResetLastError();
38034 if (mem_base != xmlMemBlocks()) {
38035 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038037 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038038 printf(" %d", n_code);
38039 printf("\n");
38040 }
38041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038042 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038043#endif
38044
Daniel Veillard42595322004-11-08 10:52:06 +000038045 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038046}
38047
38048
38049static int
38050test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038051 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038052
38053#ifdef LIBXML_UNICODE_ENABLED
38054 int mem_base;
38055 int ret_val;
38056 int code; /* UCS code point */
38057 int n_code;
38058
38059 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38060 mem_base = xmlMemBlocks();
38061 code = gen_int(n_code, 0);
38062
38063 ret_val = xmlUCSIsMathematicalOperators(code);
38064 desret_int(ret_val);
38065 call_tests++;
38066 des_int(n_code, code, 0);
38067 xmlResetLastError();
38068 if (mem_base != xmlMemBlocks()) {
38069 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038071 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038072 printf(" %d", n_code);
38073 printf("\n");
38074 }
38075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038076 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038077#endif
38078
Daniel Veillard42595322004-11-08 10:52:06 +000038079 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038080}
38081
38082
38083static int
38084test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038085 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038086
38087#ifdef LIBXML_UNICODE_ENABLED
38088 int mem_base;
38089 int ret_val;
38090 int code; /* UCS code point */
38091 int n_code;
38092
38093 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38094 mem_base = xmlMemBlocks();
38095 code = gen_int(n_code, 0);
38096
38097 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38098 desret_int(ret_val);
38099 call_tests++;
38100 des_int(n_code, code, 0);
38101 xmlResetLastError();
38102 if (mem_base != xmlMemBlocks()) {
38103 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038105 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038106 printf(" %d", n_code);
38107 printf("\n");
38108 }
38109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038110 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038111#endif
38112
Daniel Veillard42595322004-11-08 10:52:06 +000038113 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038114}
38115
38116
38117static int
38118test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038119 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038120
38121#ifdef LIBXML_UNICODE_ENABLED
38122 int mem_base;
38123 int ret_val;
38124 int code; /* UCS code point */
38125 int n_code;
38126
38127 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38128 mem_base = xmlMemBlocks();
38129 code = gen_int(n_code, 0);
38130
38131 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38132 desret_int(ret_val);
38133 call_tests++;
38134 des_int(n_code, code, 0);
38135 xmlResetLastError();
38136 if (mem_base != xmlMemBlocks()) {
38137 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038139 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038140 printf(" %d", n_code);
38141 printf("\n");
38142 }
38143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038144 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038145#endif
38146
Daniel Veillard42595322004-11-08 10:52:06 +000038147 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038148}
38149
38150
38151static int
38152test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038153 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038154
38155#ifdef LIBXML_UNICODE_ENABLED
38156 int mem_base;
38157 int ret_val;
38158 int code; /* UCS code point */
38159 int n_code;
38160
38161 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38162 mem_base = xmlMemBlocks();
38163 code = gen_int(n_code, 0);
38164
38165 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38166 desret_int(ret_val);
38167 call_tests++;
38168 des_int(n_code, code, 0);
38169 xmlResetLastError();
38170 if (mem_base != xmlMemBlocks()) {
38171 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038173 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038174 printf(" %d", n_code);
38175 printf("\n");
38176 }
38177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038178 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038179#endif
38180
Daniel Veillard42595322004-11-08 10:52:06 +000038181 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038182}
38183
38184
38185static int
38186test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038187 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038188
38189#ifdef LIBXML_UNICODE_ENABLED
38190 int mem_base;
38191 int ret_val;
38192 int code; /* UCS code point */
38193 int n_code;
38194
38195 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38196 mem_base = xmlMemBlocks();
38197 code = gen_int(n_code, 0);
38198
38199 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38200 desret_int(ret_val);
38201 call_tests++;
38202 des_int(n_code, code, 0);
38203 xmlResetLastError();
38204 if (mem_base != xmlMemBlocks()) {
38205 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038207 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038208 printf(" %d", n_code);
38209 printf("\n");
38210 }
38211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038212 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038213#endif
38214
Daniel Veillard42595322004-11-08 10:52:06 +000038215 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038216}
38217
38218
38219static int
38220test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038221 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038222
38223#ifdef LIBXML_UNICODE_ENABLED
38224 int mem_base;
38225 int ret_val;
38226 int code; /* UCS code point */
38227 int n_code;
38228
38229 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38230 mem_base = xmlMemBlocks();
38231 code = gen_int(n_code, 0);
38232
38233 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38234 desret_int(ret_val);
38235 call_tests++;
38236 des_int(n_code, code, 0);
38237 xmlResetLastError();
38238 if (mem_base != xmlMemBlocks()) {
38239 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038241 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038242 printf(" %d", n_code);
38243 printf("\n");
38244 }
38245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038246 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038247#endif
38248
Daniel Veillard42595322004-11-08 10:52:06 +000038249 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038250}
38251
38252
38253static int
38254test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038255 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038256
38257#ifdef LIBXML_UNICODE_ENABLED
38258 int mem_base;
38259 int ret_val;
38260 int code; /* UCS code point */
38261 int n_code;
38262
38263 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38264 mem_base = xmlMemBlocks();
38265 code = gen_int(n_code, 0);
38266
38267 ret_val = xmlUCSIsMongolian(code);
38268 desret_int(ret_val);
38269 call_tests++;
38270 des_int(n_code, code, 0);
38271 xmlResetLastError();
38272 if (mem_base != xmlMemBlocks()) {
38273 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038275 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038276 printf(" %d", n_code);
38277 printf("\n");
38278 }
38279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038280 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038281#endif
38282
Daniel Veillard42595322004-11-08 10:52:06 +000038283 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038284}
38285
38286
38287static int
38288test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038289 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038290
38291#ifdef LIBXML_UNICODE_ENABLED
38292 int mem_base;
38293 int ret_val;
38294 int code; /* UCS code point */
38295 int n_code;
38296
38297 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38298 mem_base = xmlMemBlocks();
38299 code = gen_int(n_code, 0);
38300
38301 ret_val = xmlUCSIsMusicalSymbols(code);
38302 desret_int(ret_val);
38303 call_tests++;
38304 des_int(n_code, code, 0);
38305 xmlResetLastError();
38306 if (mem_base != xmlMemBlocks()) {
38307 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038309 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038310 printf(" %d", n_code);
38311 printf("\n");
38312 }
38313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038314 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038315#endif
38316
Daniel Veillard42595322004-11-08 10:52:06 +000038317 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038318}
38319
38320
38321static int
38322test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038323 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038324
38325#ifdef LIBXML_UNICODE_ENABLED
38326 int mem_base;
38327 int ret_val;
38328 int code; /* UCS code point */
38329 int n_code;
38330
38331 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38332 mem_base = xmlMemBlocks();
38333 code = gen_int(n_code, 0);
38334
38335 ret_val = xmlUCSIsMyanmar(code);
38336 desret_int(ret_val);
38337 call_tests++;
38338 des_int(n_code, code, 0);
38339 xmlResetLastError();
38340 if (mem_base != xmlMemBlocks()) {
38341 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038343 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038344 printf(" %d", n_code);
38345 printf("\n");
38346 }
38347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038348 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038349#endif
38350
Daniel Veillard42595322004-11-08 10:52:06 +000038351 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038352}
38353
38354
38355static int
38356test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038357 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038358
38359#ifdef LIBXML_UNICODE_ENABLED
38360 int mem_base;
38361 int ret_val;
38362 int code; /* UCS code point */
38363 int n_code;
38364
38365 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38366 mem_base = xmlMemBlocks();
38367 code = gen_int(n_code, 0);
38368
38369 ret_val = xmlUCSIsNumberForms(code);
38370 desret_int(ret_val);
38371 call_tests++;
38372 des_int(n_code, code, 0);
38373 xmlResetLastError();
38374 if (mem_base != xmlMemBlocks()) {
38375 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038377 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038378 printf(" %d", n_code);
38379 printf("\n");
38380 }
38381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038382 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038383#endif
38384
Daniel Veillard42595322004-11-08 10:52:06 +000038385 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038386}
38387
38388
38389static int
38390test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038391 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038392
38393#ifdef LIBXML_UNICODE_ENABLED
38394 int mem_base;
38395 int ret_val;
38396 int code; /* UCS code point */
38397 int n_code;
38398
38399 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38400 mem_base = xmlMemBlocks();
38401 code = gen_int(n_code, 0);
38402
38403 ret_val = xmlUCSIsOgham(code);
38404 desret_int(ret_val);
38405 call_tests++;
38406 des_int(n_code, code, 0);
38407 xmlResetLastError();
38408 if (mem_base != xmlMemBlocks()) {
38409 printf("Leak of %d blocks found in xmlUCSIsOgham",
38410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038411 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038412 printf(" %d", n_code);
38413 printf("\n");
38414 }
38415 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038416 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038417#endif
38418
Daniel Veillard42595322004-11-08 10:52:06 +000038419 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038420}
38421
38422
38423static int
38424test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038425 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038426
38427#ifdef LIBXML_UNICODE_ENABLED
38428 int mem_base;
38429 int ret_val;
38430 int code; /* UCS code point */
38431 int n_code;
38432
38433 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38434 mem_base = xmlMemBlocks();
38435 code = gen_int(n_code, 0);
38436
38437 ret_val = xmlUCSIsOldItalic(code);
38438 desret_int(ret_val);
38439 call_tests++;
38440 des_int(n_code, code, 0);
38441 xmlResetLastError();
38442 if (mem_base != xmlMemBlocks()) {
38443 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038445 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038446 printf(" %d", n_code);
38447 printf("\n");
38448 }
38449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038450 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038451#endif
38452
Daniel Veillard42595322004-11-08 10:52:06 +000038453 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038454}
38455
38456
38457static int
38458test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038459 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038460
38461#ifdef LIBXML_UNICODE_ENABLED
38462 int mem_base;
38463 int ret_val;
38464 int code; /* UCS code point */
38465 int n_code;
38466
38467 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38468 mem_base = xmlMemBlocks();
38469 code = gen_int(n_code, 0);
38470
38471 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38472 desret_int(ret_val);
38473 call_tests++;
38474 des_int(n_code, code, 0);
38475 xmlResetLastError();
38476 if (mem_base != xmlMemBlocks()) {
38477 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038479 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038480 printf(" %d", n_code);
38481 printf("\n");
38482 }
38483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038484 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038485#endif
38486
Daniel Veillard42595322004-11-08 10:52:06 +000038487 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038488}
38489
38490
38491static int
38492test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038493 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038494
38495#ifdef LIBXML_UNICODE_ENABLED
38496 int mem_base;
38497 int ret_val;
38498 int code; /* UCS code point */
38499 int n_code;
38500
38501 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38502 mem_base = xmlMemBlocks();
38503 code = gen_int(n_code, 0);
38504
38505 ret_val = xmlUCSIsOriya(code);
38506 desret_int(ret_val);
38507 call_tests++;
38508 des_int(n_code, code, 0);
38509 xmlResetLastError();
38510 if (mem_base != xmlMemBlocks()) {
38511 printf("Leak of %d blocks found in xmlUCSIsOriya",
38512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038513 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038514 printf(" %d", n_code);
38515 printf("\n");
38516 }
38517 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038518 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038519#endif
38520
Daniel Veillard42595322004-11-08 10:52:06 +000038521 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038522}
38523
38524
38525static int
38526test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038527 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038528
38529#ifdef LIBXML_UNICODE_ENABLED
38530 int mem_base;
38531 int ret_val;
38532 int code; /* UCS code point */
38533 int n_code;
38534
38535 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38536 mem_base = xmlMemBlocks();
38537 code = gen_int(n_code, 0);
38538
38539 ret_val = xmlUCSIsOsmanya(code);
38540 desret_int(ret_val);
38541 call_tests++;
38542 des_int(n_code, code, 0);
38543 xmlResetLastError();
38544 if (mem_base != xmlMemBlocks()) {
38545 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038547 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038548 printf(" %d", n_code);
38549 printf("\n");
38550 }
38551 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038552 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038553#endif
38554
Daniel Veillard42595322004-11-08 10:52:06 +000038555 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038556}
38557
38558
38559static int
38560test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038561 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038562
38563#ifdef LIBXML_UNICODE_ENABLED
38564 int mem_base;
38565 int ret_val;
38566 int code; /* UCS code point */
38567 int n_code;
38568
38569 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38570 mem_base = xmlMemBlocks();
38571 code = gen_int(n_code, 0);
38572
38573 ret_val = xmlUCSIsPhoneticExtensions(code);
38574 desret_int(ret_val);
38575 call_tests++;
38576 des_int(n_code, code, 0);
38577 xmlResetLastError();
38578 if (mem_base != xmlMemBlocks()) {
38579 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038581 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038582 printf(" %d", n_code);
38583 printf("\n");
38584 }
38585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038586 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038587#endif
38588
Daniel Veillard42595322004-11-08 10:52:06 +000038589 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038590}
38591
38592
38593static int
38594test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038595 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038596
38597#ifdef LIBXML_UNICODE_ENABLED
38598 int mem_base;
38599 int ret_val;
38600 int code; /* UCS code point */
38601 int n_code;
38602
38603 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38604 mem_base = xmlMemBlocks();
38605 code = gen_int(n_code, 0);
38606
38607 ret_val = xmlUCSIsPrivateUse(code);
38608 desret_int(ret_val);
38609 call_tests++;
38610 des_int(n_code, code, 0);
38611 xmlResetLastError();
38612 if (mem_base != xmlMemBlocks()) {
38613 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038615 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038616 printf(" %d", n_code);
38617 printf("\n");
38618 }
38619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038620 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038621#endif
38622
Daniel Veillard42595322004-11-08 10:52:06 +000038623 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038624}
38625
38626
38627static int
38628test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038629 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038630
38631#ifdef LIBXML_UNICODE_ENABLED
38632 int mem_base;
38633 int ret_val;
38634 int code; /* UCS code point */
38635 int n_code;
38636
38637 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38638 mem_base = xmlMemBlocks();
38639 code = gen_int(n_code, 0);
38640
38641 ret_val = xmlUCSIsPrivateUseArea(code);
38642 desret_int(ret_val);
38643 call_tests++;
38644 des_int(n_code, code, 0);
38645 xmlResetLastError();
38646 if (mem_base != xmlMemBlocks()) {
38647 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038649 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038650 printf(" %d", n_code);
38651 printf("\n");
38652 }
38653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038654 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038655#endif
38656
Daniel Veillard42595322004-11-08 10:52:06 +000038657 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038658}
38659
38660
38661static int
38662test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038663 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038664
38665#ifdef LIBXML_UNICODE_ENABLED
38666 int mem_base;
38667 int ret_val;
38668 int code; /* UCS code point */
38669 int n_code;
38670
38671 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38672 mem_base = xmlMemBlocks();
38673 code = gen_int(n_code, 0);
38674
38675 ret_val = xmlUCSIsRunic(code);
38676 desret_int(ret_val);
38677 call_tests++;
38678 des_int(n_code, code, 0);
38679 xmlResetLastError();
38680 if (mem_base != xmlMemBlocks()) {
38681 printf("Leak of %d blocks found in xmlUCSIsRunic",
38682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038683 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038684 printf(" %d", n_code);
38685 printf("\n");
38686 }
38687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038688 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038689#endif
38690
Daniel Veillard42595322004-11-08 10:52:06 +000038691 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038692}
38693
38694
38695static int
38696test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038697 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038698
38699#ifdef LIBXML_UNICODE_ENABLED
38700 int mem_base;
38701 int ret_val;
38702 int code; /* UCS code point */
38703 int n_code;
38704
38705 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38706 mem_base = xmlMemBlocks();
38707 code = gen_int(n_code, 0);
38708
38709 ret_val = xmlUCSIsShavian(code);
38710 desret_int(ret_val);
38711 call_tests++;
38712 des_int(n_code, code, 0);
38713 xmlResetLastError();
38714 if (mem_base != xmlMemBlocks()) {
38715 printf("Leak of %d blocks found in xmlUCSIsShavian",
38716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038717 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038718 printf(" %d", n_code);
38719 printf("\n");
38720 }
38721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038722 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038723#endif
38724
Daniel Veillard42595322004-11-08 10:52:06 +000038725 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038726}
38727
38728
38729static int
38730test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038731 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038732
38733#ifdef LIBXML_UNICODE_ENABLED
38734 int mem_base;
38735 int ret_val;
38736 int code; /* UCS code point */
38737 int n_code;
38738
38739 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38740 mem_base = xmlMemBlocks();
38741 code = gen_int(n_code, 0);
38742
38743 ret_val = xmlUCSIsSinhala(code);
38744 desret_int(ret_val);
38745 call_tests++;
38746 des_int(n_code, code, 0);
38747 xmlResetLastError();
38748 if (mem_base != xmlMemBlocks()) {
38749 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038751 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038752 printf(" %d", n_code);
38753 printf("\n");
38754 }
38755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038756 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038757#endif
38758
Daniel Veillard42595322004-11-08 10:52:06 +000038759 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038760}
38761
38762
38763static int
38764test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038765 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038766
38767#ifdef LIBXML_UNICODE_ENABLED
38768 int mem_base;
38769 int ret_val;
38770 int code; /* UCS code point */
38771 int n_code;
38772
38773 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38774 mem_base = xmlMemBlocks();
38775 code = gen_int(n_code, 0);
38776
38777 ret_val = xmlUCSIsSmallFormVariants(code);
38778 desret_int(ret_val);
38779 call_tests++;
38780 des_int(n_code, code, 0);
38781 xmlResetLastError();
38782 if (mem_base != xmlMemBlocks()) {
38783 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038785 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038786 printf(" %d", n_code);
38787 printf("\n");
38788 }
38789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038790 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038791#endif
38792
Daniel Veillard42595322004-11-08 10:52:06 +000038793 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038794}
38795
38796
38797static int
38798test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038799 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038800
38801#ifdef LIBXML_UNICODE_ENABLED
38802 int mem_base;
38803 int ret_val;
38804 int code; /* UCS code point */
38805 int n_code;
38806
38807 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38808 mem_base = xmlMemBlocks();
38809 code = gen_int(n_code, 0);
38810
38811 ret_val = xmlUCSIsSpacingModifierLetters(code);
38812 desret_int(ret_val);
38813 call_tests++;
38814 des_int(n_code, code, 0);
38815 xmlResetLastError();
38816 if (mem_base != xmlMemBlocks()) {
38817 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038819 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038820 printf(" %d", n_code);
38821 printf("\n");
38822 }
38823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038824 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038825#endif
38826
Daniel Veillard42595322004-11-08 10:52:06 +000038827 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038828}
38829
38830
38831static int
38832test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038833 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038834
38835#ifdef LIBXML_UNICODE_ENABLED
38836 int mem_base;
38837 int ret_val;
38838 int code; /* UCS code point */
38839 int n_code;
38840
38841 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38842 mem_base = xmlMemBlocks();
38843 code = gen_int(n_code, 0);
38844
38845 ret_val = xmlUCSIsSpecials(code);
38846 desret_int(ret_val);
38847 call_tests++;
38848 des_int(n_code, code, 0);
38849 xmlResetLastError();
38850 if (mem_base != xmlMemBlocks()) {
38851 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038853 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038854 printf(" %d", n_code);
38855 printf("\n");
38856 }
38857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038858 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038859#endif
38860
Daniel Veillard42595322004-11-08 10:52:06 +000038861 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038862}
38863
38864
38865static int
38866test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038867 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038868
38869#ifdef LIBXML_UNICODE_ENABLED
38870 int mem_base;
38871 int ret_val;
38872 int code; /* UCS code point */
38873 int n_code;
38874
38875 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38876 mem_base = xmlMemBlocks();
38877 code = gen_int(n_code, 0);
38878
38879 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38880 desret_int(ret_val);
38881 call_tests++;
38882 des_int(n_code, code, 0);
38883 xmlResetLastError();
38884 if (mem_base != xmlMemBlocks()) {
38885 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038887 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038888 printf(" %d", n_code);
38889 printf("\n");
38890 }
38891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038892 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038893#endif
38894
Daniel Veillard42595322004-11-08 10:52:06 +000038895 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038896}
38897
38898
38899static int
38900test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038901 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038902
38903#ifdef LIBXML_UNICODE_ENABLED
38904 int mem_base;
38905 int ret_val;
38906 int code; /* UCS code point */
38907 int n_code;
38908
38909 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38910 mem_base = xmlMemBlocks();
38911 code = gen_int(n_code, 0);
38912
38913 ret_val = xmlUCSIsSupplementalArrowsA(code);
38914 desret_int(ret_val);
38915 call_tests++;
38916 des_int(n_code, code, 0);
38917 xmlResetLastError();
38918 if (mem_base != xmlMemBlocks()) {
38919 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038921 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038922 printf(" %d", n_code);
38923 printf("\n");
38924 }
38925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038926 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038927#endif
38928
Daniel Veillard42595322004-11-08 10:52:06 +000038929 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038930}
38931
38932
38933static int
38934test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038935 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038936
38937#ifdef LIBXML_UNICODE_ENABLED
38938 int mem_base;
38939 int ret_val;
38940 int code; /* UCS code point */
38941 int n_code;
38942
38943 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38944 mem_base = xmlMemBlocks();
38945 code = gen_int(n_code, 0);
38946
38947 ret_val = xmlUCSIsSupplementalArrowsB(code);
38948 desret_int(ret_val);
38949 call_tests++;
38950 des_int(n_code, code, 0);
38951 xmlResetLastError();
38952 if (mem_base != xmlMemBlocks()) {
38953 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038955 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038956 printf(" %d", n_code);
38957 printf("\n");
38958 }
38959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038960 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038961#endif
38962
Daniel Veillard42595322004-11-08 10:52:06 +000038963 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038964}
38965
38966
38967static int
38968test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038969 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038970
38971#ifdef LIBXML_UNICODE_ENABLED
38972 int mem_base;
38973 int ret_val;
38974 int code; /* UCS code point */
38975 int n_code;
38976
38977 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38978 mem_base = xmlMemBlocks();
38979 code = gen_int(n_code, 0);
38980
38981 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38982 desret_int(ret_val);
38983 call_tests++;
38984 des_int(n_code, code, 0);
38985 xmlResetLastError();
38986 if (mem_base != xmlMemBlocks()) {
38987 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038989 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038990 printf(" %d", n_code);
38991 printf("\n");
38992 }
38993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038994 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038995#endif
38996
Daniel Veillard42595322004-11-08 10:52:06 +000038997 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038998}
38999
39000
39001static int
39002test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039003 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039004
39005#ifdef LIBXML_UNICODE_ENABLED
39006 int mem_base;
39007 int ret_val;
39008 int code; /* UCS code point */
39009 int n_code;
39010
39011 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39012 mem_base = xmlMemBlocks();
39013 code = gen_int(n_code, 0);
39014
39015 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39016 desret_int(ret_val);
39017 call_tests++;
39018 des_int(n_code, code, 0);
39019 xmlResetLastError();
39020 if (mem_base != xmlMemBlocks()) {
39021 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039023 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039024 printf(" %d", n_code);
39025 printf("\n");
39026 }
39027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039028 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039029#endif
39030
Daniel Veillard42595322004-11-08 10:52:06 +000039031 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039032}
39033
39034
39035static int
39036test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039037 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039038
39039#ifdef LIBXML_UNICODE_ENABLED
39040 int mem_base;
39041 int ret_val;
39042 int code; /* UCS code point */
39043 int n_code;
39044
39045 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39046 mem_base = xmlMemBlocks();
39047 code = gen_int(n_code, 0);
39048
39049 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39050 desret_int(ret_val);
39051 call_tests++;
39052 des_int(n_code, code, 0);
39053 xmlResetLastError();
39054 if (mem_base != xmlMemBlocks()) {
39055 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039057 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039058 printf(" %d", n_code);
39059 printf("\n");
39060 }
39061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039062 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039063#endif
39064
Daniel Veillard42595322004-11-08 10:52:06 +000039065 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039066}
39067
39068
39069static int
39070test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039071 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039072
39073#ifdef LIBXML_UNICODE_ENABLED
39074 int mem_base;
39075 int ret_val;
39076 int code; /* UCS code point */
39077 int n_code;
39078
39079 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39080 mem_base = xmlMemBlocks();
39081 code = gen_int(n_code, 0);
39082
39083 ret_val = xmlUCSIsSyriac(code);
39084 desret_int(ret_val);
39085 call_tests++;
39086 des_int(n_code, code, 0);
39087 xmlResetLastError();
39088 if (mem_base != xmlMemBlocks()) {
39089 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039091 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039092 printf(" %d", n_code);
39093 printf("\n");
39094 }
39095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039096 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039097#endif
39098
Daniel Veillard42595322004-11-08 10:52:06 +000039099 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039100}
39101
39102
39103static int
39104test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039105 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039106
39107#ifdef LIBXML_UNICODE_ENABLED
39108 int mem_base;
39109 int ret_val;
39110 int code; /* UCS code point */
39111 int n_code;
39112
39113 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39114 mem_base = xmlMemBlocks();
39115 code = gen_int(n_code, 0);
39116
39117 ret_val = xmlUCSIsTagalog(code);
39118 desret_int(ret_val);
39119 call_tests++;
39120 des_int(n_code, code, 0);
39121 xmlResetLastError();
39122 if (mem_base != xmlMemBlocks()) {
39123 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039125 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039126 printf(" %d", n_code);
39127 printf("\n");
39128 }
39129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039130 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039131#endif
39132
Daniel Veillard42595322004-11-08 10:52:06 +000039133 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039134}
39135
39136
39137static int
39138test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039139 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039140
39141#ifdef LIBXML_UNICODE_ENABLED
39142 int mem_base;
39143 int ret_val;
39144 int code; /* UCS code point */
39145 int n_code;
39146
39147 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39148 mem_base = xmlMemBlocks();
39149 code = gen_int(n_code, 0);
39150
39151 ret_val = xmlUCSIsTagbanwa(code);
39152 desret_int(ret_val);
39153 call_tests++;
39154 des_int(n_code, code, 0);
39155 xmlResetLastError();
39156 if (mem_base != xmlMemBlocks()) {
39157 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039159 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039160 printf(" %d", n_code);
39161 printf("\n");
39162 }
39163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039164 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039165#endif
39166
Daniel Veillard42595322004-11-08 10:52:06 +000039167 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039168}
39169
39170
39171static int
39172test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039173 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039174
39175#ifdef LIBXML_UNICODE_ENABLED
39176 int mem_base;
39177 int ret_val;
39178 int code; /* UCS code point */
39179 int n_code;
39180
39181 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39182 mem_base = xmlMemBlocks();
39183 code = gen_int(n_code, 0);
39184
39185 ret_val = xmlUCSIsTags(code);
39186 desret_int(ret_val);
39187 call_tests++;
39188 des_int(n_code, code, 0);
39189 xmlResetLastError();
39190 if (mem_base != xmlMemBlocks()) {
39191 printf("Leak of %d blocks found in xmlUCSIsTags",
39192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039193 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039194 printf(" %d", n_code);
39195 printf("\n");
39196 }
39197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039198 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039199#endif
39200
Daniel Veillard42595322004-11-08 10:52:06 +000039201 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039202}
39203
39204
39205static int
39206test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039207 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039208
39209#ifdef LIBXML_UNICODE_ENABLED
39210 int mem_base;
39211 int ret_val;
39212 int code; /* UCS code point */
39213 int n_code;
39214
39215 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39216 mem_base = xmlMemBlocks();
39217 code = gen_int(n_code, 0);
39218
39219 ret_val = xmlUCSIsTaiLe(code);
39220 desret_int(ret_val);
39221 call_tests++;
39222 des_int(n_code, code, 0);
39223 xmlResetLastError();
39224 if (mem_base != xmlMemBlocks()) {
39225 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039227 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039228 printf(" %d", n_code);
39229 printf("\n");
39230 }
39231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039232 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039233#endif
39234
Daniel Veillard42595322004-11-08 10:52:06 +000039235 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039236}
39237
39238
39239static int
39240test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039241 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039242
39243#ifdef LIBXML_UNICODE_ENABLED
39244 int mem_base;
39245 int ret_val;
39246 int code; /* UCS code point */
39247 int n_code;
39248
39249 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39250 mem_base = xmlMemBlocks();
39251 code = gen_int(n_code, 0);
39252
39253 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39254 desret_int(ret_val);
39255 call_tests++;
39256 des_int(n_code, code, 0);
39257 xmlResetLastError();
39258 if (mem_base != xmlMemBlocks()) {
39259 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039261 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039262 printf(" %d", n_code);
39263 printf("\n");
39264 }
39265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039266 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039267#endif
39268
Daniel Veillard42595322004-11-08 10:52:06 +000039269 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039270}
39271
39272
39273static int
39274test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039275 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039276
39277#ifdef LIBXML_UNICODE_ENABLED
39278 int mem_base;
39279 int ret_val;
39280 int code; /* UCS code point */
39281 int n_code;
39282
39283 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39284 mem_base = xmlMemBlocks();
39285 code = gen_int(n_code, 0);
39286
39287 ret_val = xmlUCSIsTamil(code);
39288 desret_int(ret_val);
39289 call_tests++;
39290 des_int(n_code, code, 0);
39291 xmlResetLastError();
39292 if (mem_base != xmlMemBlocks()) {
39293 printf("Leak of %d blocks found in xmlUCSIsTamil",
39294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039295 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039296 printf(" %d", n_code);
39297 printf("\n");
39298 }
39299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039300 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039301#endif
39302
Daniel Veillard42595322004-11-08 10:52:06 +000039303 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039304}
39305
39306
39307static int
39308test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039309 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039310
39311#ifdef LIBXML_UNICODE_ENABLED
39312 int mem_base;
39313 int ret_val;
39314 int code; /* UCS code point */
39315 int n_code;
39316
39317 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39318 mem_base = xmlMemBlocks();
39319 code = gen_int(n_code, 0);
39320
39321 ret_val = xmlUCSIsTelugu(code);
39322 desret_int(ret_val);
39323 call_tests++;
39324 des_int(n_code, code, 0);
39325 xmlResetLastError();
39326 if (mem_base != xmlMemBlocks()) {
39327 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039329 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039330 printf(" %d", n_code);
39331 printf("\n");
39332 }
39333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039334 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039335#endif
39336
Daniel Veillard42595322004-11-08 10:52:06 +000039337 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039338}
39339
39340
39341static int
39342test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039343 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039344
39345#ifdef LIBXML_UNICODE_ENABLED
39346 int mem_base;
39347 int ret_val;
39348 int code; /* UCS code point */
39349 int n_code;
39350
39351 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39352 mem_base = xmlMemBlocks();
39353 code = gen_int(n_code, 0);
39354
39355 ret_val = xmlUCSIsThaana(code);
39356 desret_int(ret_val);
39357 call_tests++;
39358 des_int(n_code, code, 0);
39359 xmlResetLastError();
39360 if (mem_base != xmlMemBlocks()) {
39361 printf("Leak of %d blocks found in xmlUCSIsThaana",
39362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039363 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039364 printf(" %d", n_code);
39365 printf("\n");
39366 }
39367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039368 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039369#endif
39370
Daniel Veillard42595322004-11-08 10:52:06 +000039371 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039372}
39373
39374
39375static int
39376test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039377 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039378
39379#ifdef LIBXML_UNICODE_ENABLED
39380 int mem_base;
39381 int ret_val;
39382 int code; /* UCS code point */
39383 int n_code;
39384
39385 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39386 mem_base = xmlMemBlocks();
39387 code = gen_int(n_code, 0);
39388
39389 ret_val = xmlUCSIsThai(code);
39390 desret_int(ret_val);
39391 call_tests++;
39392 des_int(n_code, code, 0);
39393 xmlResetLastError();
39394 if (mem_base != xmlMemBlocks()) {
39395 printf("Leak of %d blocks found in xmlUCSIsThai",
39396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039397 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039398 printf(" %d", n_code);
39399 printf("\n");
39400 }
39401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039402 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039403#endif
39404
Daniel Veillard42595322004-11-08 10:52:06 +000039405 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039406}
39407
39408
39409static int
39410test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039411 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039412
39413#ifdef LIBXML_UNICODE_ENABLED
39414 int mem_base;
39415 int ret_val;
39416 int code; /* UCS code point */
39417 int n_code;
39418
39419 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39420 mem_base = xmlMemBlocks();
39421 code = gen_int(n_code, 0);
39422
39423 ret_val = xmlUCSIsTibetan(code);
39424 desret_int(ret_val);
39425 call_tests++;
39426 des_int(n_code, code, 0);
39427 xmlResetLastError();
39428 if (mem_base != xmlMemBlocks()) {
39429 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039431 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039432 printf(" %d", n_code);
39433 printf("\n");
39434 }
39435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039436 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039437#endif
39438
Daniel Veillard42595322004-11-08 10:52:06 +000039439 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039440}
39441
39442
39443static int
39444test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039445 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039446
39447#ifdef LIBXML_UNICODE_ENABLED
39448 int mem_base;
39449 int ret_val;
39450 int code; /* UCS code point */
39451 int n_code;
39452
39453 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39454 mem_base = xmlMemBlocks();
39455 code = gen_int(n_code, 0);
39456
39457 ret_val = xmlUCSIsUgaritic(code);
39458 desret_int(ret_val);
39459 call_tests++;
39460 des_int(n_code, code, 0);
39461 xmlResetLastError();
39462 if (mem_base != xmlMemBlocks()) {
39463 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039465 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039466 printf(" %d", n_code);
39467 printf("\n");
39468 }
39469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039470 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039471#endif
39472
Daniel Veillard42595322004-11-08 10:52:06 +000039473 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039474}
39475
39476
39477static int
39478test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039479 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039480
39481#ifdef LIBXML_UNICODE_ENABLED
39482 int mem_base;
39483 int ret_val;
39484 int code; /* UCS code point */
39485 int n_code;
39486
39487 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39488 mem_base = xmlMemBlocks();
39489 code = gen_int(n_code, 0);
39490
39491 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39492 desret_int(ret_val);
39493 call_tests++;
39494 des_int(n_code, code, 0);
39495 xmlResetLastError();
39496 if (mem_base != xmlMemBlocks()) {
39497 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039499 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039500 printf(" %d", n_code);
39501 printf("\n");
39502 }
39503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039504 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039505#endif
39506
Daniel Veillard42595322004-11-08 10:52:06 +000039507 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039508}
39509
39510
39511static int
39512test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039513 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039514
39515#ifdef LIBXML_UNICODE_ENABLED
39516 int mem_base;
39517 int ret_val;
39518 int code; /* UCS code point */
39519 int n_code;
39520
39521 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39522 mem_base = xmlMemBlocks();
39523 code = gen_int(n_code, 0);
39524
39525 ret_val = xmlUCSIsVariationSelectors(code);
39526 desret_int(ret_val);
39527 call_tests++;
39528 des_int(n_code, code, 0);
39529 xmlResetLastError();
39530 if (mem_base != xmlMemBlocks()) {
39531 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039533 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039534 printf(" %d", n_code);
39535 printf("\n");
39536 }
39537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039538 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039539#endif
39540
Daniel Veillard42595322004-11-08 10:52:06 +000039541 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039542}
39543
39544
39545static int
39546test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039547 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039548
39549#ifdef LIBXML_UNICODE_ENABLED
39550 int mem_base;
39551 int ret_val;
39552 int code; /* UCS code point */
39553 int n_code;
39554
39555 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39556 mem_base = xmlMemBlocks();
39557 code = gen_int(n_code, 0);
39558
39559 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39560 desret_int(ret_val);
39561 call_tests++;
39562 des_int(n_code, code, 0);
39563 xmlResetLastError();
39564 if (mem_base != xmlMemBlocks()) {
39565 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039567 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039568 printf(" %d", n_code);
39569 printf("\n");
39570 }
39571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039572 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039573#endif
39574
Daniel Veillard42595322004-11-08 10:52:06 +000039575 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039576}
39577
39578
39579static int
39580test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039581 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039582
39583#ifdef LIBXML_UNICODE_ENABLED
39584 int mem_base;
39585 int ret_val;
39586 int code; /* UCS code point */
39587 int n_code;
39588
39589 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39590 mem_base = xmlMemBlocks();
39591 code = gen_int(n_code, 0);
39592
39593 ret_val = xmlUCSIsYiRadicals(code);
39594 desret_int(ret_val);
39595 call_tests++;
39596 des_int(n_code, code, 0);
39597 xmlResetLastError();
39598 if (mem_base != xmlMemBlocks()) {
39599 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039601 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039602 printf(" %d", n_code);
39603 printf("\n");
39604 }
39605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039606 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039607#endif
39608
Daniel Veillard42595322004-11-08 10:52:06 +000039609 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039610}
39611
39612
39613static int
39614test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039615 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039616
39617#ifdef LIBXML_UNICODE_ENABLED
39618 int mem_base;
39619 int ret_val;
39620 int code; /* UCS code point */
39621 int n_code;
39622
39623 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39624 mem_base = xmlMemBlocks();
39625 code = gen_int(n_code, 0);
39626
39627 ret_val = xmlUCSIsYiSyllables(code);
39628 desret_int(ret_val);
39629 call_tests++;
39630 des_int(n_code, code, 0);
39631 xmlResetLastError();
39632 if (mem_base != xmlMemBlocks()) {
39633 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039635 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039636 printf(" %d", n_code);
39637 printf("\n");
39638 }
39639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039640 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039641#endif
39642
Daniel Veillard42595322004-11-08 10:52:06 +000039643 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039644}
39645
39646
39647static int
39648test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039649 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039650
39651#ifdef LIBXML_UNICODE_ENABLED
39652 int mem_base;
39653 int ret_val;
39654 int code; /* UCS code point */
39655 int n_code;
39656
39657 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39658 mem_base = xmlMemBlocks();
39659 code = gen_int(n_code, 0);
39660
39661 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39662 desret_int(ret_val);
39663 call_tests++;
39664 des_int(n_code, code, 0);
39665 xmlResetLastError();
39666 if (mem_base != xmlMemBlocks()) {
39667 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039669 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039670 printf(" %d", n_code);
39671 printf("\n");
39672 }
39673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039674 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039675#endif
39676
Daniel Veillard42595322004-11-08 10:52:06 +000039677 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039678}
39679
39680static int
39681test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039682 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039683
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039684 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039685 test_ret += test_xmlUCSIsAegeanNumbers();
39686 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39687 test_ret += test_xmlUCSIsArabic();
39688 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39689 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39690 test_ret += test_xmlUCSIsArmenian();
39691 test_ret += test_xmlUCSIsArrows();
39692 test_ret += test_xmlUCSIsBasicLatin();
39693 test_ret += test_xmlUCSIsBengali();
39694 test_ret += test_xmlUCSIsBlock();
39695 test_ret += test_xmlUCSIsBlockElements();
39696 test_ret += test_xmlUCSIsBopomofo();
39697 test_ret += test_xmlUCSIsBopomofoExtended();
39698 test_ret += test_xmlUCSIsBoxDrawing();
39699 test_ret += test_xmlUCSIsBraillePatterns();
39700 test_ret += test_xmlUCSIsBuhid();
39701 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39702 test_ret += test_xmlUCSIsCJKCompatibility();
39703 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39704 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39705 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39706 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39707 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39708 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39709 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39710 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39711 test_ret += test_xmlUCSIsCat();
39712 test_ret += test_xmlUCSIsCatC();
39713 test_ret += test_xmlUCSIsCatCc();
39714 test_ret += test_xmlUCSIsCatCf();
39715 test_ret += test_xmlUCSIsCatCo();
39716 test_ret += test_xmlUCSIsCatCs();
39717 test_ret += test_xmlUCSIsCatL();
39718 test_ret += test_xmlUCSIsCatLl();
39719 test_ret += test_xmlUCSIsCatLm();
39720 test_ret += test_xmlUCSIsCatLo();
39721 test_ret += test_xmlUCSIsCatLt();
39722 test_ret += test_xmlUCSIsCatLu();
39723 test_ret += test_xmlUCSIsCatM();
39724 test_ret += test_xmlUCSIsCatMc();
39725 test_ret += test_xmlUCSIsCatMe();
39726 test_ret += test_xmlUCSIsCatMn();
39727 test_ret += test_xmlUCSIsCatN();
39728 test_ret += test_xmlUCSIsCatNd();
39729 test_ret += test_xmlUCSIsCatNl();
39730 test_ret += test_xmlUCSIsCatNo();
39731 test_ret += test_xmlUCSIsCatP();
39732 test_ret += test_xmlUCSIsCatPc();
39733 test_ret += test_xmlUCSIsCatPd();
39734 test_ret += test_xmlUCSIsCatPe();
39735 test_ret += test_xmlUCSIsCatPf();
39736 test_ret += test_xmlUCSIsCatPi();
39737 test_ret += test_xmlUCSIsCatPo();
39738 test_ret += test_xmlUCSIsCatPs();
39739 test_ret += test_xmlUCSIsCatS();
39740 test_ret += test_xmlUCSIsCatSc();
39741 test_ret += test_xmlUCSIsCatSk();
39742 test_ret += test_xmlUCSIsCatSm();
39743 test_ret += test_xmlUCSIsCatSo();
39744 test_ret += test_xmlUCSIsCatZ();
39745 test_ret += test_xmlUCSIsCatZl();
39746 test_ret += test_xmlUCSIsCatZp();
39747 test_ret += test_xmlUCSIsCatZs();
39748 test_ret += test_xmlUCSIsCherokee();
39749 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39750 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39751 test_ret += test_xmlUCSIsCombiningHalfMarks();
39752 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39753 test_ret += test_xmlUCSIsControlPictures();
39754 test_ret += test_xmlUCSIsCurrencySymbols();
39755 test_ret += test_xmlUCSIsCypriotSyllabary();
39756 test_ret += test_xmlUCSIsCyrillic();
39757 test_ret += test_xmlUCSIsCyrillicSupplement();
39758 test_ret += test_xmlUCSIsDeseret();
39759 test_ret += test_xmlUCSIsDevanagari();
39760 test_ret += test_xmlUCSIsDingbats();
39761 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39762 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39763 test_ret += test_xmlUCSIsEthiopic();
39764 test_ret += test_xmlUCSIsGeneralPunctuation();
39765 test_ret += test_xmlUCSIsGeometricShapes();
39766 test_ret += test_xmlUCSIsGeorgian();
39767 test_ret += test_xmlUCSIsGothic();
39768 test_ret += test_xmlUCSIsGreek();
39769 test_ret += test_xmlUCSIsGreekExtended();
39770 test_ret += test_xmlUCSIsGreekandCoptic();
39771 test_ret += test_xmlUCSIsGujarati();
39772 test_ret += test_xmlUCSIsGurmukhi();
39773 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39774 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39775 test_ret += test_xmlUCSIsHangulJamo();
39776 test_ret += test_xmlUCSIsHangulSyllables();
39777 test_ret += test_xmlUCSIsHanunoo();
39778 test_ret += test_xmlUCSIsHebrew();
39779 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39780 test_ret += test_xmlUCSIsHighSurrogates();
39781 test_ret += test_xmlUCSIsHiragana();
39782 test_ret += test_xmlUCSIsIPAExtensions();
39783 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39784 test_ret += test_xmlUCSIsKanbun();
39785 test_ret += test_xmlUCSIsKangxiRadicals();
39786 test_ret += test_xmlUCSIsKannada();
39787 test_ret += test_xmlUCSIsKatakana();
39788 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39789 test_ret += test_xmlUCSIsKhmer();
39790 test_ret += test_xmlUCSIsKhmerSymbols();
39791 test_ret += test_xmlUCSIsLao();
39792 test_ret += test_xmlUCSIsLatin1Supplement();
39793 test_ret += test_xmlUCSIsLatinExtendedA();
39794 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39795 test_ret += test_xmlUCSIsLatinExtendedB();
39796 test_ret += test_xmlUCSIsLetterlikeSymbols();
39797 test_ret += test_xmlUCSIsLimbu();
39798 test_ret += test_xmlUCSIsLinearBIdeograms();
39799 test_ret += test_xmlUCSIsLinearBSyllabary();
39800 test_ret += test_xmlUCSIsLowSurrogates();
39801 test_ret += test_xmlUCSIsMalayalam();
39802 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39803 test_ret += test_xmlUCSIsMathematicalOperators();
39804 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39805 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39806 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39807 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39808 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39809 test_ret += test_xmlUCSIsMongolian();
39810 test_ret += test_xmlUCSIsMusicalSymbols();
39811 test_ret += test_xmlUCSIsMyanmar();
39812 test_ret += test_xmlUCSIsNumberForms();
39813 test_ret += test_xmlUCSIsOgham();
39814 test_ret += test_xmlUCSIsOldItalic();
39815 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39816 test_ret += test_xmlUCSIsOriya();
39817 test_ret += test_xmlUCSIsOsmanya();
39818 test_ret += test_xmlUCSIsPhoneticExtensions();
39819 test_ret += test_xmlUCSIsPrivateUse();
39820 test_ret += test_xmlUCSIsPrivateUseArea();
39821 test_ret += test_xmlUCSIsRunic();
39822 test_ret += test_xmlUCSIsShavian();
39823 test_ret += test_xmlUCSIsSinhala();
39824 test_ret += test_xmlUCSIsSmallFormVariants();
39825 test_ret += test_xmlUCSIsSpacingModifierLetters();
39826 test_ret += test_xmlUCSIsSpecials();
39827 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39828 test_ret += test_xmlUCSIsSupplementalArrowsA();
39829 test_ret += test_xmlUCSIsSupplementalArrowsB();
39830 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39831 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39832 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39833 test_ret += test_xmlUCSIsSyriac();
39834 test_ret += test_xmlUCSIsTagalog();
39835 test_ret += test_xmlUCSIsTagbanwa();
39836 test_ret += test_xmlUCSIsTags();
39837 test_ret += test_xmlUCSIsTaiLe();
39838 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39839 test_ret += test_xmlUCSIsTamil();
39840 test_ret += test_xmlUCSIsTelugu();
39841 test_ret += test_xmlUCSIsThaana();
39842 test_ret += test_xmlUCSIsThai();
39843 test_ret += test_xmlUCSIsTibetan();
39844 test_ret += test_xmlUCSIsUgaritic();
39845 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39846 test_ret += test_xmlUCSIsVariationSelectors();
39847 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39848 test_ret += test_xmlUCSIsYiRadicals();
39849 test_ret += test_xmlUCSIsYiSyllables();
39850 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039851
Daniel Veillard42595322004-11-08 10:52:06 +000039852 if (test_ret != 0)
39853 printf("Module xmlunicode: %d errors\n", test_ret);
39854 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039855}
39856
39857static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039858test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039860
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039861#ifdef LIBXML_WRITER_ENABLED
39862 int mem_base;
39863 xmlTextWriterPtr ret_val;
39864 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39865 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039866
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039867 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39868 mem_base = xmlMemBlocks();
39869 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039870
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039871 ret_val = xmlNewTextWriter(out);
39872 if (ret_val != NULL) out = NULL;
39873 desret_xmlTextWriterPtr(ret_val);
39874 call_tests++;
39875 des_xmlOutputBufferPtr(n_out, out, 0);
39876 xmlResetLastError();
39877 if (mem_base != xmlMemBlocks()) {
39878 printf("Leak of %d blocks found in xmlNewTextWriter",
39879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039880 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039881 printf(" %d", n_out);
39882 printf("\n");
39883 }
39884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039885 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039886#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039887
Daniel Veillard42595322004-11-08 10:52:06 +000039888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039889}
39890
39891
39892static int
39893test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039895
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039896#ifdef LIBXML_WRITER_ENABLED
39897 int mem_base;
39898 xmlTextWriterPtr ret_val;
39899 const char * uri; /* the URI of the resource for the output */
39900 int n_uri;
39901 int compression; /* compress the output? */
39902 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039903
Daniel Veillard42595322004-11-08 10:52:06 +000039904 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039905 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39906 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039907 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039908 compression = gen_int(n_compression, 1);
39909
39910 ret_val = xmlNewTextWriterFilename(uri, compression);
39911 desret_xmlTextWriterPtr(ret_val);
39912 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039913 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039914 des_int(n_compression, compression, 1);
39915 xmlResetLastError();
39916 if (mem_base != xmlMemBlocks()) {
39917 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039919 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039920 printf(" %d", n_uri);
39921 printf(" %d", n_compression);
39922 printf("\n");
39923 }
39924 }
39925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039926 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039927#endif
39928
Daniel Veillard42595322004-11-08 10:52:06 +000039929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039930}
39931
39932
39933static int
39934test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039936
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039937#ifdef LIBXML_WRITER_ENABLED
39938 int mem_base;
39939 xmlTextWriterPtr ret_val;
39940 xmlBufferPtr buf; /* xmlBufferPtr */
39941 int n_buf;
39942 int compression; /* compress the output? */
39943 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039944
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039945 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39946 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39947 mem_base = xmlMemBlocks();
39948 buf = gen_xmlBufferPtr(n_buf, 0);
39949 compression = gen_int(n_compression, 1);
39950
39951 ret_val = xmlNewTextWriterMemory(buf, compression);
39952 desret_xmlTextWriterPtr(ret_val);
39953 call_tests++;
39954 des_xmlBufferPtr(n_buf, buf, 0);
39955 des_int(n_compression, compression, 1);
39956 xmlResetLastError();
39957 if (mem_base != xmlMemBlocks()) {
39958 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039960 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039961 printf(" %d", n_buf);
39962 printf(" %d", n_compression);
39963 printf("\n");
39964 }
39965 }
39966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039967 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039968#endif
39969
Daniel Veillard42595322004-11-08 10:52:06 +000039970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039971}
39972
39973
39974static int
39975test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039977
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039978#ifdef LIBXML_WRITER_ENABLED
39979 int mem_base;
39980 xmlTextWriterPtr ret_val;
39981 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39982 int n_ctxt;
39983 int compression; /* compress the output? */
39984 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039985
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039986 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39987 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39988 mem_base = xmlMemBlocks();
39989 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39990 compression = gen_int(n_compression, 1);
39991
39992 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000039993 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039994 desret_xmlTextWriterPtr(ret_val);
39995 call_tests++;
39996 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39997 des_int(n_compression, compression, 1);
39998 xmlResetLastError();
39999 if (mem_base != xmlMemBlocks()) {
40000 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040002 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040003 printf(" %d", n_ctxt);
40004 printf(" %d", n_compression);
40005 printf("\n");
40006 }
40007 }
40008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040009 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040010#endif
40011
Daniel Veillard42595322004-11-08 10:52:06 +000040012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040013}
40014
40015
40016static int
40017test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040019
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040020#ifdef LIBXML_WRITER_ENABLED
40021 int mem_base;
40022 xmlTextWriterPtr ret_val;
40023 xmlDocPtr doc; /* xmlDocPtr */
40024 int n_doc;
40025 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40026 int n_node;
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_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40031 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40032 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40033 mem_base = xmlMemBlocks();
40034 doc = gen_xmlDocPtr(n_doc, 0);
40035 node = gen_xmlNodePtr(n_node, 1);
40036 compression = gen_int(n_compression, 2);
40037
40038 ret_val = xmlNewTextWriterTree(doc, node, compression);
40039 desret_xmlTextWriterPtr(ret_val);
40040 call_tests++;
40041 des_xmlDocPtr(n_doc, doc, 0);
40042 des_xmlNodePtr(n_node, node, 1);
40043 des_int(n_compression, compression, 2);
40044 xmlResetLastError();
40045 if (mem_base != xmlMemBlocks()) {
40046 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040048 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040049 printf(" %d", n_doc);
40050 printf(" %d", n_node);
40051 printf(" %d", n_compression);
40052 printf("\n");
40053 }
40054 }
40055 }
40056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040057 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040058#endif
40059
Daniel Veillard42595322004-11-08 10:52:06 +000040060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040061}
40062
40063
40064static int
40065test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040067
Daniel Veillarde43cc572004-11-03 11:50:29 +000040068#ifdef LIBXML_WRITER_ENABLED
40069 int mem_base;
40070 int ret_val;
40071 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40072 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040073
Daniel Veillarde43cc572004-11-03 11:50:29 +000040074 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40075 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040076 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040077
40078 ret_val = xmlTextWriterEndAttribute(writer);
40079 desret_int(ret_val);
40080 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040081 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040082 xmlResetLastError();
40083 if (mem_base != xmlMemBlocks()) {
40084 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040086 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040087 printf(" %d", n_writer);
40088 printf("\n");
40089 }
40090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040091 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040092#endif
40093
Daniel Veillard42595322004-11-08 10:52:06 +000040094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040095}
40096
40097
40098static int
40099test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040101
Daniel Veillarde43cc572004-11-03 11:50:29 +000040102#ifdef LIBXML_WRITER_ENABLED
40103 int mem_base;
40104 int ret_val;
40105 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40106 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040107
Daniel Veillarde43cc572004-11-03 11:50:29 +000040108 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40109 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040110 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040111
40112 ret_val = xmlTextWriterEndCDATA(writer);
40113 desret_int(ret_val);
40114 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040115 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040116 xmlResetLastError();
40117 if (mem_base != xmlMemBlocks()) {
40118 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040120 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040121 printf(" %d", n_writer);
40122 printf("\n");
40123 }
40124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040125 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040126#endif
40127
Daniel Veillard42595322004-11-08 10:52:06 +000040128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040129}
40130
40131
40132static int
40133test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040135
Daniel Veillarde43cc572004-11-03 11:50:29 +000040136#ifdef LIBXML_WRITER_ENABLED
40137 int mem_base;
40138 int ret_val;
40139 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40140 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040141
Daniel Veillarde43cc572004-11-03 11:50:29 +000040142 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040144 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040145
40146 ret_val = xmlTextWriterEndComment(writer);
40147 desret_int(ret_val);
40148 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040149 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040150 xmlResetLastError();
40151 if (mem_base != xmlMemBlocks()) {
40152 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040154 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040155 printf(" %d", n_writer);
40156 printf("\n");
40157 }
40158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040159 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040160#endif
40161
Daniel Veillard42595322004-11-08 10:52:06 +000040162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040163}
40164
40165
40166static int
40167test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040169
Daniel Veillarde43cc572004-11-03 11:50:29 +000040170#ifdef LIBXML_WRITER_ENABLED
40171 int mem_base;
40172 int ret_val;
40173 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40174 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040175
Daniel Veillarde43cc572004-11-03 11:50:29 +000040176 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040178 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040179
40180 ret_val = xmlTextWriterEndDTD(writer);
40181 desret_int(ret_val);
40182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040183 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040184 xmlResetLastError();
40185 if (mem_base != xmlMemBlocks()) {
40186 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040188 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040189 printf(" %d", n_writer);
40190 printf("\n");
40191 }
40192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040193 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040194#endif
40195
Daniel Veillard42595322004-11-08 10:52:06 +000040196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040197}
40198
40199
40200static int
40201test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040203
Daniel Veillarde43cc572004-11-03 11:50:29 +000040204#ifdef LIBXML_WRITER_ENABLED
40205 int mem_base;
40206 int ret_val;
40207 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40208 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040209
Daniel Veillarde43cc572004-11-03 11:50:29 +000040210 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040212 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040213
40214 ret_val = xmlTextWriterEndDTDAttlist(writer);
40215 desret_int(ret_val);
40216 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040217 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040218 xmlResetLastError();
40219 if (mem_base != xmlMemBlocks()) {
40220 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040222 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040223 printf(" %d", n_writer);
40224 printf("\n");
40225 }
40226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040227 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040228#endif
40229
Daniel Veillard42595322004-11-08 10:52:06 +000040230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040231}
40232
40233
40234static int
40235test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040237
Daniel Veillarde43cc572004-11-03 11:50:29 +000040238#ifdef LIBXML_WRITER_ENABLED
40239 int mem_base;
40240 int ret_val;
40241 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40242 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040243
Daniel Veillarde43cc572004-11-03 11:50:29 +000040244 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40245 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040246 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040247
40248 ret_val = xmlTextWriterEndDTDElement(writer);
40249 desret_int(ret_val);
40250 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040251 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040252 xmlResetLastError();
40253 if (mem_base != xmlMemBlocks()) {
40254 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040256 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040257 printf(" %d", n_writer);
40258 printf("\n");
40259 }
40260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040261 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040262#endif
40263
Daniel Veillard42595322004-11-08 10:52:06 +000040264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040265}
40266
40267
40268static int
40269test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040271
Daniel Veillarde43cc572004-11-03 11:50:29 +000040272#ifdef LIBXML_WRITER_ENABLED
40273 int mem_base;
40274 int ret_val;
40275 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40276 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040277
Daniel Veillarde43cc572004-11-03 11:50:29 +000040278 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40279 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040280 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040281
40282 ret_val = xmlTextWriterEndDTDEntity(writer);
40283 desret_int(ret_val);
40284 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040285 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040286 xmlResetLastError();
40287 if (mem_base != xmlMemBlocks()) {
40288 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040290 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040291 printf(" %d", n_writer);
40292 printf("\n");
40293 }
40294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040295 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040296#endif
40297
Daniel Veillard42595322004-11-08 10:52:06 +000040298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040299}
40300
40301
40302static int
40303test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040305
Daniel Veillarde43cc572004-11-03 11:50:29 +000040306#ifdef LIBXML_WRITER_ENABLED
40307 int mem_base;
40308 int ret_val;
40309 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40310 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040311
Daniel Veillarde43cc572004-11-03 11:50:29 +000040312 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40313 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040314 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040315
40316 ret_val = xmlTextWriterEndDocument(writer);
40317 desret_int(ret_val);
40318 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040319 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040320 xmlResetLastError();
40321 if (mem_base != xmlMemBlocks()) {
40322 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40323 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040324 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040325 printf(" %d", n_writer);
40326 printf("\n");
40327 }
40328 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040329 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040330#endif
40331
Daniel Veillard42595322004-11-08 10:52:06 +000040332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040333}
40334
40335
40336static int
40337test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040339
Daniel Veillarde43cc572004-11-03 11:50:29 +000040340#ifdef LIBXML_WRITER_ENABLED
40341 int mem_base;
40342 int ret_val;
40343 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40344 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040345
Daniel Veillarde43cc572004-11-03 11:50:29 +000040346 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040348 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040349
40350 ret_val = xmlTextWriterEndElement(writer);
40351 desret_int(ret_val);
40352 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040353 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040354 xmlResetLastError();
40355 if (mem_base != xmlMemBlocks()) {
40356 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040358 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040359 printf(" %d", n_writer);
40360 printf("\n");
40361 }
40362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040363 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040364#endif
40365
Daniel Veillard42595322004-11-08 10:52:06 +000040366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040367}
40368
40369
40370static int
40371test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040373
Daniel Veillarde43cc572004-11-03 11:50:29 +000040374#ifdef LIBXML_WRITER_ENABLED
40375 int mem_base;
40376 int ret_val;
40377 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40378 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040379
Daniel Veillarde43cc572004-11-03 11:50:29 +000040380 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40381 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040382 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040383
40384 ret_val = xmlTextWriterEndPI(writer);
40385 desret_int(ret_val);
40386 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040387 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040388 xmlResetLastError();
40389 if (mem_base != xmlMemBlocks()) {
40390 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040392 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040393 printf(" %d", n_writer);
40394 printf("\n");
40395 }
40396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040397 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040398#endif
40399
Daniel Veillard42595322004-11-08 10:52:06 +000040400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040401}
40402
40403
40404static int
40405test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040407
Daniel Veillarde43cc572004-11-03 11:50:29 +000040408#ifdef LIBXML_WRITER_ENABLED
40409 int mem_base;
40410 int ret_val;
40411 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40412 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040413
Daniel Veillarde43cc572004-11-03 11:50:29 +000040414 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40415 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040416 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040417
40418 ret_val = xmlTextWriterFlush(writer);
40419 desret_int(ret_val);
40420 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040421 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040422 xmlResetLastError();
40423 if (mem_base != xmlMemBlocks()) {
40424 printf("Leak of %d blocks found in xmlTextWriterFlush",
40425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040426 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040427 printf(" %d", n_writer);
40428 printf("\n");
40429 }
40430 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040431 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040432#endif
40433
Daniel Veillard42595322004-11-08 10:52:06 +000040434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040435}
40436
40437
40438static int
40439test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040441
Daniel Veillarde43cc572004-11-03 11:50:29 +000040442#ifdef LIBXML_WRITER_ENABLED
40443 int mem_base;
40444 int ret_val;
40445 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40446 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040447
Daniel Veillarde43cc572004-11-03 11:50:29 +000040448 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40449 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040450 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040451
40452 ret_val = xmlTextWriterFullEndElement(writer);
40453 desret_int(ret_val);
40454 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040455 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040456 xmlResetLastError();
40457 if (mem_base != xmlMemBlocks()) {
40458 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040460 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040461 printf(" %d", n_writer);
40462 printf("\n");
40463 }
40464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040465 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040466#endif
40467
Daniel Veillard42595322004-11-08 10:52:06 +000040468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040469}
40470
40471
40472static int
40473test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040475
Daniel Veillarde43cc572004-11-03 11:50:29 +000040476#ifdef LIBXML_WRITER_ENABLED
40477 int mem_base;
40478 int ret_val;
40479 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40480 int n_writer;
40481 int indent; /* do indentation? */
40482 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040483
Daniel Veillarde43cc572004-11-03 11:50:29 +000040484 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40485 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040487 writer = gen_xmlTextWriterPtr(n_writer, 0);
40488 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040489
40490 ret_val = xmlTextWriterSetIndent(writer, indent);
40491 desret_int(ret_val);
40492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040493 des_xmlTextWriterPtr(n_writer, writer, 0);
40494 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040495 xmlResetLastError();
40496 if (mem_base != xmlMemBlocks()) {
40497 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040499 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040500 printf(" %d", n_writer);
40501 printf(" %d", n_indent);
40502 printf("\n");
40503 }
40504 }
40505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040506 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040507#endif
40508
Daniel Veillard42595322004-11-08 10:52:06 +000040509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040510}
40511
40512
40513static int
40514test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040516
Daniel Veillarde43cc572004-11-03 11:50:29 +000040517#ifdef LIBXML_WRITER_ENABLED
40518 int mem_base;
40519 int ret_val;
40520 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40521 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040522 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040523 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040524
Daniel Veillarde43cc572004-11-03 11:50:29 +000040525 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40526 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40527 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040528 writer = gen_xmlTextWriterPtr(n_writer, 0);
40529 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040530
William M. Brackf13f77f2004-11-12 16:03:48 +000040531 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040532 desret_int(ret_val);
40533 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040534 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040535 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040536 xmlResetLastError();
40537 if (mem_base != xmlMemBlocks()) {
40538 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040540 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040541 printf(" %d", n_writer);
40542 printf(" %d", n_str);
40543 printf("\n");
40544 }
40545 }
40546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040547 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040548#endif
40549
Daniel Veillard42595322004-11-08 10:52:06 +000040550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040551}
40552
40553
40554static int
40555test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040557
Daniel Veillarde43cc572004-11-03 11:50:29 +000040558#ifdef LIBXML_WRITER_ENABLED
40559 int mem_base;
40560 int ret_val;
40561 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40562 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040563 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040564 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040565
Daniel Veillarde43cc572004-11-03 11:50:29 +000040566 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40567 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040569 writer = gen_xmlTextWriterPtr(n_writer, 0);
40570 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040571
William M. Brackf13f77f2004-11-12 16:03:48 +000040572 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040573 desret_int(ret_val);
40574 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040575 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040576 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040577 xmlResetLastError();
40578 if (mem_base != xmlMemBlocks()) {
40579 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040581 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040582 printf(" %d", n_writer);
40583 printf(" %d", n_name);
40584 printf("\n");
40585 }
40586 }
40587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040588 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040589#endif
40590
Daniel Veillard42595322004-11-08 10:52:06 +000040591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040592}
40593
40594
40595static int
40596test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040598
Daniel Veillarde43cc572004-11-03 11:50:29 +000040599#ifdef LIBXML_WRITER_ENABLED
40600 int mem_base;
40601 int ret_val;
40602 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40603 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040604 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040605 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040606 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040607 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040608 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040609 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040610
Daniel Veillarde43cc572004-11-03 11:50:29 +000040611 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40612 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40613 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40614 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40615 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040616 writer = gen_xmlTextWriterPtr(n_writer, 0);
40617 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40618 name = gen_const_xmlChar_ptr(n_name, 2);
40619 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040620
William M. Brackf13f77f2004-11-12 16:03:48 +000040621 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040622 desret_int(ret_val);
40623 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040624 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040625 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40626 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40627 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040628 xmlResetLastError();
40629 if (mem_base != xmlMemBlocks()) {
40630 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040632 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040633 printf(" %d", n_writer);
40634 printf(" %d", n_prefix);
40635 printf(" %d", n_name);
40636 printf(" %d", n_namespaceURI);
40637 printf("\n");
40638 }
40639 }
40640 }
40641 }
40642 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040643 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040644#endif
40645
Daniel Veillard42595322004-11-08 10:52:06 +000040646 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040647}
40648
40649
40650static int
40651test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040653
Daniel Veillarde43cc572004-11-03 11:50:29 +000040654#ifdef LIBXML_WRITER_ENABLED
40655 int mem_base;
40656 int ret_val;
40657 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40658 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040659
Daniel Veillarde43cc572004-11-03 11:50:29 +000040660 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40661 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040662 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040663
40664 ret_val = xmlTextWriterStartCDATA(writer);
40665 desret_int(ret_val);
40666 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040667 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040668 xmlResetLastError();
40669 if (mem_base != xmlMemBlocks()) {
40670 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040672 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040673 printf(" %d", n_writer);
40674 printf("\n");
40675 }
40676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040677 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040678#endif
40679
Daniel Veillard42595322004-11-08 10:52:06 +000040680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040681}
40682
40683
40684static int
40685test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040687
Daniel Veillarde43cc572004-11-03 11:50:29 +000040688#ifdef LIBXML_WRITER_ENABLED
40689 int mem_base;
40690 int ret_val;
40691 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40692 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040693
Daniel Veillarde43cc572004-11-03 11:50:29 +000040694 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40695 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040696 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040697
40698 ret_val = xmlTextWriterStartComment(writer);
40699 desret_int(ret_val);
40700 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040701 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040702 xmlResetLastError();
40703 if (mem_base != xmlMemBlocks()) {
40704 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040706 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040707 printf(" %d", n_writer);
40708 printf("\n");
40709 }
40710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040711 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040712#endif
40713
Daniel Veillard42595322004-11-08 10:52:06 +000040714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040715}
40716
40717
40718static int
40719test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040720 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040721
Daniel Veillarde43cc572004-11-03 11:50:29 +000040722#ifdef LIBXML_WRITER_ENABLED
40723 int mem_base;
40724 int ret_val;
40725 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40726 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040727 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040728 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040729 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040730 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040731 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040732 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040733
Daniel Veillarde43cc572004-11-03 11:50:29 +000040734 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40735 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40736 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40737 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040739 writer = gen_xmlTextWriterPtr(n_writer, 0);
40740 name = gen_const_xmlChar_ptr(n_name, 1);
40741 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40742 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040743
William M. Brackf13f77f2004-11-12 16:03:48 +000040744 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040745 desret_int(ret_val);
40746 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040747 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040748 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40749 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
40750 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040751 xmlResetLastError();
40752 if (mem_base != xmlMemBlocks()) {
40753 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040755 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040756 printf(" %d", n_writer);
40757 printf(" %d", n_name);
40758 printf(" %d", n_pubid);
40759 printf(" %d", n_sysid);
40760 printf("\n");
40761 }
40762 }
40763 }
40764 }
40765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040766 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040767#endif
40768
Daniel Veillard42595322004-11-08 10:52:06 +000040769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040770}
40771
40772
40773static int
40774test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040776
Daniel Veillarde43cc572004-11-03 11:50:29 +000040777#ifdef LIBXML_WRITER_ENABLED
40778 int mem_base;
40779 int ret_val;
40780 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40781 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040782 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040783 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040784
Daniel Veillarde43cc572004-11-03 11:50:29 +000040785 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40786 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40787 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040788 writer = gen_xmlTextWriterPtr(n_writer, 0);
40789 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040790
William M. Brackf13f77f2004-11-12 16:03:48 +000040791 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040792 desret_int(ret_val);
40793 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040794 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040795 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040796 xmlResetLastError();
40797 if (mem_base != xmlMemBlocks()) {
40798 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040800 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040801 printf(" %d", n_writer);
40802 printf(" %d", n_name);
40803 printf("\n");
40804 }
40805 }
40806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040807 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040808#endif
40809
Daniel Veillard42595322004-11-08 10:52:06 +000040810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040811}
40812
40813
40814static int
40815test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040817
Daniel Veillarde43cc572004-11-03 11:50:29 +000040818#ifdef LIBXML_WRITER_ENABLED
40819 int mem_base;
40820 int ret_val;
40821 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40822 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040823 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040824 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040825
Daniel Veillarde43cc572004-11-03 11:50:29 +000040826 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40827 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40828 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040829 writer = gen_xmlTextWriterPtr(n_writer, 0);
40830 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040831
William M. Brackf13f77f2004-11-12 16:03:48 +000040832 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040833 desret_int(ret_val);
40834 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040835 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040836 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040837 xmlResetLastError();
40838 if (mem_base != xmlMemBlocks()) {
40839 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040841 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040842 printf(" %d", n_writer);
40843 printf(" %d", n_name);
40844 printf("\n");
40845 }
40846 }
40847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040848 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040849#endif
40850
Daniel Veillard42595322004-11-08 10:52:06 +000040851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040852}
40853
40854
40855static int
40856test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040858
Daniel Veillarde43cc572004-11-03 11:50:29 +000040859#ifdef LIBXML_WRITER_ENABLED
40860 int mem_base;
40861 int ret_val;
40862 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40863 int n_writer;
40864 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40865 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040866 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040867 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040868
Daniel Veillarde43cc572004-11-03 11:50:29 +000040869 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40870 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
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 pe = gen_int(n_pe, 1);
40875 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040876
William M. Brackf13f77f2004-11-12 16:03:48 +000040877 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040878 desret_int(ret_val);
40879 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040880 des_xmlTextWriterPtr(n_writer, writer, 0);
40881 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000040882 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040883 xmlResetLastError();
40884 if (mem_base != xmlMemBlocks()) {
40885 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040887 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040888 printf(" %d", n_writer);
40889 printf(" %d", n_pe);
40890 printf(" %d", n_name);
40891 printf("\n");
40892 }
40893 }
40894 }
40895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040896 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040897#endif
40898
Daniel Veillard42595322004-11-08 10:52:06 +000040899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040900}
40901
40902
40903static int
40904test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040906
Daniel Veillarde43cc572004-11-03 11:50:29 +000040907#ifdef LIBXML_WRITER_ENABLED
40908 int mem_base;
40909 int ret_val;
40910 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40911 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040912 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040913 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040914 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040915 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040916 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040917 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040918
Daniel Veillarde43cc572004-11-03 11:50:29 +000040919 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40920 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40921 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40922 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040924 writer = gen_xmlTextWriterPtr(n_writer, 0);
40925 version = gen_const_char_ptr(n_version, 1);
40926 encoding = gen_const_char_ptr(n_encoding, 2);
40927 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040928
William M. Brackf13f77f2004-11-12 16:03:48 +000040929 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040930 desret_int(ret_val);
40931 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040932 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040933 des_const_char_ptr(n_version, (const char *)version, 1);
40934 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
40935 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040936 xmlResetLastError();
40937 if (mem_base != xmlMemBlocks()) {
40938 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040940 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040941 printf(" %d", n_writer);
40942 printf(" %d", n_version);
40943 printf(" %d", n_encoding);
40944 printf(" %d", n_standalone);
40945 printf("\n");
40946 }
40947 }
40948 }
40949 }
40950 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040951 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040952#endif
40953
Daniel Veillard42595322004-11-08 10:52:06 +000040954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040955}
40956
40957
40958static int
40959test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040961
Daniel Veillarde43cc572004-11-03 11:50:29 +000040962#ifdef LIBXML_WRITER_ENABLED
40963 int mem_base;
40964 int ret_val;
40965 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40966 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040967 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040968 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040969
Daniel Veillarde43cc572004-11-03 11:50:29 +000040970 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40971 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40972 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040973 writer = gen_xmlTextWriterPtr(n_writer, 0);
40974 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040975
William M. Brackf13f77f2004-11-12 16:03:48 +000040976 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040977 desret_int(ret_val);
40978 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040979 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040980 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040981 xmlResetLastError();
40982 if (mem_base != xmlMemBlocks()) {
40983 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040985 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040986 printf(" %d", n_writer);
40987 printf(" %d", n_name);
40988 printf("\n");
40989 }
40990 }
40991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040992 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040993#endif
40994
Daniel Veillard42595322004-11-08 10:52:06 +000040995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040996}
40997
40998
40999static int
41000test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041002
Daniel Veillarde43cc572004-11-03 11:50:29 +000041003#ifdef LIBXML_WRITER_ENABLED
41004 int mem_base;
41005 int ret_val;
41006 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41007 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041008 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041009 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041010 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041011 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041012 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041013 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041014
Daniel Veillarde43cc572004-11-03 11:50:29 +000041015 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41016 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41017 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41018 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041020 writer = gen_xmlTextWriterPtr(n_writer, 0);
41021 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41022 name = gen_const_xmlChar_ptr(n_name, 2);
41023 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041024
William M. Brackf13f77f2004-11-12 16:03:48 +000041025 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041026 desret_int(ret_val);
41027 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041028 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041029 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41030 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41031 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041032 xmlResetLastError();
41033 if (mem_base != xmlMemBlocks()) {
41034 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041036 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041037 printf(" %d", n_writer);
41038 printf(" %d", n_prefix);
41039 printf(" %d", n_name);
41040 printf(" %d", n_namespaceURI);
41041 printf("\n");
41042 }
41043 }
41044 }
41045 }
41046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041047 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041048#endif
41049
Daniel Veillard42595322004-11-08 10:52:06 +000041050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041051}
41052
41053
41054static int
41055test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041057
Daniel Veillarde43cc572004-11-03 11:50:29 +000041058#ifdef LIBXML_WRITER_ENABLED
41059 int mem_base;
41060 int ret_val;
41061 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41062 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041063 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041064 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041065
Daniel Veillarde43cc572004-11-03 11:50:29 +000041066 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41067 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41068 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041069 writer = gen_xmlTextWriterPtr(n_writer, 0);
41070 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041071
William M. Brackf13f77f2004-11-12 16:03:48 +000041072 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041073 desret_int(ret_val);
41074 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041075 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041076 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041077 xmlResetLastError();
41078 if (mem_base != xmlMemBlocks()) {
41079 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041081 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041082 printf(" %d", n_writer);
41083 printf(" %d", n_target);
41084 printf("\n");
41085 }
41086 }
41087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041088 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041089#endif
41090
Daniel Veillard42595322004-11-08 10:52:06 +000041091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041092}
41093
41094
41095static int
41096test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041098
Daniel Veillarde43cc572004-11-03 11:50:29 +000041099#ifdef LIBXML_WRITER_ENABLED
41100 int mem_base;
41101 int ret_val;
41102 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41103 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041104 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041105 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041106 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041107 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041108
Daniel Veillarde43cc572004-11-03 11:50:29 +000041109 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41110 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41111 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041113 writer = gen_xmlTextWriterPtr(n_writer, 0);
41114 name = gen_const_xmlChar_ptr(n_name, 1);
41115 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041116
William M. Brackf13f77f2004-11-12 16:03:48 +000041117 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041118 desret_int(ret_val);
41119 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041120 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041121 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41122 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041123 xmlResetLastError();
41124 if (mem_base != xmlMemBlocks()) {
41125 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041127 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041128 printf(" %d", n_writer);
41129 printf(" %d", n_name);
41130 printf(" %d", n_content);
41131 printf("\n");
41132 }
41133 }
41134 }
41135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041136 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041137#endif
41138
Daniel Veillard42595322004-11-08 10:52:06 +000041139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041140}
41141
41142
41143static int
41144test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041146
Daniel Veillarde43cc572004-11-03 11:50:29 +000041147#ifdef LIBXML_WRITER_ENABLED
41148 int mem_base;
41149 int ret_val;
41150 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41151 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041152 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041153 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041154 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041155 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041156 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041157 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041158 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041159 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041160
Daniel Veillarde43cc572004-11-03 11:50:29 +000041161 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41162 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41163 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41164 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41165 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041167 writer = gen_xmlTextWriterPtr(n_writer, 0);
41168 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41169 name = gen_const_xmlChar_ptr(n_name, 2);
41170 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41171 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041172
William M. Brackf13f77f2004-11-12 16:03:48 +000041173 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041174 desret_int(ret_val);
41175 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041176 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041177 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41178 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41179 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41180 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041181 xmlResetLastError();
41182 if (mem_base != xmlMemBlocks()) {
41183 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041185 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041186 printf(" %d", n_writer);
41187 printf(" %d", n_prefix);
41188 printf(" %d", n_name);
41189 printf(" %d", n_namespaceURI);
41190 printf(" %d", n_content);
41191 printf("\n");
41192 }
41193 }
41194 }
41195 }
41196 }
41197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041198 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041199#endif
41200
Daniel Veillard42595322004-11-08 10:52:06 +000041201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041202}
41203
41204
41205static int
41206test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041208
Daniel Veillarde43cc572004-11-03 11:50:29 +000041209#ifdef LIBXML_WRITER_ENABLED
41210 int mem_base;
41211 int ret_val;
41212 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41213 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041214 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041215 int n_data;
41216 int start; /* the position within the data of the first byte to encode */
41217 int n_start;
41218 int len; /* the number of bytes to encode */
41219 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041220
Daniel Veillarde43cc572004-11-03 11:50:29 +000041221 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41222 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41223 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41224 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41225 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041226 writer = gen_xmlTextWriterPtr(n_writer, 0);
41227 data = gen_const_char_ptr(n_data, 1);
41228 start = gen_int(n_start, 2);
41229 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041230
William M. Brackf13f77f2004-11-12 16:03:48 +000041231 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041232 desret_int(ret_val);
41233 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041234 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041235 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041236 des_int(n_start, start, 2);
41237 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041238 xmlResetLastError();
41239 if (mem_base != xmlMemBlocks()) {
41240 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41241 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041242 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041243 printf(" %d", n_writer);
41244 printf(" %d", n_data);
41245 printf(" %d", n_start);
41246 printf(" %d", n_len);
41247 printf("\n");
41248 }
41249 }
41250 }
41251 }
41252 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041253 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041254#endif
41255
Daniel Veillard42595322004-11-08 10:52:06 +000041256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041257}
41258
41259
41260static int
41261test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041263
Daniel Veillarde43cc572004-11-03 11:50:29 +000041264#ifdef LIBXML_WRITER_ENABLED
41265 int mem_base;
41266 int ret_val;
41267 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41268 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041269 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041270 int n_data;
41271 int start; /* the position within the data of the first byte to encode */
41272 int n_start;
41273 int len; /* the number of bytes to encode */
41274 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041275
Daniel Veillarde43cc572004-11-03 11:50:29 +000041276 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41277 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41278 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41279 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041281 writer = gen_xmlTextWriterPtr(n_writer, 0);
41282 data = gen_const_char_ptr(n_data, 1);
41283 start = gen_int(n_start, 2);
41284 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041285
William M. Brackf13f77f2004-11-12 16:03:48 +000041286 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041287 desret_int(ret_val);
41288 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041289 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041290 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041291 des_int(n_start, start, 2);
41292 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041293 xmlResetLastError();
41294 if (mem_base != xmlMemBlocks()) {
41295 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041297 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041298 printf(" %d", n_writer);
41299 printf(" %d", n_data);
41300 printf(" %d", n_start);
41301 printf(" %d", n_len);
41302 printf("\n");
41303 }
41304 }
41305 }
41306 }
41307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041308 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041309#endif
41310
Daniel Veillard42595322004-11-08 10:52:06 +000041311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041312}
41313
41314
41315static int
41316test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041318
Daniel Veillarde43cc572004-11-03 11:50:29 +000041319#ifdef LIBXML_WRITER_ENABLED
41320 int mem_base;
41321 int ret_val;
41322 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41323 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041324 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041325 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041326
Daniel Veillarde43cc572004-11-03 11:50:29 +000041327 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41328 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041330 writer = gen_xmlTextWriterPtr(n_writer, 0);
41331 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041332
William M. Brackf13f77f2004-11-12 16:03:48 +000041333 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041334 desret_int(ret_val);
41335 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041336 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041337 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041338 xmlResetLastError();
41339 if (mem_base != xmlMemBlocks()) {
41340 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041342 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041343 printf(" %d", n_writer);
41344 printf(" %d", n_content);
41345 printf("\n");
41346 }
41347 }
41348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041349 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041350#endif
41351
Daniel Veillard42595322004-11-08 10:52:06 +000041352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041353}
41354
41355
41356static int
41357test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041359
Daniel Veillarde43cc572004-11-03 11:50:29 +000041360#ifdef LIBXML_WRITER_ENABLED
41361 int mem_base;
41362 int ret_val;
41363 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41364 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041365 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041366 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041367
Daniel Veillarde43cc572004-11-03 11:50:29 +000041368 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41369 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041371 writer = gen_xmlTextWriterPtr(n_writer, 0);
41372 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041373
William M. Brackf13f77f2004-11-12 16:03:48 +000041374 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041375 desret_int(ret_val);
41376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041377 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041378 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041379 xmlResetLastError();
41380 if (mem_base != xmlMemBlocks()) {
41381 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041383 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041384 printf(" %d", n_writer);
41385 printf(" %d", n_content);
41386 printf("\n");
41387 }
41388 }
41389 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041390 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041391#endif
41392
Daniel Veillard42595322004-11-08 10:52:06 +000041393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041394}
41395
41396
41397static int
41398test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041400
Daniel Veillarde43cc572004-11-03 11:50:29 +000041401#ifdef LIBXML_WRITER_ENABLED
41402 int mem_base;
41403 int ret_val;
41404 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41405 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041406 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041407 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041408 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041409 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041410 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041411 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041412 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041413 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041414
Daniel Veillarde43cc572004-11-03 11:50:29 +000041415 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41416 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41417 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41418 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41419 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041421 writer = gen_xmlTextWriterPtr(n_writer, 0);
41422 name = gen_const_xmlChar_ptr(n_name, 1);
41423 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41424 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41425 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041426
William M. Brackf13f77f2004-11-12 16:03:48 +000041427 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041428 desret_int(ret_val);
41429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041430 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041431 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41432 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41433 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41434 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041435 xmlResetLastError();
41436 if (mem_base != xmlMemBlocks()) {
41437 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041439 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041440 printf(" %d", n_writer);
41441 printf(" %d", n_name);
41442 printf(" %d", n_pubid);
41443 printf(" %d", n_sysid);
41444 printf(" %d", n_subset);
41445 printf("\n");
41446 }
41447 }
41448 }
41449 }
41450 }
41451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041452 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041453#endif
41454
Daniel Veillard42595322004-11-08 10:52:06 +000041455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041456}
41457
41458
41459static int
41460test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041462
Daniel Veillarde43cc572004-11-03 11:50:29 +000041463#ifdef LIBXML_WRITER_ENABLED
41464 int mem_base;
41465 int ret_val;
41466 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41467 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041468 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041469 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041470 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041471 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041472
Daniel Veillarde43cc572004-11-03 11:50:29 +000041473 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41474 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41475 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041477 writer = gen_xmlTextWriterPtr(n_writer, 0);
41478 name = gen_const_xmlChar_ptr(n_name, 1);
41479 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041480
William M. Brackf13f77f2004-11-12 16:03:48 +000041481 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041482 desret_int(ret_val);
41483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041484 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041485 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41486 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041487 xmlResetLastError();
41488 if (mem_base != xmlMemBlocks()) {
41489 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041491 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041492 printf(" %d", n_writer);
41493 printf(" %d", n_name);
41494 printf(" %d", n_content);
41495 printf("\n");
41496 }
41497 }
41498 }
41499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041500 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041501#endif
41502
Daniel Veillard42595322004-11-08 10:52:06 +000041503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041504}
41505
41506
41507static int
41508test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041510
Daniel Veillarde43cc572004-11-03 11:50:29 +000041511#ifdef LIBXML_WRITER_ENABLED
41512 int mem_base;
41513 int ret_val;
41514 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41515 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041516 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041517 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041518 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041519 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041520
Daniel Veillarde43cc572004-11-03 11:50:29 +000041521 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41522 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41523 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41524 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041525 writer = gen_xmlTextWriterPtr(n_writer, 0);
41526 name = gen_const_xmlChar_ptr(n_name, 1);
41527 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041528
William M. Brackf13f77f2004-11-12 16:03:48 +000041529 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041530 desret_int(ret_val);
41531 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041532 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041533 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41534 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041535 xmlResetLastError();
41536 if (mem_base != xmlMemBlocks()) {
41537 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041539 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041540 printf(" %d", n_writer);
41541 printf(" %d", n_name);
41542 printf(" %d", n_content);
41543 printf("\n");
41544 }
41545 }
41546 }
41547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041548 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041549#endif
41550
Daniel Veillard42595322004-11-08 10:52:06 +000041551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041552}
41553
41554
41555static int
41556test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041558
Daniel Veillarde43cc572004-11-03 11:50:29 +000041559#ifdef LIBXML_WRITER_ENABLED
41560 int mem_base;
41561 int ret_val;
41562 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41563 int n_writer;
41564 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41565 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041566 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041567 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041568 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041569 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041570 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041572 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041573 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041574 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041575 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041576
Daniel Veillarde43cc572004-11-03 11:50:29 +000041577 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41578 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41579 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41580 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41581 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41582 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41583 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41584 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041585 writer = gen_xmlTextWriterPtr(n_writer, 0);
41586 pe = gen_int(n_pe, 1);
41587 name = gen_const_xmlChar_ptr(n_name, 2);
41588 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41589 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41590 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41591 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041592
William M. Brackf13f77f2004-11-12 16:03:48 +000041593 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 +000041594 desret_int(ret_val);
41595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041596 des_xmlTextWriterPtr(n_writer, writer, 0);
41597 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041598 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41599 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41600 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41601 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41602 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041603 xmlResetLastError();
41604 if (mem_base != xmlMemBlocks()) {
41605 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041607 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041608 printf(" %d", n_writer);
41609 printf(" %d", n_pe);
41610 printf(" %d", n_name);
41611 printf(" %d", n_pubid);
41612 printf(" %d", n_sysid);
41613 printf(" %d", n_ndataid);
41614 printf(" %d", n_content);
41615 printf("\n");
41616 }
41617 }
41618 }
41619 }
41620 }
41621 }
41622 }
41623 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041624 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041625#endif
41626
Daniel Veillard42595322004-11-08 10:52:06 +000041627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041628}
41629
41630
41631static int
41632test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041634
Daniel Veillarde43cc572004-11-03 11:50:29 +000041635#ifdef LIBXML_WRITER_ENABLED
41636 int mem_base;
41637 int ret_val;
41638 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41639 int n_writer;
41640 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41641 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041642 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041643 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041644 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041645 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041646 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041647 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041648 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041649 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041650
Daniel Veillarde43cc572004-11-03 11:50:29 +000041651 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41652 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41653 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41654 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41655 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41656 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041658 writer = gen_xmlTextWriterPtr(n_writer, 0);
41659 pe = gen_int(n_pe, 1);
41660 name = gen_const_xmlChar_ptr(n_name, 2);
41661 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41662 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41663 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041664
William M. Brackf13f77f2004-11-12 16:03:48 +000041665 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041666 desret_int(ret_val);
41667 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041668 des_xmlTextWriterPtr(n_writer, writer, 0);
41669 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041670 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41671 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41672 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41673 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041674 xmlResetLastError();
41675 if (mem_base != xmlMemBlocks()) {
41676 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041678 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041679 printf(" %d", n_writer);
41680 printf(" %d", n_pe);
41681 printf(" %d", n_name);
41682 printf(" %d", n_pubid);
41683 printf(" %d", n_sysid);
41684 printf(" %d", n_ndataid);
41685 printf("\n");
41686 }
41687 }
41688 }
41689 }
41690 }
41691 }
41692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041693 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041694#endif
41695
Daniel Veillard42595322004-11-08 10:52:06 +000041696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041697}
41698
41699
41700static int
41701test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041703
Daniel Veillarde43cc572004-11-03 11:50:29 +000041704#ifdef LIBXML_WRITER_ENABLED
41705 int mem_base;
41706 int ret_val;
41707 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41708 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041709 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041710 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041711 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041712 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041713 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041714 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041715
Daniel Veillarde43cc572004-11-03 11:50:29 +000041716 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41717 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41718 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41719 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41720 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041721 writer = gen_xmlTextWriterPtr(n_writer, 0);
41722 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41723 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41724 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041725
William M. Brackf13f77f2004-11-12 16:03:48 +000041726 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041727 desret_int(ret_val);
41728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041729 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041730 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41731 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41732 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041733 xmlResetLastError();
41734 if (mem_base != xmlMemBlocks()) {
41735 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041737 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738 printf(" %d", n_writer);
41739 printf(" %d", n_pubid);
41740 printf(" %d", n_sysid);
41741 printf(" %d", n_ndataid);
41742 printf("\n");
41743 }
41744 }
41745 }
41746 }
41747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041748 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041749#endif
41750
Daniel Veillard42595322004-11-08 10:52:06 +000041751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041752}
41753
41754
41755static int
41756test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041758
Daniel Veillarde43cc572004-11-03 11:50:29 +000041759#ifdef LIBXML_WRITER_ENABLED
41760 int mem_base;
41761 int ret_val;
41762 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41763 int n_writer;
41764 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41765 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041766 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041767 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041768 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041769 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041770
Daniel Veillarde43cc572004-11-03 11:50:29 +000041771 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41772 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41773 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41774 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041776 writer = gen_xmlTextWriterPtr(n_writer, 0);
41777 pe = gen_int(n_pe, 1);
41778 name = gen_const_xmlChar_ptr(n_name, 2);
41779 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041780
William M. Brackf13f77f2004-11-12 16:03:48 +000041781 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041782 desret_int(ret_val);
41783 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041784 des_xmlTextWriterPtr(n_writer, writer, 0);
41785 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041786 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41787 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041788 xmlResetLastError();
41789 if (mem_base != xmlMemBlocks()) {
41790 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041792 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041793 printf(" %d", n_writer);
41794 printf(" %d", n_pe);
41795 printf(" %d", n_name);
41796 printf(" %d", n_content);
41797 printf("\n");
41798 }
41799 }
41800 }
41801 }
41802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041803 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041804#endif
41805
Daniel Veillard42595322004-11-08 10:52:06 +000041806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041807}
41808
41809
41810static int
41811test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041813
Daniel Veillarde43cc572004-11-03 11:50:29 +000041814#ifdef LIBXML_WRITER_ENABLED
41815 int mem_base;
41816 int ret_val;
41817 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41818 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041819 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041820 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041821 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041822 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041823 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041824 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041825
Daniel Veillarde43cc572004-11-03 11:50:29 +000041826 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41827 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41828 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41829 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041831 writer = gen_xmlTextWriterPtr(n_writer, 0);
41832 name = gen_const_xmlChar_ptr(n_name, 1);
41833 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41834 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041835
William M. Brackf13f77f2004-11-12 16:03:48 +000041836 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041837 desret_int(ret_val);
41838 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041839 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041840 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41841 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41842 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041843 xmlResetLastError();
41844 if (mem_base != xmlMemBlocks()) {
41845 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041847 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041848 printf(" %d", n_writer);
41849 printf(" %d", n_name);
41850 printf(" %d", n_pubid);
41851 printf(" %d", n_sysid);
41852 printf("\n");
41853 }
41854 }
41855 }
41856 }
41857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041858 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041859#endif
41860
Daniel Veillard42595322004-11-08 10:52:06 +000041861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041862}
41863
41864
41865static int
41866test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041868
Daniel Veillarde43cc572004-11-03 11:50:29 +000041869#ifdef LIBXML_WRITER_ENABLED
41870 int mem_base;
41871 int ret_val;
41872 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41873 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041874 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041875 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041876 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041877 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041878
Daniel Veillarde43cc572004-11-03 11:50:29 +000041879 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41880 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41881 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041883 writer = gen_xmlTextWriterPtr(n_writer, 0);
41884 name = gen_const_xmlChar_ptr(n_name, 1);
41885 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041886
William M. Brackf13f77f2004-11-12 16:03:48 +000041887 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041888 desret_int(ret_val);
41889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041890 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041891 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41892 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041893 xmlResetLastError();
41894 if (mem_base != xmlMemBlocks()) {
41895 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041897 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041898 printf(" %d", n_writer);
41899 printf(" %d", n_name);
41900 printf(" %d", n_content);
41901 printf("\n");
41902 }
41903 }
41904 }
41905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041906 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041907#endif
41908
Daniel Veillard42595322004-11-08 10:52:06 +000041909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041910}
41911
41912
41913static int
41914test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041916
Daniel Veillarde43cc572004-11-03 11:50:29 +000041917#ifdef LIBXML_WRITER_ENABLED
41918 int mem_base;
41919 int ret_val;
41920 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41921 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041922 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041923 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041924 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041925 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041926 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041927 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041928 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041929 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041930
Daniel Veillarde43cc572004-11-03 11:50:29 +000041931 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41932 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41933 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41934 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41935 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041937 writer = gen_xmlTextWriterPtr(n_writer, 0);
41938 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41939 name = gen_const_xmlChar_ptr(n_name, 2);
41940 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41941 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041942
William M. Brackf13f77f2004-11-12 16:03:48 +000041943 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041944 desret_int(ret_val);
41945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041946 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041947 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41948 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41949 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41950 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041951 xmlResetLastError();
41952 if (mem_base != xmlMemBlocks()) {
41953 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041955 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041956 printf(" %d", n_writer);
41957 printf(" %d", n_prefix);
41958 printf(" %d", n_name);
41959 printf(" %d", n_namespaceURI);
41960 printf(" %d", n_content);
41961 printf("\n");
41962 }
41963 }
41964 }
41965 }
41966 }
41967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041968 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041969#endif
41970
Daniel Veillard42595322004-11-08 10:52:06 +000041971 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041972}
41973
41974
41975static int
41976test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041977 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041978
41979
41980 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041982}
41983
41984
41985static int
41986test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041988
41989
41990 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041992}
41993
41994
41995static int
41996test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041998
41999
42000 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042002}
42003
42004
42005static int
42006test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042008
42009
42010 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042012}
42013
42014
42015static int
42016test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042018
42019
42020 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042022}
42023
42024
42025static int
42026test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042027 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042028
42029
42030 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042032}
42033
42034
42035static int
42036test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042038
42039
42040 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042042}
42043
42044
42045static int
42046test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042048
42049
42050 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042052}
42053
42054
42055static int
42056test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042058
42059
42060 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042062}
42063
42064
42065static int
42066test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042068
42069
42070 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042072}
42073
42074
42075static int
42076test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042078
42079
42080 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042082}
42083
42084
42085static int
42086test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042088
42089
42090 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042092}
42093
42094
42095static int
42096test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042098
42099
42100 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042102}
42103
42104
42105static int
42106test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042108
Daniel Veillarde43cc572004-11-03 11:50:29 +000042109#ifdef LIBXML_WRITER_ENABLED
42110 int mem_base;
42111 int ret_val;
42112 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42113 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042114 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042115 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042116 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042117 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042118
Daniel Veillarde43cc572004-11-03 11:50:29 +000042119 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42120 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42121 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42122 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042123 writer = gen_xmlTextWriterPtr(n_writer, 0);
42124 target = gen_const_xmlChar_ptr(n_target, 1);
42125 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042126
William M. Brackf13f77f2004-11-12 16:03:48 +000042127 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042128 desret_int(ret_val);
42129 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042130 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042131 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42132 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042133 xmlResetLastError();
42134 if (mem_base != xmlMemBlocks()) {
42135 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042137 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042138 printf(" %d", n_writer);
42139 printf(" %d", n_target);
42140 printf(" %d", n_content);
42141 printf("\n");
42142 }
42143 }
42144 }
42145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042146 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042147#endif
42148
Daniel Veillard42595322004-11-08 10:52:06 +000042149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042150}
42151
42152
42153static int
42154test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042156
Daniel Veillarde43cc572004-11-03 11:50:29 +000042157#ifdef LIBXML_WRITER_ENABLED
42158 int mem_base;
42159 int ret_val;
42160 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42161 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042162 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042163 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042164
Daniel Veillarde43cc572004-11-03 11:50:29 +000042165 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42166 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042168 writer = gen_xmlTextWriterPtr(n_writer, 0);
42169 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042170
William M. Brackf13f77f2004-11-12 16:03:48 +000042171 ret_val = xmlTextWriterWriteRaw(writer, (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_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042176 xmlResetLastError();
42177 if (mem_base != xmlMemBlocks()) {
42178 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042180 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042181 printf(" %d", n_writer);
42182 printf(" %d", n_content);
42183 printf("\n");
42184 }
42185 }
42186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042187 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042188#endif
42189
Daniel Veillard42595322004-11-08 10:52:06 +000042190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042191}
42192
42193
42194static int
42195test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042197
Daniel Veillarde43cc572004-11-03 11:50:29 +000042198#ifdef LIBXML_WRITER_ENABLED
42199 int mem_base;
42200 int ret_val;
42201 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42202 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042203 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042204 int n_content;
42205 int len; /* length of the text string */
42206 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042207
Daniel Veillarde43cc572004-11-03 11:50:29 +000042208 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42209 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42210 for (n_len = 0;n_len < gen_nb_int;n_len++) {
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);
42214 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042215
William M. Brackf13f77f2004-11-12 16:03:48 +000042216 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042217 desret_int(ret_val);
42218 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042219 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042220 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042221 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042222 xmlResetLastError();
42223 if (mem_base != xmlMemBlocks()) {
42224 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42225 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042226 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042227 printf(" %d", n_writer);
42228 printf(" %d", n_content);
42229 printf(" %d", n_len);
42230 printf("\n");
42231 }
42232 }
42233 }
42234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042235 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042236#endif
42237
Daniel Veillard42595322004-11-08 10:52:06 +000042238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042239}
42240
42241
42242static int
42243test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042245
Daniel Veillarde43cc572004-11-03 11:50:29 +000042246#ifdef LIBXML_WRITER_ENABLED
42247 int mem_base;
42248 int ret_val;
42249 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42250 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042251 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042252 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042253
Daniel Veillarde43cc572004-11-03 11:50:29 +000042254 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42255 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042257 writer = gen_xmlTextWriterPtr(n_writer, 0);
42258 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042259
William M. Brackf13f77f2004-11-12 16:03:48 +000042260 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
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 Veillarde43cc572004-11-03 11:50:29 +000042265 xmlResetLastError();
42266 if (mem_base != xmlMemBlocks()) {
42267 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042269 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042270 printf(" %d", n_writer);
42271 printf(" %d", n_content);
42272 printf("\n");
42273 }
42274 }
42275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042276 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042277#endif
42278
Daniel Veillard42595322004-11-08 10:52:06 +000042279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042280}
42281
42282
42283static int
42284test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042286
42287
42288 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042290}
42291
42292
42293static int
42294test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042296
42297
42298 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042300}
42301
42302
42303static int
42304test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042306
42307
42308 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042310}
42311
42312
42313static int
42314test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042316
42317
42318 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042320}
42321
42322
42323static int
42324test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042326
42327
42328 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042330}
42331
42332
42333static int
42334test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042336
42337
42338 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042340}
42341
42342
42343static int
42344test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042346
42347
42348 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042350}
42351
42352
42353static int
42354test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042356
42357
42358 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042360}
42361
42362
42363static int
42364test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042366
42367
42368 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042370}
42371
42372
42373static int
42374test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042376
42377
42378 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042380}
42381
42382
42383static int
42384test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042386
42387
42388 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042390}
42391
42392
42393static int
42394test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042396
42397
42398 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042400}
42401
42402
42403static int
42404test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042406
42407
42408 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042410}
42411
42412static int
42413test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042415
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042416 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042417 test_ret += test_xmlNewTextWriter();
42418 test_ret += test_xmlNewTextWriterFilename();
42419 test_ret += test_xmlNewTextWriterMemory();
42420 test_ret += test_xmlNewTextWriterPushParser();
42421 test_ret += test_xmlNewTextWriterTree();
42422 test_ret += test_xmlTextWriterEndAttribute();
42423 test_ret += test_xmlTextWriterEndCDATA();
42424 test_ret += test_xmlTextWriterEndComment();
42425 test_ret += test_xmlTextWriterEndDTD();
42426 test_ret += test_xmlTextWriterEndDTDAttlist();
42427 test_ret += test_xmlTextWriterEndDTDElement();
42428 test_ret += test_xmlTextWriterEndDTDEntity();
42429 test_ret += test_xmlTextWriterEndDocument();
42430 test_ret += test_xmlTextWriterEndElement();
42431 test_ret += test_xmlTextWriterEndPI();
42432 test_ret += test_xmlTextWriterFlush();
42433 test_ret += test_xmlTextWriterFullEndElement();
42434 test_ret += test_xmlTextWriterSetIndent();
42435 test_ret += test_xmlTextWriterSetIndentString();
42436 test_ret += test_xmlTextWriterStartAttribute();
42437 test_ret += test_xmlTextWriterStartAttributeNS();
42438 test_ret += test_xmlTextWriterStartCDATA();
42439 test_ret += test_xmlTextWriterStartComment();
42440 test_ret += test_xmlTextWriterStartDTD();
42441 test_ret += test_xmlTextWriterStartDTDAttlist();
42442 test_ret += test_xmlTextWriterStartDTDElement();
42443 test_ret += test_xmlTextWriterStartDTDEntity();
42444 test_ret += test_xmlTextWriterStartDocument();
42445 test_ret += test_xmlTextWriterStartElement();
42446 test_ret += test_xmlTextWriterStartElementNS();
42447 test_ret += test_xmlTextWriterStartPI();
42448 test_ret += test_xmlTextWriterWriteAttribute();
42449 test_ret += test_xmlTextWriterWriteAttributeNS();
42450 test_ret += test_xmlTextWriterWriteBase64();
42451 test_ret += test_xmlTextWriterWriteBinHex();
42452 test_ret += test_xmlTextWriterWriteCDATA();
42453 test_ret += test_xmlTextWriterWriteComment();
42454 test_ret += test_xmlTextWriterWriteDTD();
42455 test_ret += test_xmlTextWriterWriteDTDAttlist();
42456 test_ret += test_xmlTextWriterWriteDTDElement();
42457 test_ret += test_xmlTextWriterWriteDTDEntity();
42458 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42459 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42460 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42461 test_ret += test_xmlTextWriterWriteDTDNotation();
42462 test_ret += test_xmlTextWriterWriteElement();
42463 test_ret += test_xmlTextWriterWriteElementNS();
42464 test_ret += test_xmlTextWriterWriteFormatAttribute();
42465 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42466 test_ret += test_xmlTextWriterWriteFormatCDATA();
42467 test_ret += test_xmlTextWriterWriteFormatComment();
42468 test_ret += test_xmlTextWriterWriteFormatDTD();
42469 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42470 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42471 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42472 test_ret += test_xmlTextWriterWriteFormatElement();
42473 test_ret += test_xmlTextWriterWriteFormatElementNS();
42474 test_ret += test_xmlTextWriterWriteFormatPI();
42475 test_ret += test_xmlTextWriterWriteFormatRaw();
42476 test_ret += test_xmlTextWriterWriteFormatString();
42477 test_ret += test_xmlTextWriterWritePI();
42478 test_ret += test_xmlTextWriterWriteRaw();
42479 test_ret += test_xmlTextWriterWriteRawLen();
42480 test_ret += test_xmlTextWriterWriteString();
42481 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42482 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42483 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42484 test_ret += test_xmlTextWriterWriteVFormatComment();
42485 test_ret += test_xmlTextWriterWriteVFormatDTD();
42486 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42487 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42488 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42489 test_ret += test_xmlTextWriterWriteVFormatElement();
42490 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42491 test_ret += test_xmlTextWriterWriteVFormatPI();
42492 test_ret += test_xmlTextWriterWriteVFormatRaw();
42493 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042494
Daniel Veillard42595322004-11-08 10:52:06 +000042495 if (test_ret != 0)
42496 printf("Module xmlwriter: %d errors\n", test_ret);
42497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042498}
42499
42500static int
42501test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042503
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042504#ifdef LIBXML_XPATH_ENABLED
42505 int mem_base;
42506 double ret_val;
42507 int val; /* a boolean */
42508 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042509
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042510 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42511 mem_base = xmlMemBlocks();
42512 val = gen_int(n_val, 0);
42513
42514 ret_val = xmlXPathCastBooleanToNumber(val);
42515 desret_double(ret_val);
42516 call_tests++;
42517 des_int(n_val, val, 0);
42518 xmlResetLastError();
42519 if (mem_base != xmlMemBlocks()) {
42520 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042522 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042523 printf(" %d", n_val);
42524 printf("\n");
42525 }
42526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042527 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042528#endif
42529
Daniel Veillard42595322004-11-08 10:52:06 +000042530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042531}
42532
42533
42534static int
42535test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042537
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042538#ifdef LIBXML_XPATH_ENABLED
42539 int mem_base;
42540 xmlChar * ret_val;
42541 int val; /* a boolean */
42542 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042543
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042544 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042546 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042547
42548 ret_val = xmlXPathCastBooleanToString(val);
42549 desret_xmlChar_ptr(ret_val);
42550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042551 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042552 xmlResetLastError();
42553 if (mem_base != xmlMemBlocks()) {
42554 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042556 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042557 printf(" %d", n_val);
42558 printf("\n");
42559 }
42560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042561 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042562#endif
42563
Daniel Veillard42595322004-11-08 10:52:06 +000042564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042565}
42566
42567
42568static int
42569test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042571
Daniel Veillardce682bc2004-11-05 17:22:25 +000042572#ifdef LIBXML_XPATH_ENABLED
42573 int mem_base;
42574 int ret_val;
42575 xmlNodeSetPtr ns; /* a node-set */
42576 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042577
Daniel Veillardce682bc2004-11-05 17:22:25 +000042578 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42579 mem_base = xmlMemBlocks();
42580 ns = gen_xmlNodeSetPtr(n_ns, 0);
42581
42582 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42583 desret_int(ret_val);
42584 call_tests++;
42585 des_xmlNodeSetPtr(n_ns, ns, 0);
42586 xmlResetLastError();
42587 if (mem_base != xmlMemBlocks()) {
42588 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042590 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042591 printf(" %d", n_ns);
42592 printf("\n");
42593 }
42594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042595 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042596#endif
42597
Daniel Veillard42595322004-11-08 10:52:06 +000042598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042599}
42600
42601
42602static int
42603test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042605
Daniel Veillardce682bc2004-11-05 17:22:25 +000042606#ifdef LIBXML_XPATH_ENABLED
42607 int mem_base;
42608 double ret_val;
42609 xmlNodeSetPtr ns; /* a node-set */
42610 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042611
Daniel Veillardce682bc2004-11-05 17:22:25 +000042612 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42613 mem_base = xmlMemBlocks();
42614 ns = gen_xmlNodeSetPtr(n_ns, 0);
42615
42616 ret_val = xmlXPathCastNodeSetToNumber(ns);
42617 desret_double(ret_val);
42618 call_tests++;
42619 des_xmlNodeSetPtr(n_ns, ns, 0);
42620 xmlResetLastError();
42621 if (mem_base != xmlMemBlocks()) {
42622 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042624 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042625 printf(" %d", n_ns);
42626 printf("\n");
42627 }
42628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042629 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042630#endif
42631
Daniel Veillard42595322004-11-08 10:52:06 +000042632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042633}
42634
42635
42636static int
42637test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042639
Daniel Veillardce682bc2004-11-05 17:22:25 +000042640#ifdef LIBXML_XPATH_ENABLED
42641 int mem_base;
42642 xmlChar * ret_val;
42643 xmlNodeSetPtr ns; /* a node-set */
42644 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042645
Daniel Veillardce682bc2004-11-05 17:22:25 +000042646 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42647 mem_base = xmlMemBlocks();
42648 ns = gen_xmlNodeSetPtr(n_ns, 0);
42649
42650 ret_val = xmlXPathCastNodeSetToString(ns);
42651 desret_xmlChar_ptr(ret_val);
42652 call_tests++;
42653 des_xmlNodeSetPtr(n_ns, ns, 0);
42654 xmlResetLastError();
42655 if (mem_base != xmlMemBlocks()) {
42656 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042658 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042659 printf(" %d", n_ns);
42660 printf("\n");
42661 }
42662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042663 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042664#endif
42665
Daniel Veillard42595322004-11-08 10:52:06 +000042666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042667}
42668
42669
42670static int
42671test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042673
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042674#ifdef LIBXML_XPATH_ENABLED
42675 int mem_base;
42676 double ret_val;
42677 xmlNodePtr node; /* a node */
42678 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042679
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042680 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42681 mem_base = xmlMemBlocks();
42682 node = gen_xmlNodePtr(n_node, 0);
42683
42684 ret_val = xmlXPathCastNodeToNumber(node);
42685 desret_double(ret_val);
42686 call_tests++;
42687 des_xmlNodePtr(n_node, node, 0);
42688 xmlResetLastError();
42689 if (mem_base != xmlMemBlocks()) {
42690 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042692 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042693 printf(" %d", n_node);
42694 printf("\n");
42695 }
42696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042697 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042698#endif
42699
Daniel Veillard42595322004-11-08 10:52:06 +000042700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042701}
42702
42703
42704static int
42705test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042707
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042708#ifdef LIBXML_XPATH_ENABLED
42709 int mem_base;
42710 xmlChar * ret_val;
42711 xmlNodePtr node; /* a node */
42712 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042713
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042714 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42715 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042716 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042717
42718 ret_val = xmlXPathCastNodeToString(node);
42719 desret_xmlChar_ptr(ret_val);
42720 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042721 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042722 xmlResetLastError();
42723 if (mem_base != xmlMemBlocks()) {
42724 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042726 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042727 printf(" %d", n_node);
42728 printf("\n");
42729 }
42730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042731 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042732#endif
42733
Daniel Veillard42595322004-11-08 10:52:06 +000042734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042735}
42736
42737
42738static int
42739test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042741
Daniel Veillard3d95c732004-11-06 22:25:14 +000042742#ifdef LIBXML_XPATH_ENABLED
42743 int mem_base;
42744 int ret_val;
42745 double val; /* a number */
42746 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042747
Daniel Veillard3d95c732004-11-06 22:25:14 +000042748 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42749 mem_base = xmlMemBlocks();
42750 val = gen_double(n_val, 0);
42751
42752 ret_val = xmlXPathCastNumberToBoolean(val);
42753 desret_int(ret_val);
42754 call_tests++;
42755 des_double(n_val, val, 0);
42756 xmlResetLastError();
42757 if (mem_base != xmlMemBlocks()) {
42758 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042760 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042761 printf(" %d", n_val);
42762 printf("\n");
42763 }
42764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042765 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042766#endif
42767
Daniel Veillard42595322004-11-08 10:52:06 +000042768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042769}
42770
42771
42772static int
42773test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042775
Daniel Veillard3d95c732004-11-06 22:25:14 +000042776#ifdef LIBXML_XPATH_ENABLED
42777 int mem_base;
42778 xmlChar * ret_val;
42779 double val; /* a number */
42780 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042781
Daniel Veillard3d95c732004-11-06 22:25:14 +000042782 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42783 mem_base = xmlMemBlocks();
42784 val = gen_double(n_val, 0);
42785
42786 ret_val = xmlXPathCastNumberToString(val);
42787 desret_xmlChar_ptr(ret_val);
42788 call_tests++;
42789 des_double(n_val, val, 0);
42790 xmlResetLastError();
42791 if (mem_base != xmlMemBlocks()) {
42792 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042794 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042795 printf(" %d", n_val);
42796 printf("\n");
42797 }
42798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042799 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042800#endif
42801
Daniel Veillard42595322004-11-08 10:52:06 +000042802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042803}
42804
42805
42806static int
42807test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042809
42810#ifdef LIBXML_XPATH_ENABLED
42811 int mem_base;
42812 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042813 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042814 int n_val;
42815
42816 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042818 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042819
William M. Brackf13f77f2004-11-12 16:03:48 +000042820 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042821 desret_int(ret_val);
42822 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042823 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042824 xmlResetLastError();
42825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042826 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042829 printf(" %d", n_val);
42830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042831 }
42832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042833 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042834#endif
42835
Daniel Veillard42595322004-11-08 10:52:06 +000042836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042837}
42838
42839
42840static int
42841test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042843
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042844#ifdef LIBXML_XPATH_ENABLED
42845 int mem_base;
42846 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042847 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042848 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042849
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042850 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42851 mem_base = xmlMemBlocks();
42852 val = gen_const_xmlChar_ptr(n_val, 0);
42853
William M. Brackf13f77f2004-11-12 16:03:48 +000042854 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042855 desret_double(ret_val);
42856 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042857 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042858 xmlResetLastError();
42859 if (mem_base != xmlMemBlocks()) {
42860 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042862 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042863 printf(" %d", n_val);
42864 printf("\n");
42865 }
42866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042867 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042868#endif
42869
Daniel Veillard42595322004-11-08 10:52:06 +000042870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042871}
42872
42873
42874static int
42875test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042877
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042878#ifdef LIBXML_XPATH_ENABLED
42879 int mem_base;
42880 int ret_val;
42881 xmlXPathObjectPtr val; /* an XPath object */
42882 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042883
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042884 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42885 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042886 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042887
42888 ret_val = xmlXPathCastToBoolean(val);
42889 desret_int(ret_val);
42890 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042891 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042892 xmlResetLastError();
42893 if (mem_base != xmlMemBlocks()) {
42894 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042896 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042897 printf(" %d", n_val);
42898 printf("\n");
42899 }
42900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042901 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042902#endif
42903
Daniel Veillard42595322004-11-08 10:52:06 +000042904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042905}
42906
42907
42908static int
42909test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042911
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042912#ifdef LIBXML_XPATH_ENABLED
42913 int mem_base;
42914 double ret_val;
42915 xmlXPathObjectPtr val; /* an XPath object */
42916 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042917
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042918 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42919 mem_base = xmlMemBlocks();
42920 val = gen_xmlXPathObjectPtr(n_val, 0);
42921
42922 ret_val = xmlXPathCastToNumber(val);
42923 desret_double(ret_val);
42924 call_tests++;
42925 des_xmlXPathObjectPtr(n_val, val, 0);
42926 xmlResetLastError();
42927 if (mem_base != xmlMemBlocks()) {
42928 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042930 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042931 printf(" %d", n_val);
42932 printf("\n");
42933 }
42934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042935 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042936#endif
42937
Daniel Veillard42595322004-11-08 10:52:06 +000042938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042939}
42940
42941
42942static int
42943test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042945
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042946#ifdef LIBXML_XPATH_ENABLED
42947 int mem_base;
42948 xmlChar * ret_val;
42949 xmlXPathObjectPtr val; /* an XPath object */
42950 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042951
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042952 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42953 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042954 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042955
42956 ret_val = xmlXPathCastToString(val);
42957 desret_xmlChar_ptr(ret_val);
42958 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042959 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042960 xmlResetLastError();
42961 if (mem_base != xmlMemBlocks()) {
42962 printf("Leak of %d blocks found in xmlXPathCastToString",
42963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042964 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042965 printf(" %d", n_val);
42966 printf("\n");
42967 }
42968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042969 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042970#endif
42971
Daniel Veillard42595322004-11-08 10:52:06 +000042972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042973}
42974
42975
42976static int
42977test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042979
42980#ifdef LIBXML_XPATH_ENABLED
42981 int mem_base;
42982 int ret_val;
42983 xmlNodePtr node1; /* the first node */
42984 int n_node1;
42985 xmlNodePtr node2; /* the second node */
42986 int n_node2;
42987
42988 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42989 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042991 node1 = gen_xmlNodePtr(n_node1, 0);
42992 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042993
42994 ret_val = xmlXPathCmpNodes(node1, node2);
42995 desret_int(ret_val);
42996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042997 des_xmlNodePtr(n_node1, node1, 0);
42998 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042999 xmlResetLastError();
43000 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043001 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043003 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043004 printf(" %d", n_node1);
43005 printf(" %d", n_node2);
43006 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043007 }
43008 }
43009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043010 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043011#endif
43012
Daniel Veillard42595322004-11-08 10:52:06 +000043013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043014}
43015
43016
43017static int
43018test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043020
43021
43022 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043024}
43025
Daniel Veillarda521d282004-11-09 14:59:59 +000043026#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043027
Daniel Veillardce682bc2004-11-05 17:22:25 +000043028#define gen_nb_xmlXPathCompExprPtr 1
43029static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43030 return(NULL);
43031}
43032static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43033}
Daniel Veillarda521d282004-11-09 14:59:59 +000043034#endif
43035
43036#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043037
43038#define gen_nb_xmlXPathContextPtr 1
43039static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43040 return(NULL);
43041}
43042static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43043}
Daniel Veillarda521d282004-11-09 14:59:59 +000043044#endif
43045
Daniel Veillardce682bc2004-11-05 17:22:25 +000043046
Daniel Veillardd93f6252004-11-02 15:53:51 +000043047static int
43048test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043050
Daniel Veillardce682bc2004-11-05 17:22:25 +000043051#ifdef LIBXML_XPATH_ENABLED
43052 int mem_base;
43053 xmlXPathObjectPtr ret_val;
43054 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43055 int n_comp;
43056 xmlXPathContextPtr ctx; /* the XPath context */
43057 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043058
Daniel Veillardce682bc2004-11-05 17:22:25 +000043059 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43060 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43061 mem_base = xmlMemBlocks();
43062 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43063 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43064
43065 ret_val = xmlXPathCompiledEval(comp, ctx);
43066 desret_xmlXPathObjectPtr(ret_val);
43067 call_tests++;
43068 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43069 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43070 xmlResetLastError();
43071 if (mem_base != xmlMemBlocks()) {
43072 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043074 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043075 printf(" %d", n_comp);
43076 printf(" %d", n_ctx);
43077 printf("\n");
43078 }
43079 }
43080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043081 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043082#endif
43083
Daniel Veillard42595322004-11-08 10:52:06 +000043084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043085}
43086
43087
43088static int
43089test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043090 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043091
Daniel Veillard3d97e662004-11-04 10:49:00 +000043092#ifdef LIBXML_XPATH_ENABLED
43093 int mem_base;
43094 xmlXPathObjectPtr ret_val;
43095 xmlXPathObjectPtr val; /* an XPath object */
43096 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043097
Daniel Veillard3d97e662004-11-04 10:49:00 +000043098 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43099 mem_base = xmlMemBlocks();
43100 val = gen_xmlXPathObjectPtr(n_val, 0);
43101
43102 ret_val = xmlXPathConvertBoolean(val);
43103 val = NULL;
43104 desret_xmlXPathObjectPtr(ret_val);
43105 call_tests++;
43106 des_xmlXPathObjectPtr(n_val, val, 0);
43107 xmlResetLastError();
43108 if (mem_base != xmlMemBlocks()) {
43109 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043111 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043112 printf(" %d", n_val);
43113 printf("\n");
43114 }
43115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043116 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043117#endif
43118
Daniel Veillard42595322004-11-08 10:52:06 +000043119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043120}
43121
43122
43123static int
43124test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043126
Daniel Veillard3d97e662004-11-04 10:49:00 +000043127#ifdef LIBXML_XPATH_ENABLED
43128 int mem_base;
43129 xmlXPathObjectPtr ret_val;
43130 xmlXPathObjectPtr val; /* an XPath object */
43131 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043132
Daniel Veillard3d97e662004-11-04 10:49:00 +000043133 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43134 mem_base = xmlMemBlocks();
43135 val = gen_xmlXPathObjectPtr(n_val, 0);
43136
43137 ret_val = xmlXPathConvertNumber(val);
43138 val = NULL;
43139 desret_xmlXPathObjectPtr(ret_val);
43140 call_tests++;
43141 des_xmlXPathObjectPtr(n_val, val, 0);
43142 xmlResetLastError();
43143 if (mem_base != xmlMemBlocks()) {
43144 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043146 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043147 printf(" %d", n_val);
43148 printf("\n");
43149 }
43150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043151 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043152#endif
43153
Daniel Veillard42595322004-11-08 10:52:06 +000043154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043155}
43156
43157
43158static int
43159test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043161
Daniel Veillard3d97e662004-11-04 10:49:00 +000043162#ifdef LIBXML_XPATH_ENABLED
43163 int mem_base;
43164 xmlXPathObjectPtr ret_val;
43165 xmlXPathObjectPtr val; /* an XPath object */
43166 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043167
Daniel Veillard3d97e662004-11-04 10:49:00 +000043168 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43169 mem_base = xmlMemBlocks();
43170 val = gen_xmlXPathObjectPtr(n_val, 0);
43171
43172 ret_val = xmlXPathConvertString(val);
43173 val = NULL;
43174 desret_xmlXPathObjectPtr(ret_val);
43175 call_tests++;
43176 des_xmlXPathObjectPtr(n_val, val, 0);
43177 xmlResetLastError();
43178 if (mem_base != xmlMemBlocks()) {
43179 printf("Leak of %d blocks found in xmlXPathConvertString",
43180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043181 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043182 printf(" %d", n_val);
43183 printf("\n");
43184 }
43185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043186 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043187#endif
43188
Daniel Veillard42595322004-11-08 10:52:06 +000043189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043190}
43191
43192
43193static int
43194test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043196
43197
43198 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043200}
43201
43202
43203static int
43204test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043206
Daniel Veillardce682bc2004-11-05 17:22:25 +000043207#ifdef LIBXML_XPATH_ENABLED
43208 int mem_base;
43209 xmlXPathObjectPtr ret_val;
43210 xmlChar * str; /* the XPath expression */
43211 int n_str;
43212 xmlXPathContextPtr ctx; /* the XPath context */
43213 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043214
Daniel Veillardce682bc2004-11-05 17:22:25 +000043215 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43216 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43217 mem_base = xmlMemBlocks();
43218 str = gen_const_xmlChar_ptr(n_str, 0);
43219 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43220
William M. Brackf13f77f2004-11-12 16:03:48 +000043221 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043222 desret_xmlXPathObjectPtr(ret_val);
43223 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043224 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043225 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43226 xmlResetLastError();
43227 if (mem_base != xmlMemBlocks()) {
43228 printf("Leak of %d blocks found in xmlXPathEval",
43229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043230 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043231 printf(" %d", n_str);
43232 printf(" %d", n_ctx);
43233 printf("\n");
43234 }
43235 }
43236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043237 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043238#endif
43239
Daniel Veillard42595322004-11-08 10:52:06 +000043240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043241}
43242
43243
43244static int
43245test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043247
Daniel Veillardce682bc2004-11-05 17:22:25 +000043248#ifdef LIBXML_XPATH_ENABLED
43249 int mem_base;
43250 xmlXPathObjectPtr ret_val;
43251 xmlChar * str; /* the XPath expression */
43252 int n_str;
43253 xmlXPathContextPtr ctxt; /* the XPath context */
43254 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043255
Daniel Veillardce682bc2004-11-05 17:22:25 +000043256 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43257 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43258 mem_base = xmlMemBlocks();
43259 str = gen_const_xmlChar_ptr(n_str, 0);
43260 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43261
William M. Brackf13f77f2004-11-12 16:03:48 +000043262 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043263 desret_xmlXPathObjectPtr(ret_val);
43264 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043265 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043266 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43267 xmlResetLastError();
43268 if (mem_base != xmlMemBlocks()) {
43269 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043271 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043272 printf(" %d", n_str);
43273 printf(" %d", n_ctxt);
43274 printf("\n");
43275 }
43276 }
43277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043278 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043279#endif
43280
Daniel Veillard42595322004-11-08 10:52:06 +000043281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043282}
43283
43284
43285static int
43286test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043288
Daniel Veillardce682bc2004-11-05 17:22:25 +000043289#ifdef LIBXML_XPATH_ENABLED
43290 int mem_base;
43291 int ret_val;
43292 xmlXPathContextPtr ctxt; /* the XPath context */
43293 int n_ctxt;
43294 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43295 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043296
Daniel Veillardce682bc2004-11-05 17:22:25 +000043297 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43298 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43299 mem_base = xmlMemBlocks();
43300 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43301 res = gen_xmlXPathObjectPtr(n_res, 1);
43302
43303 ret_val = xmlXPathEvalPredicate(ctxt, res);
43304 desret_int(ret_val);
43305 call_tests++;
43306 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43307 des_xmlXPathObjectPtr(n_res, res, 1);
43308 xmlResetLastError();
43309 if (mem_base != xmlMemBlocks()) {
43310 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043312 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043313 printf(" %d", n_ctxt);
43314 printf(" %d", n_res);
43315 printf("\n");
43316 }
43317 }
43318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043319 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043320#endif
43321
Daniel Veillard42595322004-11-08 10:52:06 +000043322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043323}
43324
43325
43326static int
43327test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043329
43330#ifdef LIBXML_XPATH_ENABLED
43331 int mem_base;
43332
43333 mem_base = xmlMemBlocks();
43334
43335 xmlXPathInit();
43336 call_tests++;
43337 xmlResetLastError();
43338 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043339 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043341 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043342 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043344 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043345#endif
43346
Daniel Veillard42595322004-11-08 10:52:06 +000043347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043348}
43349
43350
43351static int
43352test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043354
Daniel Veillard3d95c732004-11-06 22:25:14 +000043355#ifdef LIBXML_XPATH_ENABLED
43356 int mem_base;
43357 int ret_val;
43358 double val; /* a double value */
43359 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043360
Daniel Veillard3d95c732004-11-06 22:25:14 +000043361 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43362 mem_base = xmlMemBlocks();
43363 val = gen_double(n_val, 0);
43364
43365 ret_val = xmlXPathIsInf(val);
43366 desret_int(ret_val);
43367 call_tests++;
43368 des_double(n_val, val, 0);
43369 xmlResetLastError();
43370 if (mem_base != xmlMemBlocks()) {
43371 printf("Leak of %d blocks found in xmlXPathIsInf",
43372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043373 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043374 printf(" %d", n_val);
43375 printf("\n");
43376 }
43377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043378 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043379#endif
43380
Daniel Veillard42595322004-11-08 10:52:06 +000043381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043382}
43383
43384
43385static int
43386test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043388
Daniel Veillard3d95c732004-11-06 22:25:14 +000043389#ifdef LIBXML_XPATH_ENABLED
43390 int mem_base;
43391 int ret_val;
43392 double val; /* a double value */
43393 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043394
Daniel Veillard3d95c732004-11-06 22:25:14 +000043395 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43396 mem_base = xmlMemBlocks();
43397 val = gen_double(n_val, 0);
43398
43399 ret_val = xmlXPathIsNaN(val);
43400 desret_int(ret_val);
43401 call_tests++;
43402 des_double(n_val, val, 0);
43403 xmlResetLastError();
43404 if (mem_base != xmlMemBlocks()) {
43405 printf("Leak of %d blocks found in xmlXPathIsNaN",
43406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043407 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043408 printf(" %d", n_val);
43409 printf("\n");
43410 }
43411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043412 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043413#endif
43414
Daniel Veillard42595322004-11-08 10:52:06 +000043415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043416}
43417
43418
43419static int
43420test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043422
43423
43424 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043426}
43427
43428
43429static int
43430test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043432
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043433#ifdef LIBXML_XPATH_ENABLED
43434 int mem_base;
43435 xmlNodeSetPtr ret_val;
43436 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43437 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043438
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043439 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43440 mem_base = xmlMemBlocks();
43441 val = gen_xmlNodePtr(n_val, 0);
43442
43443 ret_val = xmlXPathNodeSetCreate(val);
43444 desret_xmlNodeSetPtr(ret_val);
43445 call_tests++;
43446 des_xmlNodePtr(n_val, val, 0);
43447 xmlResetLastError();
43448 if (mem_base != xmlMemBlocks()) {
43449 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43450 xmlMemBlocks() - mem_base);
43451 test_ret++;
43452 printf(" %d", n_val);
43453 printf("\n");
43454 }
43455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043456 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +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_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043466
Daniel Veillard3d97e662004-11-04 10:49:00 +000043467#ifdef LIBXML_XPATH_ENABLED
43468 int mem_base;
43469 xmlXPathObjectPtr ret_val;
43470 xmlXPathObjectPtr val; /* the original object */
43471 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043472
Daniel Veillard3d97e662004-11-04 10:49:00 +000043473 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43474 mem_base = xmlMemBlocks();
43475 val = gen_xmlXPathObjectPtr(n_val, 0);
43476
43477 ret_val = xmlXPathObjectCopy(val);
43478 desret_xmlXPathObjectPtr(ret_val);
43479 call_tests++;
43480 des_xmlXPathObjectPtr(n_val, val, 0);
43481 xmlResetLastError();
43482 if (mem_base != xmlMemBlocks()) {
43483 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043485 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043486 printf(" %d", n_val);
43487 printf("\n");
43488 }
43489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043490 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043491#endif
43492
Daniel Veillard42595322004-11-08 10:52:06 +000043493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043494}
43495
43496
43497static int
43498test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043500
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043501#ifdef LIBXML_XPATH_ENABLED
43502 int mem_base;
43503 long ret_val;
43504 xmlDocPtr doc; /* an input document */
43505 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043506
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043507 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43508 mem_base = xmlMemBlocks();
43509 doc = gen_xmlDocPtr(n_doc, 0);
43510
43511 ret_val = xmlXPathOrderDocElems(doc);
43512 desret_long(ret_val);
43513 call_tests++;
43514 des_xmlDocPtr(n_doc, doc, 0);
43515 xmlResetLastError();
43516 if (mem_base != xmlMemBlocks()) {
43517 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043519 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043520 printf(" %d", n_doc);
43521 printf("\n");
43522 }
43523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043524 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043525#endif
43526
Daniel Veillard42595322004-11-08 10:52:06 +000043527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043528}
43529
43530static int
43531test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043533
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043534 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043535 test_ret += test_xmlXPathCastBooleanToNumber();
43536 test_ret += test_xmlXPathCastBooleanToString();
43537 test_ret += test_xmlXPathCastNodeSetToBoolean();
43538 test_ret += test_xmlXPathCastNodeSetToNumber();
43539 test_ret += test_xmlXPathCastNodeSetToString();
43540 test_ret += test_xmlXPathCastNodeToNumber();
43541 test_ret += test_xmlXPathCastNodeToString();
43542 test_ret += test_xmlXPathCastNumberToBoolean();
43543 test_ret += test_xmlXPathCastNumberToString();
43544 test_ret += test_xmlXPathCastStringToBoolean();
43545 test_ret += test_xmlXPathCastStringToNumber();
43546 test_ret += test_xmlXPathCastToBoolean();
43547 test_ret += test_xmlXPathCastToNumber();
43548 test_ret += test_xmlXPathCastToString();
43549 test_ret += test_xmlXPathCmpNodes();
43550 test_ret += test_xmlXPathCompile();
43551 test_ret += test_xmlXPathCompiledEval();
43552 test_ret += test_xmlXPathConvertBoolean();
43553 test_ret += test_xmlXPathConvertNumber();
43554 test_ret += test_xmlXPathConvertString();
43555 test_ret += test_xmlXPathCtxtCompile();
43556 test_ret += test_xmlXPathEval();
43557 test_ret += test_xmlXPathEvalExpression();
43558 test_ret += test_xmlXPathEvalPredicate();
43559 test_ret += test_xmlXPathInit();
43560 test_ret += test_xmlXPathIsInf();
43561 test_ret += test_xmlXPathIsNaN();
43562 test_ret += test_xmlXPathNewContext();
43563 test_ret += test_xmlXPathNodeSetCreate();
43564 test_ret += test_xmlXPathObjectCopy();
43565 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043566
Daniel Veillard42595322004-11-08 10:52:06 +000043567 if (test_ret != 0)
43568 printf("Module xpath: %d errors\n", test_ret);
43569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043570}
Daniel Veillarda521d282004-11-09 14:59:59 +000043571#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043572
Daniel Veillarda82b1822004-11-08 16:24:57 +000043573#define gen_nb_xmlXPathParserContextPtr 1
43574static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43575 return(NULL);
43576}
43577static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43578}
Daniel Veillarda521d282004-11-09 14:59:59 +000043579#endif
43580
Daniel Veillarda82b1822004-11-08 16:24:57 +000043581
43582static int
43583test_valuePop(void) {
43584 int test_ret = 0;
43585
43586#ifdef LIBXML_XPATH_ENABLED
43587 int mem_base;
43588 xmlXPathObjectPtr ret_val;
43589 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43590 int n_ctxt;
43591
43592 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43593 mem_base = xmlMemBlocks();
43594 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43595
43596 ret_val = valuePop(ctxt);
43597 desret_xmlXPathObjectPtr(ret_val);
43598 call_tests++;
43599 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43600 xmlResetLastError();
43601 if (mem_base != xmlMemBlocks()) {
43602 printf("Leak of %d blocks found in valuePop",
43603 xmlMemBlocks() - mem_base);
43604 test_ret++;
43605 printf(" %d", n_ctxt);
43606 printf("\n");
43607 }
43608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043609 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043610#endif
43611
Daniel Veillarda82b1822004-11-08 16:24:57 +000043612 return(test_ret);
43613}
43614
43615
43616static int
43617test_valuePush(void) {
43618 int test_ret = 0;
43619
43620#ifdef LIBXML_XPATH_ENABLED
43621 int mem_base;
43622 int ret_val;
43623 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43624 int n_ctxt;
43625 xmlXPathObjectPtr value; /* the XPath object */
43626 int n_value;
43627
43628 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43629 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43630 mem_base = xmlMemBlocks();
43631 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43632 value = gen_xmlXPathObjectPtr(n_value, 1);
43633
43634 ret_val = valuePush(ctxt, value);
43635 desret_int(ret_val);
43636 call_tests++;
43637 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43638 des_xmlXPathObjectPtr(n_value, value, 1);
43639 xmlResetLastError();
43640 if (mem_base != xmlMemBlocks()) {
43641 printf("Leak of %d blocks found in valuePush",
43642 xmlMemBlocks() - mem_base);
43643 test_ret++;
43644 printf(" %d", n_ctxt);
43645 printf(" %d", n_value);
43646 printf("\n");
43647 }
43648 }
43649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043650 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043651#endif
43652
Daniel Veillarda82b1822004-11-08 16:24:57 +000043653 return(test_ret);
43654}
43655
43656
43657static int
43658test_xmlXPathAddValues(void) {
43659 int test_ret = 0;
43660
43661#ifdef LIBXML_XPATH_ENABLED
43662 int mem_base;
43663 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43664 int n_ctxt;
43665
43666 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43667 mem_base = xmlMemBlocks();
43668 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43669
43670 xmlXPathAddValues(ctxt);
43671 call_tests++;
43672 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43673 xmlResetLastError();
43674 if (mem_base != xmlMemBlocks()) {
43675 printf("Leak of %d blocks found in xmlXPathAddValues",
43676 xmlMemBlocks() - mem_base);
43677 test_ret++;
43678 printf(" %d", n_ctxt);
43679 printf("\n");
43680 }
43681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043682 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043683#endif
43684
Daniel Veillarda82b1822004-11-08 16:24:57 +000043685 return(test_ret);
43686}
43687
43688
43689static int
43690test_xmlXPathBooleanFunction(void) {
43691 int test_ret = 0;
43692
43693#ifdef LIBXML_XPATH_ENABLED
43694 int mem_base;
43695 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43696 int n_ctxt;
43697 int nargs; /* the number of arguments */
43698 int n_nargs;
43699
43700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43701 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43702 mem_base = xmlMemBlocks();
43703 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43704 nargs = gen_int(n_nargs, 1);
43705
43706 xmlXPathBooleanFunction(ctxt, nargs);
43707 call_tests++;
43708 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43709 des_int(n_nargs, nargs, 1);
43710 xmlResetLastError();
43711 if (mem_base != xmlMemBlocks()) {
43712 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43713 xmlMemBlocks() - mem_base);
43714 test_ret++;
43715 printf(" %d", n_ctxt);
43716 printf(" %d", n_nargs);
43717 printf("\n");
43718 }
43719 }
43720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043721 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043722#endif
43723
Daniel Veillarda82b1822004-11-08 16:24:57 +000043724 return(test_ret);
43725}
43726
43727
43728static int
43729test_xmlXPathCeilingFunction(void) {
43730 int test_ret = 0;
43731
43732#ifdef LIBXML_XPATH_ENABLED
43733 int mem_base;
43734 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43735 int n_ctxt;
43736 int nargs; /* the number of arguments */
43737 int n_nargs;
43738
43739 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43740 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43741 mem_base = xmlMemBlocks();
43742 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43743 nargs = gen_int(n_nargs, 1);
43744
43745 xmlXPathCeilingFunction(ctxt, nargs);
43746 call_tests++;
43747 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43748 des_int(n_nargs, nargs, 1);
43749 xmlResetLastError();
43750 if (mem_base != xmlMemBlocks()) {
43751 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43752 xmlMemBlocks() - mem_base);
43753 test_ret++;
43754 printf(" %d", n_ctxt);
43755 printf(" %d", n_nargs);
43756 printf("\n");
43757 }
43758 }
43759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043760 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043761#endif
43762
Daniel Veillarda82b1822004-11-08 16:24:57 +000043763 return(test_ret);
43764}
43765
43766
43767static int
43768test_xmlXPathCompareValues(void) {
43769 int test_ret = 0;
43770
43771#ifdef LIBXML_XPATH_ENABLED
43772 int mem_base;
43773 int ret_val;
43774 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43775 int n_ctxt;
43776 int inf; /* less than (1) or greater than (0) */
43777 int n_inf;
43778 int strict; /* is the comparison strict */
43779 int n_strict;
43780
43781 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43782 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43783 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43784 mem_base = xmlMemBlocks();
43785 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43786 inf = gen_int(n_inf, 1);
43787 strict = gen_int(n_strict, 2);
43788
43789 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43790 desret_int(ret_val);
43791 call_tests++;
43792 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43793 des_int(n_inf, inf, 1);
43794 des_int(n_strict, strict, 2);
43795 xmlResetLastError();
43796 if (mem_base != xmlMemBlocks()) {
43797 printf("Leak of %d blocks found in xmlXPathCompareValues",
43798 xmlMemBlocks() - mem_base);
43799 test_ret++;
43800 printf(" %d", n_ctxt);
43801 printf(" %d", n_inf);
43802 printf(" %d", n_strict);
43803 printf("\n");
43804 }
43805 }
43806 }
43807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043808 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043809#endif
43810
Daniel Veillarda82b1822004-11-08 16:24:57 +000043811 return(test_ret);
43812}
43813
43814
43815static int
43816test_xmlXPathConcatFunction(void) {
43817 int test_ret = 0;
43818
43819#ifdef LIBXML_XPATH_ENABLED
43820 int mem_base;
43821 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43822 int n_ctxt;
43823 int nargs; /* the number of arguments */
43824 int n_nargs;
43825
43826 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43827 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43828 mem_base = xmlMemBlocks();
43829 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43830 nargs = gen_int(n_nargs, 1);
43831
43832 xmlXPathConcatFunction(ctxt, nargs);
43833 call_tests++;
43834 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43835 des_int(n_nargs, nargs, 1);
43836 xmlResetLastError();
43837 if (mem_base != xmlMemBlocks()) {
43838 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43839 xmlMemBlocks() - mem_base);
43840 test_ret++;
43841 printf(" %d", n_ctxt);
43842 printf(" %d", n_nargs);
43843 printf("\n");
43844 }
43845 }
43846 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043847 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043848#endif
43849
Daniel Veillarda82b1822004-11-08 16:24:57 +000043850 return(test_ret);
43851}
43852
43853
43854static int
43855test_xmlXPathContainsFunction(void) {
43856 int test_ret = 0;
43857
43858#ifdef LIBXML_XPATH_ENABLED
43859 int mem_base;
43860 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43861 int n_ctxt;
43862 int nargs; /* the number of arguments */
43863 int n_nargs;
43864
43865 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43866 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43867 mem_base = xmlMemBlocks();
43868 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43869 nargs = gen_int(n_nargs, 1);
43870
43871 xmlXPathContainsFunction(ctxt, nargs);
43872 call_tests++;
43873 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43874 des_int(n_nargs, nargs, 1);
43875 xmlResetLastError();
43876 if (mem_base != xmlMemBlocks()) {
43877 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43878 xmlMemBlocks() - mem_base);
43879 test_ret++;
43880 printf(" %d", n_ctxt);
43881 printf(" %d", n_nargs);
43882 printf("\n");
43883 }
43884 }
43885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043886 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043887#endif
43888
Daniel Veillarda82b1822004-11-08 16:24:57 +000043889 return(test_ret);
43890}
43891
43892
43893static int
43894test_xmlXPathCountFunction(void) {
43895 int test_ret = 0;
43896
43897#ifdef LIBXML_XPATH_ENABLED
43898 int mem_base;
43899 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43900 int n_ctxt;
43901 int nargs; /* the number of arguments */
43902 int n_nargs;
43903
43904 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43905 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43906 mem_base = xmlMemBlocks();
43907 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43908 nargs = gen_int(n_nargs, 1);
43909
43910 xmlXPathCountFunction(ctxt, nargs);
43911 call_tests++;
43912 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43913 des_int(n_nargs, nargs, 1);
43914 xmlResetLastError();
43915 if (mem_base != xmlMemBlocks()) {
43916 printf("Leak of %d blocks found in xmlXPathCountFunction",
43917 xmlMemBlocks() - mem_base);
43918 test_ret++;
43919 printf(" %d", n_ctxt);
43920 printf(" %d", n_nargs);
43921 printf("\n");
43922 }
43923 }
43924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043925 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043926#endif
43927
Daniel Veillarda82b1822004-11-08 16:24:57 +000043928 return(test_ret);
43929}
43930
43931
43932static int
43933test_xmlXPathDebugDumpCompExpr(void) {
43934 int test_ret = 0;
43935
43936#ifdef LIBXML_XPATH_ENABLED
43937#ifdef LIBXML_DEBUG_ENABLED
43938 int mem_base;
43939 FILE * output; /* the FILE * for the output */
43940 int n_output;
43941 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43942 int n_comp;
43943 int depth; /* the indentation level. */
43944 int n_depth;
43945
43946 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43947 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43948 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43949 mem_base = xmlMemBlocks();
43950 output = gen_FILE_ptr(n_output, 0);
43951 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43952 depth = gen_int(n_depth, 2);
43953
43954 xmlXPathDebugDumpCompExpr(output, comp, depth);
43955 call_tests++;
43956 des_FILE_ptr(n_output, output, 0);
43957 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43958 des_int(n_depth, depth, 2);
43959 xmlResetLastError();
43960 if (mem_base != xmlMemBlocks()) {
43961 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43962 xmlMemBlocks() - mem_base);
43963 test_ret++;
43964 printf(" %d", n_output);
43965 printf(" %d", n_comp);
43966 printf(" %d", n_depth);
43967 printf("\n");
43968 }
43969 }
43970 }
43971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043972 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043973#endif
43974#endif
43975
Daniel Veillarda82b1822004-11-08 16:24:57 +000043976 return(test_ret);
43977}
43978
43979
43980static int
43981test_xmlXPathDebugDumpObject(void) {
43982 int test_ret = 0;
43983
43984#ifdef LIBXML_XPATH_ENABLED
43985#ifdef LIBXML_DEBUG_ENABLED
43986 int mem_base;
43987 FILE * output; /* the FILE * to dump the output */
43988 int n_output;
43989 xmlXPathObjectPtr cur; /* the object to inspect */
43990 int n_cur;
43991 int depth; /* indentation level */
43992 int n_depth;
43993
43994 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43995 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43996 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43997 mem_base = xmlMemBlocks();
43998 output = gen_FILE_ptr(n_output, 0);
43999 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44000 depth = gen_int(n_depth, 2);
44001
44002 xmlXPathDebugDumpObject(output, cur, depth);
44003 call_tests++;
44004 des_FILE_ptr(n_output, output, 0);
44005 des_xmlXPathObjectPtr(n_cur, cur, 1);
44006 des_int(n_depth, depth, 2);
44007 xmlResetLastError();
44008 if (mem_base != xmlMemBlocks()) {
44009 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44010 xmlMemBlocks() - mem_base);
44011 test_ret++;
44012 printf(" %d", n_output);
44013 printf(" %d", n_cur);
44014 printf(" %d", n_depth);
44015 printf("\n");
44016 }
44017 }
44018 }
44019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044020 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044021#endif
44022#endif
44023
Daniel Veillarda82b1822004-11-08 16:24:57 +000044024 return(test_ret);
44025}
44026
44027
44028static int
44029test_xmlXPathDifference(void) {
44030 int test_ret = 0;
44031
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044032#ifdef LIBXML_XPATH_ENABLED
44033 int mem_base;
44034 xmlNodeSetPtr ret_val;
44035 xmlNodeSetPtr nodes1; /* a node-set */
44036 int n_nodes1;
44037 xmlNodeSetPtr nodes2; /* a node-set */
44038 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044039
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044040 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44041 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44042 mem_base = xmlMemBlocks();
44043 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44044 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44045
44046 ret_val = xmlXPathDifference(nodes1, nodes2);
44047 desret_xmlNodeSetPtr(ret_val);
44048 call_tests++;
44049 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44050 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44051 xmlResetLastError();
44052 if (mem_base != xmlMemBlocks()) {
44053 printf("Leak of %d blocks found in xmlXPathDifference",
44054 xmlMemBlocks() - mem_base);
44055 test_ret++;
44056 printf(" %d", n_nodes1);
44057 printf(" %d", n_nodes2);
44058 printf("\n");
44059 }
44060 }
44061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044062 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044063#endif
44064
Daniel Veillarda82b1822004-11-08 16:24:57 +000044065 return(test_ret);
44066}
44067
44068
44069static int
44070test_xmlXPathDistinct(void) {
44071 int test_ret = 0;
44072
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044073#ifdef LIBXML_XPATH_ENABLED
44074 int mem_base;
44075 xmlNodeSetPtr ret_val;
44076 xmlNodeSetPtr nodes; /* a node-set */
44077 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044078
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044079 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44080 mem_base = xmlMemBlocks();
44081 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44082
44083 ret_val = xmlXPathDistinct(nodes);
44084 desret_xmlNodeSetPtr(ret_val);
44085 call_tests++;
44086 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44087 xmlResetLastError();
44088 if (mem_base != xmlMemBlocks()) {
44089 printf("Leak of %d blocks found in xmlXPathDistinct",
44090 xmlMemBlocks() - mem_base);
44091 test_ret++;
44092 printf(" %d", n_nodes);
44093 printf("\n");
44094 }
44095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044096 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044097#endif
44098
Daniel Veillarda82b1822004-11-08 16:24:57 +000044099 return(test_ret);
44100}
44101
44102
44103static int
44104test_xmlXPathDistinctSorted(void) {
44105 int test_ret = 0;
44106
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044107#ifdef LIBXML_XPATH_ENABLED
44108 int mem_base;
44109 xmlNodeSetPtr ret_val;
44110 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44111 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044112
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044113 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44114 mem_base = xmlMemBlocks();
44115 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44116
44117 ret_val = xmlXPathDistinctSorted(nodes);
44118 desret_xmlNodeSetPtr(ret_val);
44119 call_tests++;
44120 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44121 xmlResetLastError();
44122 if (mem_base != xmlMemBlocks()) {
44123 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44124 xmlMemBlocks() - mem_base);
44125 test_ret++;
44126 printf(" %d", n_nodes);
44127 printf("\n");
44128 }
44129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044130 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044131#endif
44132
Daniel Veillarda82b1822004-11-08 16:24:57 +000044133 return(test_ret);
44134}
44135
44136
44137static int
44138test_xmlXPathDivValues(void) {
44139 int test_ret = 0;
44140
44141#ifdef LIBXML_XPATH_ENABLED
44142 int mem_base;
44143 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44144 int n_ctxt;
44145
44146 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44147 mem_base = xmlMemBlocks();
44148 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44149
44150 xmlXPathDivValues(ctxt);
44151 call_tests++;
44152 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44153 xmlResetLastError();
44154 if (mem_base != xmlMemBlocks()) {
44155 printf("Leak of %d blocks found in xmlXPathDivValues",
44156 xmlMemBlocks() - mem_base);
44157 test_ret++;
44158 printf(" %d", n_ctxt);
44159 printf("\n");
44160 }
44161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044162 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044163#endif
44164
Daniel Veillarda82b1822004-11-08 16:24:57 +000044165 return(test_ret);
44166}
44167
44168
44169static int
44170test_xmlXPathEqualValues(void) {
44171 int test_ret = 0;
44172
44173#ifdef LIBXML_XPATH_ENABLED
44174 int mem_base;
44175 int ret_val;
44176 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44177 int n_ctxt;
44178
44179 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44180 mem_base = xmlMemBlocks();
44181 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44182
44183 ret_val = xmlXPathEqualValues(ctxt);
44184 desret_int(ret_val);
44185 call_tests++;
44186 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44187 xmlResetLastError();
44188 if (mem_base != xmlMemBlocks()) {
44189 printf("Leak of %d blocks found in xmlXPathEqualValues",
44190 xmlMemBlocks() - mem_base);
44191 test_ret++;
44192 printf(" %d", n_ctxt);
44193 printf("\n");
44194 }
44195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044196 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044197#endif
44198
Daniel Veillarda82b1822004-11-08 16:24:57 +000044199 return(test_ret);
44200}
44201
44202
44203static int
44204test_xmlXPathErr(void) {
44205 int test_ret = 0;
44206
44207#ifdef LIBXML_XPATH_ENABLED
44208 int mem_base;
44209 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44210 int n_ctxt;
44211 int error; /* the error code */
44212 int n_error;
44213
44214 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44215 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44216 mem_base = xmlMemBlocks();
44217 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44218 error = gen_int(n_error, 1);
44219
44220 xmlXPathErr(ctxt, error);
44221 call_tests++;
44222 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44223 des_int(n_error, error, 1);
44224 xmlResetLastError();
44225 if (mem_base != xmlMemBlocks()) {
44226 printf("Leak of %d blocks found in xmlXPathErr",
44227 xmlMemBlocks() - mem_base);
44228 test_ret++;
44229 printf(" %d", n_ctxt);
44230 printf(" %d", n_error);
44231 printf("\n");
44232 }
44233 }
44234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044235 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044236#endif
44237
Daniel Veillarda82b1822004-11-08 16:24:57 +000044238 return(test_ret);
44239}
44240
44241
44242static int
44243test_xmlXPathEvalExpr(void) {
44244 int test_ret = 0;
44245
44246#ifdef LIBXML_XPATH_ENABLED
44247 int mem_base;
44248 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44249 int n_ctxt;
44250
44251 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44252 mem_base = xmlMemBlocks();
44253 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44254
44255 xmlXPathEvalExpr(ctxt);
44256 call_tests++;
44257 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44258 xmlResetLastError();
44259 if (mem_base != xmlMemBlocks()) {
44260 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44261 xmlMemBlocks() - mem_base);
44262 test_ret++;
44263 printf(" %d", n_ctxt);
44264 printf("\n");
44265 }
44266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044267 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044268#endif
44269
Daniel Veillarda82b1822004-11-08 16:24:57 +000044270 return(test_ret);
44271}
44272
44273
44274static int
44275test_xmlXPathEvaluatePredicateResult(void) {
44276 int test_ret = 0;
44277
44278#ifdef LIBXML_XPATH_ENABLED
44279 int mem_base;
44280 int ret_val;
44281 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44282 int n_ctxt;
44283 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44284 int n_res;
44285
44286 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44287 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44288 mem_base = xmlMemBlocks();
44289 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44290 res = gen_xmlXPathObjectPtr(n_res, 1);
44291
44292 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44293 desret_int(ret_val);
44294 call_tests++;
44295 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44296 des_xmlXPathObjectPtr(n_res, res, 1);
44297 xmlResetLastError();
44298 if (mem_base != xmlMemBlocks()) {
44299 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44300 xmlMemBlocks() - mem_base);
44301 test_ret++;
44302 printf(" %d", n_ctxt);
44303 printf(" %d", n_res);
44304 printf("\n");
44305 }
44306 }
44307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044308 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044309#endif
44310
Daniel Veillarda82b1822004-11-08 16:24:57 +000044311 return(test_ret);
44312}
44313
44314
44315static int
44316test_xmlXPathFalseFunction(void) {
44317 int test_ret = 0;
44318
44319#ifdef LIBXML_XPATH_ENABLED
44320 int mem_base;
44321 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44322 int n_ctxt;
44323 int nargs; /* the number of arguments */
44324 int n_nargs;
44325
44326 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44327 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44328 mem_base = xmlMemBlocks();
44329 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44330 nargs = gen_int(n_nargs, 1);
44331
44332 xmlXPathFalseFunction(ctxt, nargs);
44333 call_tests++;
44334 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44335 des_int(n_nargs, nargs, 1);
44336 xmlResetLastError();
44337 if (mem_base != xmlMemBlocks()) {
44338 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44339 xmlMemBlocks() - mem_base);
44340 test_ret++;
44341 printf(" %d", n_ctxt);
44342 printf(" %d", n_nargs);
44343 printf("\n");
44344 }
44345 }
44346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044347 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044348#endif
44349
Daniel Veillarda82b1822004-11-08 16:24:57 +000044350 return(test_ret);
44351}
44352
44353
44354static int
44355test_xmlXPathFloorFunction(void) {
44356 int test_ret = 0;
44357
44358#ifdef LIBXML_XPATH_ENABLED
44359 int mem_base;
44360 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44361 int n_ctxt;
44362 int nargs; /* the number of arguments */
44363 int n_nargs;
44364
44365 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44366 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44367 mem_base = xmlMemBlocks();
44368 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44369 nargs = gen_int(n_nargs, 1);
44370
44371 xmlXPathFloorFunction(ctxt, nargs);
44372 call_tests++;
44373 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44374 des_int(n_nargs, nargs, 1);
44375 xmlResetLastError();
44376 if (mem_base != xmlMemBlocks()) {
44377 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44378 xmlMemBlocks() - mem_base);
44379 test_ret++;
44380 printf(" %d", n_ctxt);
44381 printf(" %d", n_nargs);
44382 printf("\n");
44383 }
44384 }
44385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044386 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044387#endif
44388
Daniel Veillarda82b1822004-11-08 16:24:57 +000044389 return(test_ret);
44390}
44391
44392
44393static int
44394test_xmlXPathFunctionLookup(void) {
44395 int test_ret = 0;
44396
44397
44398 /* missing type support */
44399 return(test_ret);
44400}
44401
44402
44403static int
44404test_xmlXPathFunctionLookupNS(void) {
44405 int test_ret = 0;
44406
44407
44408 /* missing type support */
44409 return(test_ret);
44410}
44411
44412
44413static int
44414test_xmlXPathHasSameNodes(void) {
44415 int test_ret = 0;
44416
44417#ifdef LIBXML_XPATH_ENABLED
44418 int mem_base;
44419 int ret_val;
44420 xmlNodeSetPtr nodes1; /* a node-set */
44421 int n_nodes1;
44422 xmlNodeSetPtr nodes2; /* a node-set */
44423 int n_nodes2;
44424
44425 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44426 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44427 mem_base = xmlMemBlocks();
44428 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44429 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44430
44431 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44432 desret_int(ret_val);
44433 call_tests++;
44434 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44435 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44436 xmlResetLastError();
44437 if (mem_base != xmlMemBlocks()) {
44438 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44439 xmlMemBlocks() - mem_base);
44440 test_ret++;
44441 printf(" %d", n_nodes1);
44442 printf(" %d", n_nodes2);
44443 printf("\n");
44444 }
44445 }
44446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044447 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044448#endif
44449
Daniel Veillarda82b1822004-11-08 16:24:57 +000044450 return(test_ret);
44451}
44452
44453
44454static int
44455test_xmlXPathIdFunction(void) {
44456 int test_ret = 0;
44457
44458#ifdef LIBXML_XPATH_ENABLED
44459 int mem_base;
44460 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44461 int n_ctxt;
44462 int nargs; /* the number of arguments */
44463 int n_nargs;
44464
44465 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44466 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44467 mem_base = xmlMemBlocks();
44468 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44469 nargs = gen_int(n_nargs, 1);
44470
44471 xmlXPathIdFunction(ctxt, nargs);
44472 call_tests++;
44473 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44474 des_int(n_nargs, nargs, 1);
44475 xmlResetLastError();
44476 if (mem_base != xmlMemBlocks()) {
44477 printf("Leak of %d blocks found in xmlXPathIdFunction",
44478 xmlMemBlocks() - mem_base);
44479 test_ret++;
44480 printf(" %d", n_ctxt);
44481 printf(" %d", n_nargs);
44482 printf("\n");
44483 }
44484 }
44485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044486 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044487#endif
44488
Daniel Veillarda82b1822004-11-08 16:24:57 +000044489 return(test_ret);
44490}
44491
44492
44493static int
44494test_xmlXPathIntersection(void) {
44495 int test_ret = 0;
44496
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044497#ifdef LIBXML_XPATH_ENABLED
44498 int mem_base;
44499 xmlNodeSetPtr ret_val;
44500 xmlNodeSetPtr nodes1; /* a node-set */
44501 int n_nodes1;
44502 xmlNodeSetPtr nodes2; /* a node-set */
44503 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044504
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044505 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44506 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44507 mem_base = xmlMemBlocks();
44508 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44509 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44510
44511 ret_val = xmlXPathIntersection(nodes1, nodes2);
44512 desret_xmlNodeSetPtr(ret_val);
44513 call_tests++;
44514 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44515 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44516 xmlResetLastError();
44517 if (mem_base != xmlMemBlocks()) {
44518 printf("Leak of %d blocks found in xmlXPathIntersection",
44519 xmlMemBlocks() - mem_base);
44520 test_ret++;
44521 printf(" %d", n_nodes1);
44522 printf(" %d", n_nodes2);
44523 printf("\n");
44524 }
44525 }
44526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044527 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044528#endif
44529
Daniel Veillarda82b1822004-11-08 16:24:57 +000044530 return(test_ret);
44531}
44532
44533
44534static int
44535test_xmlXPathIsNodeType(void) {
44536 int test_ret = 0;
44537
44538#ifdef LIBXML_XPATH_ENABLED
44539 int mem_base;
44540 int ret_val;
44541 xmlChar * name; /* a name string */
44542 int n_name;
44543
44544 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44545 mem_base = xmlMemBlocks();
44546 name = gen_const_xmlChar_ptr(n_name, 0);
44547
William M. Brackf13f77f2004-11-12 16:03:48 +000044548 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044549 desret_int(ret_val);
44550 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044551 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044552 xmlResetLastError();
44553 if (mem_base != xmlMemBlocks()) {
44554 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44555 xmlMemBlocks() - mem_base);
44556 test_ret++;
44557 printf(" %d", n_name);
44558 printf("\n");
44559 }
44560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044561 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044562#endif
44563
Daniel Veillarda82b1822004-11-08 16:24:57 +000044564 return(test_ret);
44565}
44566
44567
44568static int
44569test_xmlXPathLangFunction(void) {
44570 int test_ret = 0;
44571
44572#ifdef LIBXML_XPATH_ENABLED
44573 int mem_base;
44574 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44575 int n_ctxt;
44576 int nargs; /* the number of arguments */
44577 int n_nargs;
44578
44579 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44580 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44581 mem_base = xmlMemBlocks();
44582 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44583 nargs = gen_int(n_nargs, 1);
44584
44585 xmlXPathLangFunction(ctxt, nargs);
44586 call_tests++;
44587 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44588 des_int(n_nargs, nargs, 1);
44589 xmlResetLastError();
44590 if (mem_base != xmlMemBlocks()) {
44591 printf("Leak of %d blocks found in xmlXPathLangFunction",
44592 xmlMemBlocks() - mem_base);
44593 test_ret++;
44594 printf(" %d", n_ctxt);
44595 printf(" %d", n_nargs);
44596 printf("\n");
44597 }
44598 }
44599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044600 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044601#endif
44602
Daniel Veillarda82b1822004-11-08 16:24:57 +000044603 return(test_ret);
44604}
44605
44606
44607static int
44608test_xmlXPathLastFunction(void) {
44609 int test_ret = 0;
44610
44611#ifdef LIBXML_XPATH_ENABLED
44612 int mem_base;
44613 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44614 int n_ctxt;
44615 int nargs; /* the number of arguments */
44616 int n_nargs;
44617
44618 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44619 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44620 mem_base = xmlMemBlocks();
44621 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44622 nargs = gen_int(n_nargs, 1);
44623
44624 xmlXPathLastFunction(ctxt, nargs);
44625 call_tests++;
44626 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44627 des_int(n_nargs, nargs, 1);
44628 xmlResetLastError();
44629 if (mem_base != xmlMemBlocks()) {
44630 printf("Leak of %d blocks found in xmlXPathLastFunction",
44631 xmlMemBlocks() - mem_base);
44632 test_ret++;
44633 printf(" %d", n_ctxt);
44634 printf(" %d", n_nargs);
44635 printf("\n");
44636 }
44637 }
44638 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044639 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044640#endif
44641
Daniel Veillarda82b1822004-11-08 16:24:57 +000044642 return(test_ret);
44643}
44644
44645
44646static int
44647test_xmlXPathLeading(void) {
44648 int test_ret = 0;
44649
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044650#ifdef LIBXML_XPATH_ENABLED
44651 int mem_base;
44652 xmlNodeSetPtr ret_val;
44653 xmlNodeSetPtr nodes1; /* a node-set */
44654 int n_nodes1;
44655 xmlNodeSetPtr nodes2; /* a node-set */
44656 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044657
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044658 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44659 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44660 mem_base = xmlMemBlocks();
44661 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44662 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44663
44664 ret_val = xmlXPathLeading(nodes1, nodes2);
44665 desret_xmlNodeSetPtr(ret_val);
44666 call_tests++;
44667 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44668 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44669 xmlResetLastError();
44670 if (mem_base != xmlMemBlocks()) {
44671 printf("Leak of %d blocks found in xmlXPathLeading",
44672 xmlMemBlocks() - mem_base);
44673 test_ret++;
44674 printf(" %d", n_nodes1);
44675 printf(" %d", n_nodes2);
44676 printf("\n");
44677 }
44678 }
44679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044680 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044681#endif
44682
Daniel Veillarda82b1822004-11-08 16:24:57 +000044683 return(test_ret);
44684}
44685
44686
44687static int
44688test_xmlXPathLeadingSorted(void) {
44689 int test_ret = 0;
44690
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044691#ifdef LIBXML_XPATH_ENABLED
44692 int mem_base;
44693 xmlNodeSetPtr ret_val;
44694 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44695 int n_nodes1;
44696 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44697 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044698
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044699 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44700 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44701 mem_base = xmlMemBlocks();
44702 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44703 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44704
44705 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44706 desret_xmlNodeSetPtr(ret_val);
44707 call_tests++;
44708 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44709 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44710 xmlResetLastError();
44711 if (mem_base != xmlMemBlocks()) {
44712 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44713 xmlMemBlocks() - mem_base);
44714 test_ret++;
44715 printf(" %d", n_nodes1);
44716 printf(" %d", n_nodes2);
44717 printf("\n");
44718 }
44719 }
44720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044721 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044722#endif
44723
Daniel Veillarda82b1822004-11-08 16:24:57 +000044724 return(test_ret);
44725}
44726
44727
44728static int
44729test_xmlXPathLocalNameFunction(void) {
44730 int test_ret = 0;
44731
44732#ifdef LIBXML_XPATH_ENABLED
44733 int mem_base;
44734 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44735 int n_ctxt;
44736 int nargs; /* the number of arguments */
44737 int n_nargs;
44738
44739 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44740 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44741 mem_base = xmlMemBlocks();
44742 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44743 nargs = gen_int(n_nargs, 1);
44744
44745 xmlXPathLocalNameFunction(ctxt, nargs);
44746 call_tests++;
44747 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44748 des_int(n_nargs, nargs, 1);
44749 xmlResetLastError();
44750 if (mem_base != xmlMemBlocks()) {
44751 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44752 xmlMemBlocks() - mem_base);
44753 test_ret++;
44754 printf(" %d", n_ctxt);
44755 printf(" %d", n_nargs);
44756 printf("\n");
44757 }
44758 }
44759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044760 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044761#endif
44762
Daniel Veillarda82b1822004-11-08 16:24:57 +000044763 return(test_ret);
44764}
44765
44766
44767static int
44768test_xmlXPathModValues(void) {
44769 int test_ret = 0;
44770
44771#ifdef LIBXML_XPATH_ENABLED
44772 int mem_base;
44773 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44774 int n_ctxt;
44775
44776 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44777 mem_base = xmlMemBlocks();
44778 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44779
44780 xmlXPathModValues(ctxt);
44781 call_tests++;
44782 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44783 xmlResetLastError();
44784 if (mem_base != xmlMemBlocks()) {
44785 printf("Leak of %d blocks found in xmlXPathModValues",
44786 xmlMemBlocks() - mem_base);
44787 test_ret++;
44788 printf(" %d", n_ctxt);
44789 printf("\n");
44790 }
44791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044792 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044793#endif
44794
Daniel Veillarda82b1822004-11-08 16:24:57 +000044795 return(test_ret);
44796}
44797
44798
44799static int
44800test_xmlXPathMultValues(void) {
44801 int test_ret = 0;
44802
44803#ifdef LIBXML_XPATH_ENABLED
44804 int mem_base;
44805 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44806 int n_ctxt;
44807
44808 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44809 mem_base = xmlMemBlocks();
44810 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44811
44812 xmlXPathMultValues(ctxt);
44813 call_tests++;
44814 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44815 xmlResetLastError();
44816 if (mem_base != xmlMemBlocks()) {
44817 printf("Leak of %d blocks found in xmlXPathMultValues",
44818 xmlMemBlocks() - mem_base);
44819 test_ret++;
44820 printf(" %d", n_ctxt);
44821 printf("\n");
44822 }
44823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044824 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044825#endif
44826
Daniel Veillarda82b1822004-11-08 16:24:57 +000044827 return(test_ret);
44828}
44829
44830
44831static int
44832test_xmlXPathNamespaceURIFunction(void) {
44833 int test_ret = 0;
44834
44835#ifdef LIBXML_XPATH_ENABLED
44836 int mem_base;
44837 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44838 int n_ctxt;
44839 int nargs; /* the number of arguments */
44840 int n_nargs;
44841
44842 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44843 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44844 mem_base = xmlMemBlocks();
44845 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44846 nargs = gen_int(n_nargs, 1);
44847
44848 xmlXPathNamespaceURIFunction(ctxt, nargs);
44849 call_tests++;
44850 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44851 des_int(n_nargs, nargs, 1);
44852 xmlResetLastError();
44853 if (mem_base != xmlMemBlocks()) {
44854 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44855 xmlMemBlocks() - mem_base);
44856 test_ret++;
44857 printf(" %d", n_ctxt);
44858 printf(" %d", n_nargs);
44859 printf("\n");
44860 }
44861 }
44862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044863 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044864#endif
44865
Daniel Veillarda82b1822004-11-08 16:24:57 +000044866 return(test_ret);
44867}
44868
44869
44870static int
44871test_xmlXPathNewBoolean(void) {
44872 int test_ret = 0;
44873
44874#ifdef LIBXML_XPATH_ENABLED
44875 int mem_base;
44876 xmlXPathObjectPtr ret_val;
44877 int val; /* the boolean value */
44878 int n_val;
44879
44880 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44881 mem_base = xmlMemBlocks();
44882 val = gen_int(n_val, 0);
44883
44884 ret_val = xmlXPathNewBoolean(val);
44885 desret_xmlXPathObjectPtr(ret_val);
44886 call_tests++;
44887 des_int(n_val, val, 0);
44888 xmlResetLastError();
44889 if (mem_base != xmlMemBlocks()) {
44890 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44891 xmlMemBlocks() - mem_base);
44892 test_ret++;
44893 printf(" %d", n_val);
44894 printf("\n");
44895 }
44896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044897 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044898#endif
44899
Daniel Veillarda82b1822004-11-08 16:24:57 +000044900 return(test_ret);
44901}
44902
44903
44904static int
44905test_xmlXPathNewCString(void) {
44906 int test_ret = 0;
44907
44908#ifdef LIBXML_XPATH_ENABLED
44909 int mem_base;
44910 xmlXPathObjectPtr ret_val;
44911 char * val; /* the char * value */
44912 int n_val;
44913
44914 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44915 mem_base = xmlMemBlocks();
44916 val = gen_const_char_ptr(n_val, 0);
44917
William M. Brackf13f77f2004-11-12 16:03:48 +000044918 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044919 desret_xmlXPathObjectPtr(ret_val);
44920 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044921 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044922 xmlResetLastError();
44923 if (mem_base != xmlMemBlocks()) {
44924 printf("Leak of %d blocks found in xmlXPathNewCString",
44925 xmlMemBlocks() - mem_base);
44926 test_ret++;
44927 printf(" %d", n_val);
44928 printf("\n");
44929 }
44930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044931 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044932#endif
44933
Daniel Veillarda82b1822004-11-08 16:24:57 +000044934 return(test_ret);
44935}
44936
44937
44938static int
44939test_xmlXPathNewFloat(void) {
44940 int test_ret = 0;
44941
44942#ifdef LIBXML_XPATH_ENABLED
44943 int mem_base;
44944 xmlXPathObjectPtr ret_val;
44945 double val; /* the double value */
44946 int n_val;
44947
44948 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44949 mem_base = xmlMemBlocks();
44950 val = gen_double(n_val, 0);
44951
44952 ret_val = xmlXPathNewFloat(val);
44953 desret_xmlXPathObjectPtr(ret_val);
44954 call_tests++;
44955 des_double(n_val, val, 0);
44956 xmlResetLastError();
44957 if (mem_base != xmlMemBlocks()) {
44958 printf("Leak of %d blocks found in xmlXPathNewFloat",
44959 xmlMemBlocks() - mem_base);
44960 test_ret++;
44961 printf(" %d", n_val);
44962 printf("\n");
44963 }
44964 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044965 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044966#endif
44967
Daniel Veillarda82b1822004-11-08 16:24:57 +000044968 return(test_ret);
44969}
44970
44971
44972static int
44973test_xmlXPathNewNodeSet(void) {
44974 int test_ret = 0;
44975
44976#ifdef LIBXML_XPATH_ENABLED
44977 int mem_base;
44978 xmlXPathObjectPtr ret_val;
44979 xmlNodePtr val; /* the NodePtr value */
44980 int n_val;
44981
44982 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44983 mem_base = xmlMemBlocks();
44984 val = gen_xmlNodePtr(n_val, 0);
44985
44986 ret_val = xmlXPathNewNodeSet(val);
44987 desret_xmlXPathObjectPtr(ret_val);
44988 call_tests++;
44989 des_xmlNodePtr(n_val, val, 0);
44990 xmlResetLastError();
44991 if (mem_base != xmlMemBlocks()) {
44992 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44993 xmlMemBlocks() - mem_base);
44994 test_ret++;
44995 printf(" %d", n_val);
44996 printf("\n");
44997 }
44998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044999 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045000#endif
45001
Daniel Veillarda82b1822004-11-08 16:24:57 +000045002 return(test_ret);
45003}
45004
45005
45006static int
45007test_xmlXPathNewNodeSetList(void) {
45008 int test_ret = 0;
45009
45010#ifdef LIBXML_XPATH_ENABLED
45011 int mem_base;
45012 xmlXPathObjectPtr ret_val;
45013 xmlNodeSetPtr val; /* an existing NodeSet */
45014 int n_val;
45015
45016 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45017 mem_base = xmlMemBlocks();
45018 val = gen_xmlNodeSetPtr(n_val, 0);
45019
45020 ret_val = xmlXPathNewNodeSetList(val);
45021 desret_xmlXPathObjectPtr(ret_val);
45022 call_tests++;
45023 des_xmlNodeSetPtr(n_val, val, 0);
45024 xmlResetLastError();
45025 if (mem_base != xmlMemBlocks()) {
45026 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45027 xmlMemBlocks() - mem_base);
45028 test_ret++;
45029 printf(" %d", n_val);
45030 printf("\n");
45031 }
45032 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045033 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045034#endif
45035
Daniel Veillarda82b1822004-11-08 16:24:57 +000045036 return(test_ret);
45037}
45038
45039
45040static int
45041test_xmlXPathNewParserContext(void) {
45042 int test_ret = 0;
45043
45044
45045 /* missing type support */
45046 return(test_ret);
45047}
45048
45049
45050static int
45051test_xmlXPathNewString(void) {
45052 int test_ret = 0;
45053
45054#ifdef LIBXML_XPATH_ENABLED
45055 int mem_base;
45056 xmlXPathObjectPtr ret_val;
45057 xmlChar * val; /* the xmlChar * value */
45058 int n_val;
45059
45060 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45061 mem_base = xmlMemBlocks();
45062 val = gen_const_xmlChar_ptr(n_val, 0);
45063
William M. Brackf13f77f2004-11-12 16:03:48 +000045064 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045065 desret_xmlXPathObjectPtr(ret_val);
45066 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045067 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045068 xmlResetLastError();
45069 if (mem_base != xmlMemBlocks()) {
45070 printf("Leak of %d blocks found in xmlXPathNewString",
45071 xmlMemBlocks() - mem_base);
45072 test_ret++;
45073 printf(" %d", n_val);
45074 printf("\n");
45075 }
45076 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045077 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045078#endif
45079
Daniel Veillarda82b1822004-11-08 16:24:57 +000045080 return(test_ret);
45081}
45082
45083
45084static int
45085test_xmlXPathNextAncestor(void) {
45086 int test_ret = 0;
45087
45088#ifdef LIBXML_XPATH_ENABLED
45089 int mem_base;
45090 xmlNodePtr ret_val;
45091 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45092 int n_ctxt;
45093 xmlNodePtr cur; /* the current node in the traversal */
45094 int n_cur;
45095
45096 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45097 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45098 mem_base = xmlMemBlocks();
45099 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45100 cur = gen_xmlNodePtr(n_cur, 1);
45101
45102 ret_val = xmlXPathNextAncestor(ctxt, cur);
45103 desret_xmlNodePtr(ret_val);
45104 call_tests++;
45105 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45106 des_xmlNodePtr(n_cur, cur, 1);
45107 xmlResetLastError();
45108 if (mem_base != xmlMemBlocks()) {
45109 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45110 xmlMemBlocks() - mem_base);
45111 test_ret++;
45112 printf(" %d", n_ctxt);
45113 printf(" %d", n_cur);
45114 printf("\n");
45115 }
45116 }
45117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045118 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045119#endif
45120
Daniel Veillarda82b1822004-11-08 16:24:57 +000045121 return(test_ret);
45122}
45123
45124
45125static int
45126test_xmlXPathNextAncestorOrSelf(void) {
45127 int test_ret = 0;
45128
45129#ifdef LIBXML_XPATH_ENABLED
45130 int mem_base;
45131 xmlNodePtr ret_val;
45132 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45133 int n_ctxt;
45134 xmlNodePtr cur; /* the current node in the traversal */
45135 int n_cur;
45136
45137 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45138 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45139 mem_base = xmlMemBlocks();
45140 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45141 cur = gen_xmlNodePtr(n_cur, 1);
45142
45143 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45144 desret_xmlNodePtr(ret_val);
45145 call_tests++;
45146 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45147 des_xmlNodePtr(n_cur, cur, 1);
45148 xmlResetLastError();
45149 if (mem_base != xmlMemBlocks()) {
45150 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45151 xmlMemBlocks() - mem_base);
45152 test_ret++;
45153 printf(" %d", n_ctxt);
45154 printf(" %d", n_cur);
45155 printf("\n");
45156 }
45157 }
45158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045159 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045160#endif
45161
Daniel Veillarda82b1822004-11-08 16:24:57 +000045162 return(test_ret);
45163}
45164
45165
45166static int
45167test_xmlXPathNextAttribute(void) {
45168 int test_ret = 0;
45169
45170#ifdef LIBXML_XPATH_ENABLED
45171 int mem_base;
45172 xmlNodePtr ret_val;
45173 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45174 int n_ctxt;
45175 xmlNodePtr cur; /* the current attribute in the traversal */
45176 int n_cur;
45177
45178 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45179 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45180 mem_base = xmlMemBlocks();
45181 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45182 cur = gen_xmlNodePtr(n_cur, 1);
45183
45184 ret_val = xmlXPathNextAttribute(ctxt, cur);
45185 desret_xmlNodePtr(ret_val);
45186 call_tests++;
45187 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45188 des_xmlNodePtr(n_cur, cur, 1);
45189 xmlResetLastError();
45190 if (mem_base != xmlMemBlocks()) {
45191 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45192 xmlMemBlocks() - mem_base);
45193 test_ret++;
45194 printf(" %d", n_ctxt);
45195 printf(" %d", n_cur);
45196 printf("\n");
45197 }
45198 }
45199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045200 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045201#endif
45202
Daniel Veillarda82b1822004-11-08 16:24:57 +000045203 return(test_ret);
45204}
45205
45206
45207static int
45208test_xmlXPathNextChild(void) {
45209 int test_ret = 0;
45210
45211#ifdef LIBXML_XPATH_ENABLED
45212 int mem_base;
45213 xmlNodePtr ret_val;
45214 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45215 int n_ctxt;
45216 xmlNodePtr cur; /* the current node in the traversal */
45217 int n_cur;
45218
45219 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45220 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45221 mem_base = xmlMemBlocks();
45222 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45223 cur = gen_xmlNodePtr(n_cur, 1);
45224
45225 ret_val = xmlXPathNextChild(ctxt, cur);
45226 desret_xmlNodePtr(ret_val);
45227 call_tests++;
45228 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45229 des_xmlNodePtr(n_cur, cur, 1);
45230 xmlResetLastError();
45231 if (mem_base != xmlMemBlocks()) {
45232 printf("Leak of %d blocks found in xmlXPathNextChild",
45233 xmlMemBlocks() - mem_base);
45234 test_ret++;
45235 printf(" %d", n_ctxt);
45236 printf(" %d", n_cur);
45237 printf("\n");
45238 }
45239 }
45240 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045241 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045242#endif
45243
Daniel Veillarda82b1822004-11-08 16:24:57 +000045244 return(test_ret);
45245}
45246
45247
45248static int
45249test_xmlXPathNextDescendant(void) {
45250 int test_ret = 0;
45251
45252#ifdef LIBXML_XPATH_ENABLED
45253 int mem_base;
45254 xmlNodePtr ret_val;
45255 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45256 int n_ctxt;
45257 xmlNodePtr cur; /* the current node in the traversal */
45258 int n_cur;
45259
45260 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45261 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45262 mem_base = xmlMemBlocks();
45263 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45264 cur = gen_xmlNodePtr(n_cur, 1);
45265
45266 ret_val = xmlXPathNextDescendant(ctxt, cur);
45267 desret_xmlNodePtr(ret_val);
45268 call_tests++;
45269 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45270 des_xmlNodePtr(n_cur, cur, 1);
45271 xmlResetLastError();
45272 if (mem_base != xmlMemBlocks()) {
45273 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45274 xmlMemBlocks() - mem_base);
45275 test_ret++;
45276 printf(" %d", n_ctxt);
45277 printf(" %d", n_cur);
45278 printf("\n");
45279 }
45280 }
45281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045282 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045283#endif
45284
Daniel Veillarda82b1822004-11-08 16:24:57 +000045285 return(test_ret);
45286}
45287
45288
45289static int
45290test_xmlXPathNextDescendantOrSelf(void) {
45291 int test_ret = 0;
45292
45293#ifdef LIBXML_XPATH_ENABLED
45294 int mem_base;
45295 xmlNodePtr ret_val;
45296 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45297 int n_ctxt;
45298 xmlNodePtr cur; /* the current node in the traversal */
45299 int n_cur;
45300
45301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45302 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45303 mem_base = xmlMemBlocks();
45304 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45305 cur = gen_xmlNodePtr(n_cur, 1);
45306
45307 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45308 desret_xmlNodePtr(ret_val);
45309 call_tests++;
45310 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45311 des_xmlNodePtr(n_cur, cur, 1);
45312 xmlResetLastError();
45313 if (mem_base != xmlMemBlocks()) {
45314 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45315 xmlMemBlocks() - mem_base);
45316 test_ret++;
45317 printf(" %d", n_ctxt);
45318 printf(" %d", n_cur);
45319 printf("\n");
45320 }
45321 }
45322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045323 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045324#endif
45325
Daniel Veillarda82b1822004-11-08 16:24:57 +000045326 return(test_ret);
45327}
45328
45329
45330static int
45331test_xmlXPathNextFollowing(void) {
45332 int test_ret = 0;
45333
45334#ifdef LIBXML_XPATH_ENABLED
45335 int mem_base;
45336 xmlNodePtr ret_val;
45337 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45338 int n_ctxt;
45339 xmlNodePtr cur; /* the current node in the traversal */
45340 int n_cur;
45341
45342 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45343 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45344 mem_base = xmlMemBlocks();
45345 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45346 cur = gen_xmlNodePtr(n_cur, 1);
45347
45348 ret_val = xmlXPathNextFollowing(ctxt, cur);
45349 desret_xmlNodePtr(ret_val);
45350 call_tests++;
45351 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45352 des_xmlNodePtr(n_cur, cur, 1);
45353 xmlResetLastError();
45354 if (mem_base != xmlMemBlocks()) {
45355 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45356 xmlMemBlocks() - mem_base);
45357 test_ret++;
45358 printf(" %d", n_ctxt);
45359 printf(" %d", n_cur);
45360 printf("\n");
45361 }
45362 }
45363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045364 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045365#endif
45366
Daniel Veillarda82b1822004-11-08 16:24:57 +000045367 return(test_ret);
45368}
45369
45370
45371static int
45372test_xmlXPathNextFollowingSibling(void) {
45373 int test_ret = 0;
45374
45375#ifdef LIBXML_XPATH_ENABLED
45376 int mem_base;
45377 xmlNodePtr ret_val;
45378 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45379 int n_ctxt;
45380 xmlNodePtr cur; /* the current node in the traversal */
45381 int n_cur;
45382
45383 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45384 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45385 mem_base = xmlMemBlocks();
45386 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45387 cur = gen_xmlNodePtr(n_cur, 1);
45388
45389 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45390 desret_xmlNodePtr(ret_val);
45391 call_tests++;
45392 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45393 des_xmlNodePtr(n_cur, cur, 1);
45394 xmlResetLastError();
45395 if (mem_base != xmlMemBlocks()) {
45396 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45397 xmlMemBlocks() - mem_base);
45398 test_ret++;
45399 printf(" %d", n_ctxt);
45400 printf(" %d", n_cur);
45401 printf("\n");
45402 }
45403 }
45404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045405 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045406#endif
45407
Daniel Veillarda82b1822004-11-08 16:24:57 +000045408 return(test_ret);
45409}
45410
45411
45412static int
45413test_xmlXPathNextNamespace(void) {
45414 int test_ret = 0;
45415
45416#ifdef LIBXML_XPATH_ENABLED
45417 int mem_base;
45418 xmlNodePtr ret_val;
45419 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45420 int n_ctxt;
45421 xmlNodePtr cur; /* the current attribute in the traversal */
45422 int n_cur;
45423
45424 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45425 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45426 mem_base = xmlMemBlocks();
45427 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45428 cur = gen_xmlNodePtr(n_cur, 1);
45429
45430 ret_val = xmlXPathNextNamespace(ctxt, cur);
45431 desret_xmlNodePtr(ret_val);
45432 call_tests++;
45433 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45434 des_xmlNodePtr(n_cur, cur, 1);
45435 xmlResetLastError();
45436 if (mem_base != xmlMemBlocks()) {
45437 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45438 xmlMemBlocks() - mem_base);
45439 test_ret++;
45440 printf(" %d", n_ctxt);
45441 printf(" %d", n_cur);
45442 printf("\n");
45443 }
45444 }
45445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045446 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045447#endif
45448
Daniel Veillarda82b1822004-11-08 16:24:57 +000045449 return(test_ret);
45450}
45451
45452
45453static int
45454test_xmlXPathNextParent(void) {
45455 int test_ret = 0;
45456
45457#ifdef LIBXML_XPATH_ENABLED
45458 int mem_base;
45459 xmlNodePtr ret_val;
45460 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45461 int n_ctxt;
45462 xmlNodePtr cur; /* the current node in the traversal */
45463 int n_cur;
45464
45465 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45466 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45467 mem_base = xmlMemBlocks();
45468 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45469 cur = gen_xmlNodePtr(n_cur, 1);
45470
45471 ret_val = xmlXPathNextParent(ctxt, cur);
45472 desret_xmlNodePtr(ret_val);
45473 call_tests++;
45474 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45475 des_xmlNodePtr(n_cur, cur, 1);
45476 xmlResetLastError();
45477 if (mem_base != xmlMemBlocks()) {
45478 printf("Leak of %d blocks found in xmlXPathNextParent",
45479 xmlMemBlocks() - mem_base);
45480 test_ret++;
45481 printf(" %d", n_ctxt);
45482 printf(" %d", n_cur);
45483 printf("\n");
45484 }
45485 }
45486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045487 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045488#endif
45489
Daniel Veillarda82b1822004-11-08 16:24:57 +000045490 return(test_ret);
45491}
45492
45493
45494static int
45495test_xmlXPathNextPreceding(void) {
45496 int test_ret = 0;
45497
45498#ifdef LIBXML_XPATH_ENABLED
45499 int mem_base;
45500 xmlNodePtr ret_val;
45501 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45502 int n_ctxt;
45503 xmlNodePtr cur; /* the current node in the traversal */
45504 int n_cur;
45505
45506 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45507 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45508 mem_base = xmlMemBlocks();
45509 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45510 cur = gen_xmlNodePtr(n_cur, 1);
45511
45512 ret_val = xmlXPathNextPreceding(ctxt, cur);
45513 desret_xmlNodePtr(ret_val);
45514 call_tests++;
45515 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45516 des_xmlNodePtr(n_cur, cur, 1);
45517 xmlResetLastError();
45518 if (mem_base != xmlMemBlocks()) {
45519 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45520 xmlMemBlocks() - mem_base);
45521 test_ret++;
45522 printf(" %d", n_ctxt);
45523 printf(" %d", n_cur);
45524 printf("\n");
45525 }
45526 }
45527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045528 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045529#endif
45530
Daniel Veillarda82b1822004-11-08 16:24:57 +000045531 return(test_ret);
45532}
45533
45534
45535static int
45536test_xmlXPathNextPrecedingSibling(void) {
45537 int test_ret = 0;
45538
45539#ifdef LIBXML_XPATH_ENABLED
45540 int mem_base;
45541 xmlNodePtr ret_val;
45542 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45543 int n_ctxt;
45544 xmlNodePtr cur; /* the current node in the traversal */
45545 int n_cur;
45546
45547 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45548 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45549 mem_base = xmlMemBlocks();
45550 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45551 cur = gen_xmlNodePtr(n_cur, 1);
45552
45553 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45554 desret_xmlNodePtr(ret_val);
45555 call_tests++;
45556 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45557 des_xmlNodePtr(n_cur, cur, 1);
45558 xmlResetLastError();
45559 if (mem_base != xmlMemBlocks()) {
45560 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45561 xmlMemBlocks() - mem_base);
45562 test_ret++;
45563 printf(" %d", n_ctxt);
45564 printf(" %d", n_cur);
45565 printf("\n");
45566 }
45567 }
45568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045569 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045570#endif
45571
Daniel Veillarda82b1822004-11-08 16:24:57 +000045572 return(test_ret);
45573}
45574
45575
45576static int
45577test_xmlXPathNextSelf(void) {
45578 int test_ret = 0;
45579
45580#ifdef LIBXML_XPATH_ENABLED
45581 int mem_base;
45582 xmlNodePtr ret_val;
45583 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45584 int n_ctxt;
45585 xmlNodePtr cur; /* the current node in the traversal */
45586 int n_cur;
45587
45588 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45589 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45590 mem_base = xmlMemBlocks();
45591 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45592 cur = gen_xmlNodePtr(n_cur, 1);
45593
45594 ret_val = xmlXPathNextSelf(ctxt, cur);
45595 desret_xmlNodePtr(ret_val);
45596 call_tests++;
45597 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45598 des_xmlNodePtr(n_cur, cur, 1);
45599 xmlResetLastError();
45600 if (mem_base != xmlMemBlocks()) {
45601 printf("Leak of %d blocks found in xmlXPathNextSelf",
45602 xmlMemBlocks() - mem_base);
45603 test_ret++;
45604 printf(" %d", n_ctxt);
45605 printf(" %d", n_cur);
45606 printf("\n");
45607 }
45608 }
45609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045610 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045611#endif
45612
Daniel Veillarda82b1822004-11-08 16:24:57 +000045613 return(test_ret);
45614}
45615
45616
45617static int
45618test_xmlXPathNodeLeading(void) {
45619 int test_ret = 0;
45620
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045621#ifdef LIBXML_XPATH_ENABLED
45622 int mem_base;
45623 xmlNodeSetPtr ret_val;
45624 xmlNodeSetPtr nodes; /* a node-set */
45625 int n_nodes;
45626 xmlNodePtr node; /* a node */
45627 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045628
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045629 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45630 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45631 mem_base = xmlMemBlocks();
45632 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45633 node = gen_xmlNodePtr(n_node, 1);
45634
45635 ret_val = xmlXPathNodeLeading(nodes, node);
45636 desret_xmlNodeSetPtr(ret_val);
45637 call_tests++;
45638 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45639 des_xmlNodePtr(n_node, node, 1);
45640 xmlResetLastError();
45641 if (mem_base != xmlMemBlocks()) {
45642 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45643 xmlMemBlocks() - mem_base);
45644 test_ret++;
45645 printf(" %d", n_nodes);
45646 printf(" %d", n_node);
45647 printf("\n");
45648 }
45649 }
45650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045651 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045652#endif
45653
Daniel Veillarda82b1822004-11-08 16:24:57 +000045654 return(test_ret);
45655}
45656
45657
45658static int
45659test_xmlXPathNodeLeadingSorted(void) {
45660 int test_ret = 0;
45661
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045662#ifdef LIBXML_XPATH_ENABLED
45663 int mem_base;
45664 xmlNodeSetPtr ret_val;
45665 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45666 int n_nodes;
45667 xmlNodePtr node; /* a node */
45668 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045669
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045670 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45671 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45672 mem_base = xmlMemBlocks();
45673 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45674 node = gen_xmlNodePtr(n_node, 1);
45675
45676 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45677 desret_xmlNodeSetPtr(ret_val);
45678 call_tests++;
45679 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45680 des_xmlNodePtr(n_node, node, 1);
45681 xmlResetLastError();
45682 if (mem_base != xmlMemBlocks()) {
45683 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45684 xmlMemBlocks() - mem_base);
45685 test_ret++;
45686 printf(" %d", n_nodes);
45687 printf(" %d", n_node);
45688 printf("\n");
45689 }
45690 }
45691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045692 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045693#endif
45694
Daniel Veillarda82b1822004-11-08 16:24:57 +000045695 return(test_ret);
45696}
45697
45698
45699static int
45700test_xmlXPathNodeSetAdd(void) {
45701 int test_ret = 0;
45702
45703#ifdef LIBXML_XPATH_ENABLED
45704 int mem_base;
45705 xmlNodeSetPtr cur; /* the initial node set */
45706 int n_cur;
45707 xmlNodePtr val; /* a new xmlNodePtr */
45708 int n_val;
45709
45710 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45711 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45712 mem_base = xmlMemBlocks();
45713 cur = gen_xmlNodeSetPtr(n_cur, 0);
45714 val = gen_xmlNodePtr(n_val, 1);
45715
45716 xmlXPathNodeSetAdd(cur, val);
45717 call_tests++;
45718 des_xmlNodeSetPtr(n_cur, cur, 0);
45719 des_xmlNodePtr(n_val, val, 1);
45720 xmlResetLastError();
45721 if (mem_base != xmlMemBlocks()) {
45722 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45723 xmlMemBlocks() - mem_base);
45724 test_ret++;
45725 printf(" %d", n_cur);
45726 printf(" %d", n_val);
45727 printf("\n");
45728 }
45729 }
45730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045731 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045732#endif
45733
Daniel Veillarda82b1822004-11-08 16:24:57 +000045734 return(test_ret);
45735}
45736
45737
45738static int
45739test_xmlXPathNodeSetAddNs(void) {
45740 int test_ret = 0;
45741
45742#ifdef LIBXML_XPATH_ENABLED
45743 int mem_base;
45744 xmlNodeSetPtr cur; /* the initial node set */
45745 int n_cur;
45746 xmlNodePtr node; /* the hosting node */
45747 int n_node;
45748 xmlNsPtr ns; /* a the namespace node */
45749 int n_ns;
45750
45751 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45752 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45753 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45754 mem_base = xmlMemBlocks();
45755 cur = gen_xmlNodeSetPtr(n_cur, 0);
45756 node = gen_xmlNodePtr(n_node, 1);
45757 ns = gen_xmlNsPtr(n_ns, 2);
45758
45759 xmlXPathNodeSetAddNs(cur, node, ns);
45760 call_tests++;
45761 des_xmlNodeSetPtr(n_cur, cur, 0);
45762 des_xmlNodePtr(n_node, node, 1);
45763 des_xmlNsPtr(n_ns, ns, 2);
45764 xmlResetLastError();
45765 if (mem_base != xmlMemBlocks()) {
45766 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45767 xmlMemBlocks() - mem_base);
45768 test_ret++;
45769 printf(" %d", n_cur);
45770 printf(" %d", n_node);
45771 printf(" %d", n_ns);
45772 printf("\n");
45773 }
45774 }
45775 }
45776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045777 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045778#endif
45779
Daniel Veillarda82b1822004-11-08 16:24:57 +000045780 return(test_ret);
45781}
45782
45783
45784static int
45785test_xmlXPathNodeSetAddUnique(void) {
45786 int test_ret = 0;
45787
45788#ifdef LIBXML_XPATH_ENABLED
45789 int mem_base;
45790 xmlNodeSetPtr cur; /* the initial node set */
45791 int n_cur;
45792 xmlNodePtr val; /* a new xmlNodePtr */
45793 int n_val;
45794
45795 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45796 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45797 mem_base = xmlMemBlocks();
45798 cur = gen_xmlNodeSetPtr(n_cur, 0);
45799 val = gen_xmlNodePtr(n_val, 1);
45800
45801 xmlXPathNodeSetAddUnique(cur, val);
45802 call_tests++;
45803 des_xmlNodeSetPtr(n_cur, cur, 0);
45804 des_xmlNodePtr(n_val, val, 1);
45805 xmlResetLastError();
45806 if (mem_base != xmlMemBlocks()) {
45807 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45808 xmlMemBlocks() - mem_base);
45809 test_ret++;
45810 printf(" %d", n_cur);
45811 printf(" %d", n_val);
45812 printf("\n");
45813 }
45814 }
45815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045816 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045817#endif
45818
Daniel Veillarda82b1822004-11-08 16:24:57 +000045819 return(test_ret);
45820}
45821
45822
45823static int
45824test_xmlXPathNodeSetContains(void) {
45825 int test_ret = 0;
45826
45827#ifdef LIBXML_XPATH_ENABLED
45828 int mem_base;
45829 int ret_val;
45830 xmlNodeSetPtr cur; /* the node-set */
45831 int n_cur;
45832 xmlNodePtr val; /* the node */
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 ret_val = xmlXPathNodeSetContains(cur, val);
45842 desret_int(ret_val);
45843 call_tests++;
45844 des_xmlNodeSetPtr(n_cur, cur, 0);
45845 des_xmlNodePtr(n_val, val, 1);
45846 xmlResetLastError();
45847 if (mem_base != xmlMemBlocks()) {
45848 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45849 xmlMemBlocks() - mem_base);
45850 test_ret++;
45851 printf(" %d", n_cur);
45852 printf(" %d", n_val);
45853 printf("\n");
45854 }
45855 }
45856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045857 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045858#endif
45859
Daniel Veillarda82b1822004-11-08 16:24:57 +000045860 return(test_ret);
45861}
45862
45863
45864static int
45865test_xmlXPathNodeSetDel(void) {
45866 int test_ret = 0;
45867
45868#ifdef LIBXML_XPATH_ENABLED
45869 int mem_base;
45870 xmlNodeSetPtr cur; /* the initial node set */
45871 int n_cur;
45872 xmlNodePtr val; /* an xmlNodePtr */
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 xmlXPathNodeSetDel(cur, val);
45882 call_tests++;
45883 des_xmlNodeSetPtr(n_cur, cur, 0);
45884 des_xmlNodePtr(n_val, val, 1);
45885 xmlResetLastError();
45886 if (mem_base != xmlMemBlocks()) {
45887 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45888 xmlMemBlocks() - mem_base);
45889 test_ret++;
45890 printf(" %d", n_cur);
45891 printf(" %d", n_val);
45892 printf("\n");
45893 }
45894 }
45895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045896 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045897#endif
45898
Daniel Veillarda82b1822004-11-08 16:24:57 +000045899 return(test_ret);
45900}
45901
45902
45903static int
45904test_xmlXPathNodeSetMerge(void) {
45905 int test_ret = 0;
45906
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045907#ifdef LIBXML_XPATH_ENABLED
45908 int mem_base;
45909 xmlNodeSetPtr ret_val;
45910 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45911 int n_val1;
45912 xmlNodeSetPtr val2; /* the second NodeSet */
45913 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045914
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045915 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45916 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45917 mem_base = xmlMemBlocks();
45918 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45919 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45920
45921 ret_val = xmlXPathNodeSetMerge(val1, val2);
45922 desret_xmlNodeSetPtr(ret_val);
45923 call_tests++;
45924 des_xmlNodeSetPtr(n_val1, val1, 0);
45925 des_xmlNodeSetPtr(n_val2, val2, 1);
45926 xmlResetLastError();
45927 if (mem_base != xmlMemBlocks()) {
45928 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45929 xmlMemBlocks() - mem_base);
45930 test_ret++;
45931 printf(" %d", n_val1);
45932 printf(" %d", n_val2);
45933 printf("\n");
45934 }
45935 }
45936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045937 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045938#endif
45939
Daniel Veillarda82b1822004-11-08 16:24:57 +000045940 return(test_ret);
45941}
45942
45943
45944static int
45945test_xmlXPathNodeSetRemove(void) {
45946 int test_ret = 0;
45947
45948#ifdef LIBXML_XPATH_ENABLED
45949 int mem_base;
45950 xmlNodeSetPtr cur; /* the initial node set */
45951 int n_cur;
45952 int val; /* the index to remove */
45953 int n_val;
45954
45955 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45956 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45957 mem_base = xmlMemBlocks();
45958 cur = gen_xmlNodeSetPtr(n_cur, 0);
45959 val = gen_int(n_val, 1);
45960
45961 xmlXPathNodeSetRemove(cur, val);
45962 call_tests++;
45963 des_xmlNodeSetPtr(n_cur, cur, 0);
45964 des_int(n_val, val, 1);
45965 xmlResetLastError();
45966 if (mem_base != xmlMemBlocks()) {
45967 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45968 xmlMemBlocks() - mem_base);
45969 test_ret++;
45970 printf(" %d", n_cur);
45971 printf(" %d", n_val);
45972 printf("\n");
45973 }
45974 }
45975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045976 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045977#endif
45978
Daniel Veillarda82b1822004-11-08 16:24:57 +000045979 return(test_ret);
45980}
45981
45982
45983static int
45984test_xmlXPathNodeSetSort(void) {
45985 int test_ret = 0;
45986
45987#ifdef LIBXML_XPATH_ENABLED
45988 int mem_base;
45989 xmlNodeSetPtr set; /* the node set */
45990 int n_set;
45991
45992 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45993 mem_base = xmlMemBlocks();
45994 set = gen_xmlNodeSetPtr(n_set, 0);
45995
45996 xmlXPathNodeSetSort(set);
45997 call_tests++;
45998 des_xmlNodeSetPtr(n_set, set, 0);
45999 xmlResetLastError();
46000 if (mem_base != xmlMemBlocks()) {
46001 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46002 xmlMemBlocks() - mem_base);
46003 test_ret++;
46004 printf(" %d", n_set);
46005 printf("\n");
46006 }
46007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046008 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046009#endif
46010
Daniel Veillarda82b1822004-11-08 16:24:57 +000046011 return(test_ret);
46012}
46013
46014
46015static int
46016test_xmlXPathNodeTrailing(void) {
46017 int test_ret = 0;
46018
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046019#ifdef LIBXML_XPATH_ENABLED
46020 int mem_base;
46021 xmlNodeSetPtr ret_val;
46022 xmlNodeSetPtr nodes; /* a node-set */
46023 int n_nodes;
46024 xmlNodePtr node; /* a node */
46025 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046026
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046027 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46028 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46029 mem_base = xmlMemBlocks();
46030 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46031 node = gen_xmlNodePtr(n_node, 1);
46032
46033 ret_val = xmlXPathNodeTrailing(nodes, node);
46034 desret_xmlNodeSetPtr(ret_val);
46035 call_tests++;
46036 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46037 des_xmlNodePtr(n_node, node, 1);
46038 xmlResetLastError();
46039 if (mem_base != xmlMemBlocks()) {
46040 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46041 xmlMemBlocks() - mem_base);
46042 test_ret++;
46043 printf(" %d", n_nodes);
46044 printf(" %d", n_node);
46045 printf("\n");
46046 }
46047 }
46048 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046049 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046050#endif
46051
Daniel Veillarda82b1822004-11-08 16:24:57 +000046052 return(test_ret);
46053}
46054
46055
46056static int
46057test_xmlXPathNodeTrailingSorted(void) {
46058 int test_ret = 0;
46059
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046060#ifdef LIBXML_XPATH_ENABLED
46061 int mem_base;
46062 xmlNodeSetPtr ret_val;
46063 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46064 int n_nodes;
46065 xmlNodePtr node; /* a node */
46066 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046067
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046068 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46069 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46070 mem_base = xmlMemBlocks();
46071 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46072 node = gen_xmlNodePtr(n_node, 1);
46073
46074 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46075 desret_xmlNodeSetPtr(ret_val);
46076 call_tests++;
46077 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46078 des_xmlNodePtr(n_node, node, 1);
46079 xmlResetLastError();
46080 if (mem_base != xmlMemBlocks()) {
46081 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46082 xmlMemBlocks() - mem_base);
46083 test_ret++;
46084 printf(" %d", n_nodes);
46085 printf(" %d", n_node);
46086 printf("\n");
46087 }
46088 }
46089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046090 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046091#endif
46092
Daniel Veillarda82b1822004-11-08 16:24:57 +000046093 return(test_ret);
46094}
46095
46096
46097static int
46098test_xmlXPathNormalizeFunction(void) {
46099 int test_ret = 0;
46100
46101#ifdef LIBXML_XPATH_ENABLED
46102 int mem_base;
46103 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46104 int n_ctxt;
46105 int nargs; /* the number of arguments */
46106 int n_nargs;
46107
46108 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46109 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46110 mem_base = xmlMemBlocks();
46111 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46112 nargs = gen_int(n_nargs, 1);
46113
46114 xmlXPathNormalizeFunction(ctxt, nargs);
46115 call_tests++;
46116 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46117 des_int(n_nargs, nargs, 1);
46118 xmlResetLastError();
46119 if (mem_base != xmlMemBlocks()) {
46120 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46121 xmlMemBlocks() - mem_base);
46122 test_ret++;
46123 printf(" %d", n_ctxt);
46124 printf(" %d", n_nargs);
46125 printf("\n");
46126 }
46127 }
46128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046129 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046130#endif
46131
Daniel Veillarda82b1822004-11-08 16:24:57 +000046132 return(test_ret);
46133}
46134
46135
46136static int
46137test_xmlXPathNotEqualValues(void) {
46138 int test_ret = 0;
46139
46140#ifdef LIBXML_XPATH_ENABLED
46141 int mem_base;
46142 int ret_val;
46143 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46144 int n_ctxt;
46145
46146 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46147 mem_base = xmlMemBlocks();
46148 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46149
46150 ret_val = xmlXPathNotEqualValues(ctxt);
46151 desret_int(ret_val);
46152 call_tests++;
46153 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46154 xmlResetLastError();
46155 if (mem_base != xmlMemBlocks()) {
46156 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46157 xmlMemBlocks() - mem_base);
46158 test_ret++;
46159 printf(" %d", n_ctxt);
46160 printf("\n");
46161 }
46162 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046163 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046164#endif
46165
Daniel Veillarda82b1822004-11-08 16:24:57 +000046166 return(test_ret);
46167}
46168
46169
46170static int
46171test_xmlXPathNotFunction(void) {
46172 int test_ret = 0;
46173
46174#ifdef LIBXML_XPATH_ENABLED
46175 int mem_base;
46176 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46177 int n_ctxt;
46178 int nargs; /* the number of arguments */
46179 int n_nargs;
46180
46181 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46182 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46183 mem_base = xmlMemBlocks();
46184 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46185 nargs = gen_int(n_nargs, 1);
46186
46187 xmlXPathNotFunction(ctxt, nargs);
46188 call_tests++;
46189 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46190 des_int(n_nargs, nargs, 1);
46191 xmlResetLastError();
46192 if (mem_base != xmlMemBlocks()) {
46193 printf("Leak of %d blocks found in xmlXPathNotFunction",
46194 xmlMemBlocks() - mem_base);
46195 test_ret++;
46196 printf(" %d", n_ctxt);
46197 printf(" %d", n_nargs);
46198 printf("\n");
46199 }
46200 }
46201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046202 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046203#endif
46204
Daniel Veillarda82b1822004-11-08 16:24:57 +000046205 return(test_ret);
46206}
46207
46208
46209static int
46210test_xmlXPathNsLookup(void) {
46211 int test_ret = 0;
46212
46213#ifdef LIBXML_XPATH_ENABLED
46214 int mem_base;
46215 const xmlChar * ret_val;
46216 xmlXPathContextPtr ctxt; /* the XPath context */
46217 int n_ctxt;
46218 xmlChar * prefix; /* the namespace prefix value */
46219 int n_prefix;
46220
46221 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46222 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46223 mem_base = xmlMemBlocks();
46224 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46225 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46226
William M. Brackf13f77f2004-11-12 16:03:48 +000046227 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046228 desret_const_xmlChar_ptr(ret_val);
46229 call_tests++;
46230 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046231 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046232 xmlResetLastError();
46233 if (mem_base != xmlMemBlocks()) {
46234 printf("Leak of %d blocks found in xmlXPathNsLookup",
46235 xmlMemBlocks() - mem_base);
46236 test_ret++;
46237 printf(" %d", n_ctxt);
46238 printf(" %d", n_prefix);
46239 printf("\n");
46240 }
46241 }
46242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046243 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046244#endif
46245
Daniel Veillarda82b1822004-11-08 16:24:57 +000046246 return(test_ret);
46247}
46248
46249
46250static int
46251test_xmlXPathNumberFunction(void) {
46252 int test_ret = 0;
46253
46254#ifdef LIBXML_XPATH_ENABLED
46255 int mem_base;
46256 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46257 int n_ctxt;
46258 int nargs; /* the number of arguments */
46259 int n_nargs;
46260
46261 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46262 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46263 mem_base = xmlMemBlocks();
46264 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46265 nargs = gen_int(n_nargs, 1);
46266
46267 xmlXPathNumberFunction(ctxt, nargs);
46268 call_tests++;
46269 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46270 des_int(n_nargs, nargs, 1);
46271 xmlResetLastError();
46272 if (mem_base != xmlMemBlocks()) {
46273 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46274 xmlMemBlocks() - mem_base);
46275 test_ret++;
46276 printf(" %d", n_ctxt);
46277 printf(" %d", n_nargs);
46278 printf("\n");
46279 }
46280 }
46281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046282 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046283#endif
46284
Daniel Veillarda82b1822004-11-08 16:24:57 +000046285 return(test_ret);
46286}
46287
46288
46289static int
46290test_xmlXPathParseNCName(void) {
46291 int test_ret = 0;
46292
46293#ifdef LIBXML_XPATH_ENABLED
46294 int mem_base;
46295 xmlChar * ret_val;
46296 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46297 int n_ctxt;
46298
46299 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46300 mem_base = xmlMemBlocks();
46301 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46302
46303 ret_val = xmlXPathParseNCName(ctxt);
46304 desret_xmlChar_ptr(ret_val);
46305 call_tests++;
46306 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46307 xmlResetLastError();
46308 if (mem_base != xmlMemBlocks()) {
46309 printf("Leak of %d blocks found in xmlXPathParseNCName",
46310 xmlMemBlocks() - mem_base);
46311 test_ret++;
46312 printf(" %d", n_ctxt);
46313 printf("\n");
46314 }
46315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046316 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046317#endif
46318
Daniel Veillarda82b1822004-11-08 16:24:57 +000046319 return(test_ret);
46320}
46321
46322
46323static int
46324test_xmlXPathParseName(void) {
46325 int test_ret = 0;
46326
46327#ifdef LIBXML_XPATH_ENABLED
46328 int mem_base;
46329 xmlChar * ret_val;
46330 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46331 int n_ctxt;
46332
46333 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46334 mem_base = xmlMemBlocks();
46335 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46336
46337 ret_val = xmlXPathParseName(ctxt);
46338 desret_xmlChar_ptr(ret_val);
46339 call_tests++;
46340 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46341 xmlResetLastError();
46342 if (mem_base != xmlMemBlocks()) {
46343 printf("Leak of %d blocks found in xmlXPathParseName",
46344 xmlMemBlocks() - mem_base);
46345 test_ret++;
46346 printf(" %d", n_ctxt);
46347 printf("\n");
46348 }
46349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046350 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046351#endif
46352
Daniel Veillarda82b1822004-11-08 16:24:57 +000046353 return(test_ret);
46354}
46355
46356
46357static int
46358test_xmlXPathPopBoolean(void) {
46359 int test_ret = 0;
46360
46361#ifdef LIBXML_XPATH_ENABLED
46362 int mem_base;
46363 int ret_val;
46364 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46365 int n_ctxt;
46366
46367 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46368 mem_base = xmlMemBlocks();
46369 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46370
46371 ret_val = xmlXPathPopBoolean(ctxt);
46372 desret_int(ret_val);
46373 call_tests++;
46374 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46375 xmlResetLastError();
46376 if (mem_base != xmlMemBlocks()) {
46377 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46378 xmlMemBlocks() - mem_base);
46379 test_ret++;
46380 printf(" %d", n_ctxt);
46381 printf("\n");
46382 }
46383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046384 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046385#endif
46386
Daniel Veillarda82b1822004-11-08 16:24:57 +000046387 return(test_ret);
46388}
46389
46390
46391static int
46392test_xmlXPathPopExternal(void) {
46393 int test_ret = 0;
46394
46395#ifdef LIBXML_XPATH_ENABLED
46396 int mem_base;
46397 void * ret_val;
46398 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46399 int n_ctxt;
46400
46401 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46402 mem_base = xmlMemBlocks();
46403 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46404
46405 ret_val = xmlXPathPopExternal(ctxt);
46406 desret_void_ptr(ret_val);
46407 call_tests++;
46408 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46409 xmlResetLastError();
46410 if (mem_base != xmlMemBlocks()) {
46411 printf("Leak of %d blocks found in xmlXPathPopExternal",
46412 xmlMemBlocks() - mem_base);
46413 test_ret++;
46414 printf(" %d", n_ctxt);
46415 printf("\n");
46416 }
46417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046418 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046419#endif
46420
Daniel Veillarda82b1822004-11-08 16:24:57 +000046421 return(test_ret);
46422}
46423
46424
46425static int
46426test_xmlXPathPopNodeSet(void) {
46427 int test_ret = 0;
46428
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046429#ifdef LIBXML_XPATH_ENABLED
46430 int mem_base;
46431 xmlNodeSetPtr ret_val;
46432 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46433 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046434
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046435 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46436 mem_base = xmlMemBlocks();
46437 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46438
46439 ret_val = xmlXPathPopNodeSet(ctxt);
46440 desret_xmlNodeSetPtr(ret_val);
46441 call_tests++;
46442 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46443 xmlResetLastError();
46444 if (mem_base != xmlMemBlocks()) {
46445 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46446 xmlMemBlocks() - mem_base);
46447 test_ret++;
46448 printf(" %d", n_ctxt);
46449 printf("\n");
46450 }
46451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046452 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046453#endif
46454
Daniel Veillarda82b1822004-11-08 16:24:57 +000046455 return(test_ret);
46456}
46457
46458
46459static int
46460test_xmlXPathPopNumber(void) {
46461 int test_ret = 0;
46462
46463#ifdef LIBXML_XPATH_ENABLED
46464 int mem_base;
46465 double ret_val;
46466 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46467 int n_ctxt;
46468
46469 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46470 mem_base = xmlMemBlocks();
46471 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46472
46473 ret_val = xmlXPathPopNumber(ctxt);
46474 desret_double(ret_val);
46475 call_tests++;
46476 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46477 xmlResetLastError();
46478 if (mem_base != xmlMemBlocks()) {
46479 printf("Leak of %d blocks found in xmlXPathPopNumber",
46480 xmlMemBlocks() - mem_base);
46481 test_ret++;
46482 printf(" %d", n_ctxt);
46483 printf("\n");
46484 }
46485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046486 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046487#endif
46488
Daniel Veillarda82b1822004-11-08 16:24:57 +000046489 return(test_ret);
46490}
46491
46492
46493static int
46494test_xmlXPathPopString(void) {
46495 int test_ret = 0;
46496
46497#ifdef LIBXML_XPATH_ENABLED
46498 int mem_base;
46499 xmlChar * ret_val;
46500 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46501 int n_ctxt;
46502
46503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46504 mem_base = xmlMemBlocks();
46505 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46506
46507 ret_val = xmlXPathPopString(ctxt);
46508 desret_xmlChar_ptr(ret_val);
46509 call_tests++;
46510 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46511 xmlResetLastError();
46512 if (mem_base != xmlMemBlocks()) {
46513 printf("Leak of %d blocks found in xmlXPathPopString",
46514 xmlMemBlocks() - mem_base);
46515 test_ret++;
46516 printf(" %d", n_ctxt);
46517 printf("\n");
46518 }
46519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046520 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046521#endif
46522
Daniel Veillarda82b1822004-11-08 16:24:57 +000046523 return(test_ret);
46524}
46525
46526
46527static int
46528test_xmlXPathPositionFunction(void) {
46529 int test_ret = 0;
46530
46531#ifdef LIBXML_XPATH_ENABLED
46532 int mem_base;
46533 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46534 int n_ctxt;
46535 int nargs; /* the number of arguments */
46536 int n_nargs;
46537
46538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46539 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46540 mem_base = xmlMemBlocks();
46541 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46542 nargs = gen_int(n_nargs, 1);
46543
46544 xmlXPathPositionFunction(ctxt, nargs);
46545 call_tests++;
46546 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46547 des_int(n_nargs, nargs, 1);
46548 xmlResetLastError();
46549 if (mem_base != xmlMemBlocks()) {
46550 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46551 xmlMemBlocks() - mem_base);
46552 test_ret++;
46553 printf(" %d", n_ctxt);
46554 printf(" %d", n_nargs);
46555 printf("\n");
46556 }
46557 }
46558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046559 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046560#endif
46561
Daniel Veillarda82b1822004-11-08 16:24:57 +000046562 return(test_ret);
46563}
46564
46565
46566static int
46567test_xmlXPathRegisterAllFunctions(void) {
46568 int test_ret = 0;
46569
46570#ifdef LIBXML_XPATH_ENABLED
46571 int mem_base;
46572 xmlXPathContextPtr ctxt; /* the XPath context */
46573 int n_ctxt;
46574
46575 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46576 mem_base = xmlMemBlocks();
46577 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46578
46579 xmlXPathRegisterAllFunctions(ctxt);
46580 call_tests++;
46581 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46582 xmlResetLastError();
46583 if (mem_base != xmlMemBlocks()) {
46584 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46585 xmlMemBlocks() - mem_base);
46586 test_ret++;
46587 printf(" %d", n_ctxt);
46588 printf("\n");
46589 }
46590 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046591 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046592#endif
46593
Daniel Veillarda82b1822004-11-08 16:24:57 +000046594 return(test_ret);
46595}
46596
46597
46598static int
46599test_xmlXPathRegisterFunc(void) {
46600 int test_ret = 0;
46601
46602
46603 /* missing type support */
46604 return(test_ret);
46605}
46606
46607
46608static int
46609test_xmlXPathRegisterFuncLookup(void) {
46610 int test_ret = 0;
46611
46612
46613 /* missing type support */
46614 return(test_ret);
46615}
46616
46617
46618static int
46619test_xmlXPathRegisterFuncNS(void) {
46620 int test_ret = 0;
46621
46622
46623 /* missing type support */
46624 return(test_ret);
46625}
46626
46627
46628static int
46629test_xmlXPathRegisterNs(void) {
46630 int test_ret = 0;
46631
46632#ifdef LIBXML_XPATH_ENABLED
46633 int mem_base;
46634 int ret_val;
46635 xmlXPathContextPtr ctxt; /* the XPath context */
46636 int n_ctxt;
46637 xmlChar * prefix; /* the namespace prefix */
46638 int n_prefix;
46639 xmlChar * ns_uri; /* the namespace name */
46640 int n_ns_uri;
46641
46642 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46643 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46644 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46645 mem_base = xmlMemBlocks();
46646 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46647 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46648 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46649
William M. Brackf13f77f2004-11-12 16:03:48 +000046650 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046651 desret_int(ret_val);
46652 call_tests++;
46653 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046654 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46655 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046656 xmlResetLastError();
46657 if (mem_base != xmlMemBlocks()) {
46658 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46659 xmlMemBlocks() - mem_base);
46660 test_ret++;
46661 printf(" %d", n_ctxt);
46662 printf(" %d", n_prefix);
46663 printf(" %d", n_ns_uri);
46664 printf("\n");
46665 }
46666 }
46667 }
46668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046669 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046670#endif
46671
Daniel Veillarda82b1822004-11-08 16:24:57 +000046672 return(test_ret);
46673}
46674
46675
46676static int
46677test_xmlXPathRegisterVariable(void) {
46678 int test_ret = 0;
46679
46680#ifdef LIBXML_XPATH_ENABLED
46681 int mem_base;
46682 int ret_val;
46683 xmlXPathContextPtr ctxt; /* the XPath context */
46684 int n_ctxt;
46685 xmlChar * name; /* the variable name */
46686 int n_name;
46687 xmlXPathObjectPtr value; /* the variable value or NULL */
46688 int n_value;
46689
46690 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46691 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46692 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46693 mem_base = xmlMemBlocks();
46694 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46695 name = gen_const_xmlChar_ptr(n_name, 1);
46696 value = gen_xmlXPathObjectPtr(n_value, 2);
46697
William M. Brackf13f77f2004-11-12 16:03:48 +000046698 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046699 desret_int(ret_val);
46700 call_tests++;
46701 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046702 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046703 des_xmlXPathObjectPtr(n_value, value, 2);
46704 xmlResetLastError();
46705 if (mem_base != xmlMemBlocks()) {
46706 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46707 xmlMemBlocks() - mem_base);
46708 test_ret++;
46709 printf(" %d", n_ctxt);
46710 printf(" %d", n_name);
46711 printf(" %d", n_value);
46712 printf("\n");
46713 }
46714 }
46715 }
46716 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046717 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046718#endif
46719
Daniel Veillarda82b1822004-11-08 16:24:57 +000046720 return(test_ret);
46721}
46722
46723
46724static int
46725test_xmlXPathRegisterVariableLookup(void) {
46726 int test_ret = 0;
46727
46728
46729 /* missing type support */
46730 return(test_ret);
46731}
46732
46733
46734static int
46735test_xmlXPathRegisterVariableNS(void) {
46736 int test_ret = 0;
46737
46738#ifdef LIBXML_XPATH_ENABLED
46739 int mem_base;
46740 int ret_val;
46741 xmlXPathContextPtr ctxt; /* the XPath context */
46742 int n_ctxt;
46743 xmlChar * name; /* the variable name */
46744 int n_name;
46745 xmlChar * ns_uri; /* the variable namespace URI */
46746 int n_ns_uri;
46747 xmlXPathObjectPtr value; /* the variable value or NULL */
46748 int n_value;
46749
46750 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46751 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46752 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46753 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46754 mem_base = xmlMemBlocks();
46755 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46756 name = gen_const_xmlChar_ptr(n_name, 1);
46757 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46758 value = gen_xmlXPathObjectPtr(n_value, 3);
46759
William M. Brackf13f77f2004-11-12 16:03:48 +000046760 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046761 desret_int(ret_val);
46762 call_tests++;
46763 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046764 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
46765 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046766 des_xmlXPathObjectPtr(n_value, value, 3);
46767 xmlResetLastError();
46768 if (mem_base != xmlMemBlocks()) {
46769 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46770 xmlMemBlocks() - mem_base);
46771 test_ret++;
46772 printf(" %d", n_ctxt);
46773 printf(" %d", n_name);
46774 printf(" %d", n_ns_uri);
46775 printf(" %d", n_value);
46776 printf("\n");
46777 }
46778 }
46779 }
46780 }
46781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046782 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046783#endif
46784
Daniel Veillarda82b1822004-11-08 16:24:57 +000046785 return(test_ret);
46786}
46787
46788
46789static int
46790test_xmlXPathRegisteredFuncsCleanup(void) {
46791 int test_ret = 0;
46792
46793#ifdef LIBXML_XPATH_ENABLED
46794 int mem_base;
46795 xmlXPathContextPtr ctxt; /* the XPath context */
46796 int n_ctxt;
46797
46798 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46799 mem_base = xmlMemBlocks();
46800 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46801
46802 xmlXPathRegisteredFuncsCleanup(ctxt);
46803 call_tests++;
46804 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46805 xmlResetLastError();
46806 if (mem_base != xmlMemBlocks()) {
46807 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46808 xmlMemBlocks() - mem_base);
46809 test_ret++;
46810 printf(" %d", n_ctxt);
46811 printf("\n");
46812 }
46813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046814 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046815#endif
46816
Daniel Veillarda82b1822004-11-08 16:24:57 +000046817 return(test_ret);
46818}
46819
46820
46821static int
46822test_xmlXPathRegisteredNsCleanup(void) {
46823 int test_ret = 0;
46824
46825#ifdef LIBXML_XPATH_ENABLED
46826 int mem_base;
46827 xmlXPathContextPtr ctxt; /* the XPath context */
46828 int n_ctxt;
46829
46830 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46831 mem_base = xmlMemBlocks();
46832 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46833
46834 xmlXPathRegisteredNsCleanup(ctxt);
46835 call_tests++;
46836 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46837 xmlResetLastError();
46838 if (mem_base != xmlMemBlocks()) {
46839 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46840 xmlMemBlocks() - mem_base);
46841 test_ret++;
46842 printf(" %d", n_ctxt);
46843 printf("\n");
46844 }
46845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046846 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046847#endif
46848
Daniel Veillarda82b1822004-11-08 16:24:57 +000046849 return(test_ret);
46850}
46851
46852
46853static int
46854test_xmlXPathRegisteredVariablesCleanup(void) {
46855 int test_ret = 0;
46856
46857#ifdef LIBXML_XPATH_ENABLED
46858 int mem_base;
46859 xmlXPathContextPtr ctxt; /* the XPath context */
46860 int n_ctxt;
46861
46862 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46863 mem_base = xmlMemBlocks();
46864 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46865
46866 xmlXPathRegisteredVariablesCleanup(ctxt);
46867 call_tests++;
46868 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46869 xmlResetLastError();
46870 if (mem_base != xmlMemBlocks()) {
46871 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46872 xmlMemBlocks() - mem_base);
46873 test_ret++;
46874 printf(" %d", n_ctxt);
46875 printf("\n");
46876 }
46877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046878 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046879#endif
46880
Daniel Veillarda82b1822004-11-08 16:24:57 +000046881 return(test_ret);
46882}
46883
46884
46885static int
46886test_xmlXPathRoot(void) {
46887 int test_ret = 0;
46888
46889#ifdef LIBXML_XPATH_ENABLED
46890 int mem_base;
46891 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46892 int n_ctxt;
46893
46894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46895 mem_base = xmlMemBlocks();
46896 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46897
46898 xmlXPathRoot(ctxt);
46899 call_tests++;
46900 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46901 xmlResetLastError();
46902 if (mem_base != xmlMemBlocks()) {
46903 printf("Leak of %d blocks found in xmlXPathRoot",
46904 xmlMemBlocks() - mem_base);
46905 test_ret++;
46906 printf(" %d", n_ctxt);
46907 printf("\n");
46908 }
46909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046910 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046911#endif
46912
Daniel Veillarda82b1822004-11-08 16:24:57 +000046913 return(test_ret);
46914}
46915
46916
46917static int
46918test_xmlXPathRoundFunction(void) {
46919 int test_ret = 0;
46920
46921#ifdef LIBXML_XPATH_ENABLED
46922 int mem_base;
46923 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46924 int n_ctxt;
46925 int nargs; /* the number of arguments */
46926 int n_nargs;
46927
46928 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46929 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46930 mem_base = xmlMemBlocks();
46931 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46932 nargs = gen_int(n_nargs, 1);
46933
46934 xmlXPathRoundFunction(ctxt, nargs);
46935 call_tests++;
46936 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46937 des_int(n_nargs, nargs, 1);
46938 xmlResetLastError();
46939 if (mem_base != xmlMemBlocks()) {
46940 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46941 xmlMemBlocks() - mem_base);
46942 test_ret++;
46943 printf(" %d", n_ctxt);
46944 printf(" %d", n_nargs);
46945 printf("\n");
46946 }
46947 }
46948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046949 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046950#endif
46951
Daniel Veillarda82b1822004-11-08 16:24:57 +000046952 return(test_ret);
46953}
46954
46955
46956static int
46957test_xmlXPathStartsWithFunction(void) {
46958 int test_ret = 0;
46959
46960#ifdef LIBXML_XPATH_ENABLED
46961 int mem_base;
46962 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46963 int n_ctxt;
46964 int nargs; /* the number of arguments */
46965 int n_nargs;
46966
46967 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46968 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46969 mem_base = xmlMemBlocks();
46970 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46971 nargs = gen_int(n_nargs, 1);
46972
46973 xmlXPathStartsWithFunction(ctxt, nargs);
46974 call_tests++;
46975 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46976 des_int(n_nargs, nargs, 1);
46977 xmlResetLastError();
46978 if (mem_base != xmlMemBlocks()) {
46979 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46980 xmlMemBlocks() - mem_base);
46981 test_ret++;
46982 printf(" %d", n_ctxt);
46983 printf(" %d", n_nargs);
46984 printf("\n");
46985 }
46986 }
46987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046988 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046989#endif
46990
Daniel Veillarda82b1822004-11-08 16:24:57 +000046991 return(test_ret);
46992}
46993
46994
46995static int
46996test_xmlXPathStringEvalNumber(void) {
46997 int test_ret = 0;
46998
46999#ifdef LIBXML_XPATH_ENABLED
47000 int mem_base;
47001 double ret_val;
47002 xmlChar * str; /* A string to scan */
47003 int n_str;
47004
47005 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47006 mem_base = xmlMemBlocks();
47007 str = gen_const_xmlChar_ptr(n_str, 0);
47008
William M. Brackf13f77f2004-11-12 16:03:48 +000047009 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047010 desret_double(ret_val);
47011 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047012 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047013 xmlResetLastError();
47014 if (mem_base != xmlMemBlocks()) {
47015 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47016 xmlMemBlocks() - mem_base);
47017 test_ret++;
47018 printf(" %d", n_str);
47019 printf("\n");
47020 }
47021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047022 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047023#endif
47024
Daniel Veillarda82b1822004-11-08 16:24:57 +000047025 return(test_ret);
47026}
47027
47028
47029static int
47030test_xmlXPathStringFunction(void) {
47031 int test_ret = 0;
47032
47033#ifdef LIBXML_XPATH_ENABLED
47034 int mem_base;
47035 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47036 int n_ctxt;
47037 int nargs; /* the number of arguments */
47038 int n_nargs;
47039
47040 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47041 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47042 mem_base = xmlMemBlocks();
47043 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47044 nargs = gen_int(n_nargs, 1);
47045
47046 xmlXPathStringFunction(ctxt, nargs);
47047 call_tests++;
47048 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47049 des_int(n_nargs, nargs, 1);
47050 xmlResetLastError();
47051 if (mem_base != xmlMemBlocks()) {
47052 printf("Leak of %d blocks found in xmlXPathStringFunction",
47053 xmlMemBlocks() - mem_base);
47054 test_ret++;
47055 printf(" %d", n_ctxt);
47056 printf(" %d", n_nargs);
47057 printf("\n");
47058 }
47059 }
47060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047061 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047062#endif
47063
Daniel Veillarda82b1822004-11-08 16:24:57 +000047064 return(test_ret);
47065}
47066
47067
47068static int
47069test_xmlXPathStringLengthFunction(void) {
47070 int test_ret = 0;
47071
47072#ifdef LIBXML_XPATH_ENABLED
47073 int mem_base;
47074 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47075 int n_ctxt;
47076 int nargs; /* the number of arguments */
47077 int n_nargs;
47078
47079 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47080 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47081 mem_base = xmlMemBlocks();
47082 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47083 nargs = gen_int(n_nargs, 1);
47084
47085 xmlXPathStringLengthFunction(ctxt, nargs);
47086 call_tests++;
47087 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47088 des_int(n_nargs, nargs, 1);
47089 xmlResetLastError();
47090 if (mem_base != xmlMemBlocks()) {
47091 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47092 xmlMemBlocks() - mem_base);
47093 test_ret++;
47094 printf(" %d", n_ctxt);
47095 printf(" %d", n_nargs);
47096 printf("\n");
47097 }
47098 }
47099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047100 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047101#endif
47102
Daniel Veillarda82b1822004-11-08 16:24:57 +000047103 return(test_ret);
47104}
47105
47106
47107static int
47108test_xmlXPathSubValues(void) {
47109 int test_ret = 0;
47110
47111#ifdef LIBXML_XPATH_ENABLED
47112 int mem_base;
47113 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47114 int n_ctxt;
47115
47116 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47117 mem_base = xmlMemBlocks();
47118 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47119
47120 xmlXPathSubValues(ctxt);
47121 call_tests++;
47122 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47123 xmlResetLastError();
47124 if (mem_base != xmlMemBlocks()) {
47125 printf("Leak of %d blocks found in xmlXPathSubValues",
47126 xmlMemBlocks() - mem_base);
47127 test_ret++;
47128 printf(" %d", n_ctxt);
47129 printf("\n");
47130 }
47131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047132 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047133#endif
47134
Daniel Veillarda82b1822004-11-08 16:24:57 +000047135 return(test_ret);
47136}
47137
47138
47139static int
47140test_xmlXPathSubstringAfterFunction(void) {
47141 int test_ret = 0;
47142
47143#ifdef LIBXML_XPATH_ENABLED
47144 int mem_base;
47145 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47146 int n_ctxt;
47147 int nargs; /* the number of arguments */
47148 int n_nargs;
47149
47150 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47151 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47152 mem_base = xmlMemBlocks();
47153 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47154 nargs = gen_int(n_nargs, 1);
47155
47156 xmlXPathSubstringAfterFunction(ctxt, nargs);
47157 call_tests++;
47158 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47159 des_int(n_nargs, nargs, 1);
47160 xmlResetLastError();
47161 if (mem_base != xmlMemBlocks()) {
47162 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47163 xmlMemBlocks() - mem_base);
47164 test_ret++;
47165 printf(" %d", n_ctxt);
47166 printf(" %d", n_nargs);
47167 printf("\n");
47168 }
47169 }
47170 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047171 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047172#endif
47173
Daniel Veillarda82b1822004-11-08 16:24:57 +000047174 return(test_ret);
47175}
47176
47177
47178static int
47179test_xmlXPathSubstringBeforeFunction(void) {
47180 int test_ret = 0;
47181
47182#ifdef LIBXML_XPATH_ENABLED
47183 int mem_base;
47184 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47185 int n_ctxt;
47186 int nargs; /* the number of arguments */
47187 int n_nargs;
47188
47189 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47190 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47191 mem_base = xmlMemBlocks();
47192 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47193 nargs = gen_int(n_nargs, 1);
47194
47195 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47196 call_tests++;
47197 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47198 des_int(n_nargs, nargs, 1);
47199 xmlResetLastError();
47200 if (mem_base != xmlMemBlocks()) {
47201 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47202 xmlMemBlocks() - mem_base);
47203 test_ret++;
47204 printf(" %d", n_ctxt);
47205 printf(" %d", n_nargs);
47206 printf("\n");
47207 }
47208 }
47209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047210 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047211#endif
47212
Daniel Veillarda82b1822004-11-08 16:24:57 +000047213 return(test_ret);
47214}
47215
47216
47217static int
47218test_xmlXPathSubstringFunction(void) {
47219 int test_ret = 0;
47220
47221#ifdef LIBXML_XPATH_ENABLED
47222 int mem_base;
47223 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47224 int n_ctxt;
47225 int nargs; /* the number of arguments */
47226 int n_nargs;
47227
47228 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47229 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47230 mem_base = xmlMemBlocks();
47231 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47232 nargs = gen_int(n_nargs, 1);
47233
47234 xmlXPathSubstringFunction(ctxt, nargs);
47235 call_tests++;
47236 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47237 des_int(n_nargs, nargs, 1);
47238 xmlResetLastError();
47239 if (mem_base != xmlMemBlocks()) {
47240 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47241 xmlMemBlocks() - mem_base);
47242 test_ret++;
47243 printf(" %d", n_ctxt);
47244 printf(" %d", n_nargs);
47245 printf("\n");
47246 }
47247 }
47248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047249 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047250#endif
47251
Daniel Veillarda82b1822004-11-08 16:24:57 +000047252 return(test_ret);
47253}
47254
47255
47256static int
47257test_xmlXPathSumFunction(void) {
47258 int test_ret = 0;
47259
47260#ifdef LIBXML_XPATH_ENABLED
47261 int mem_base;
47262 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47263 int n_ctxt;
47264 int nargs; /* the number of arguments */
47265 int n_nargs;
47266
47267 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47268 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47269 mem_base = xmlMemBlocks();
47270 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47271 nargs = gen_int(n_nargs, 1);
47272
47273 xmlXPathSumFunction(ctxt, nargs);
47274 call_tests++;
47275 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47276 des_int(n_nargs, nargs, 1);
47277 xmlResetLastError();
47278 if (mem_base != xmlMemBlocks()) {
47279 printf("Leak of %d blocks found in xmlXPathSumFunction",
47280 xmlMemBlocks() - mem_base);
47281 test_ret++;
47282 printf(" %d", n_ctxt);
47283 printf(" %d", n_nargs);
47284 printf("\n");
47285 }
47286 }
47287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047288 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047289#endif
47290
Daniel Veillarda82b1822004-11-08 16:24:57 +000047291 return(test_ret);
47292}
47293
47294
47295static int
47296test_xmlXPathTrailing(void) {
47297 int test_ret = 0;
47298
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047299#ifdef LIBXML_XPATH_ENABLED
47300 int mem_base;
47301 xmlNodeSetPtr ret_val;
47302 xmlNodeSetPtr nodes1; /* a node-set */
47303 int n_nodes1;
47304 xmlNodeSetPtr nodes2; /* a node-set */
47305 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047306
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047307 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47308 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47309 mem_base = xmlMemBlocks();
47310 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47311 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47312
47313 ret_val = xmlXPathTrailing(nodes1, nodes2);
47314 desret_xmlNodeSetPtr(ret_val);
47315 call_tests++;
47316 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47317 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47318 xmlResetLastError();
47319 if (mem_base != xmlMemBlocks()) {
47320 printf("Leak of %d blocks found in xmlXPathTrailing",
47321 xmlMemBlocks() - mem_base);
47322 test_ret++;
47323 printf(" %d", n_nodes1);
47324 printf(" %d", n_nodes2);
47325 printf("\n");
47326 }
47327 }
47328 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047329 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047330#endif
47331
Daniel Veillarda82b1822004-11-08 16:24:57 +000047332 return(test_ret);
47333}
47334
47335
47336static int
47337test_xmlXPathTrailingSorted(void) {
47338 int test_ret = 0;
47339
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047340#ifdef LIBXML_XPATH_ENABLED
47341 int mem_base;
47342 xmlNodeSetPtr ret_val;
47343 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47344 int n_nodes1;
47345 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47346 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047347
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047348 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47349 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47350 mem_base = xmlMemBlocks();
47351 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47352 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47353
47354 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47355 desret_xmlNodeSetPtr(ret_val);
47356 call_tests++;
47357 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47358 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47359 xmlResetLastError();
47360 if (mem_base != xmlMemBlocks()) {
47361 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47362 xmlMemBlocks() - mem_base);
47363 test_ret++;
47364 printf(" %d", n_nodes1);
47365 printf(" %d", n_nodes2);
47366 printf("\n");
47367 }
47368 }
47369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047370 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047371#endif
47372
Daniel Veillarda82b1822004-11-08 16:24:57 +000047373 return(test_ret);
47374}
47375
47376
47377static int
47378test_xmlXPathTranslateFunction(void) {
47379 int test_ret = 0;
47380
47381#ifdef LIBXML_XPATH_ENABLED
47382 int mem_base;
47383 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47384 int n_ctxt;
47385 int nargs; /* the number of arguments */
47386 int n_nargs;
47387
47388 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47389 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47390 mem_base = xmlMemBlocks();
47391 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47392 nargs = gen_int(n_nargs, 1);
47393
47394 xmlXPathTranslateFunction(ctxt, nargs);
47395 call_tests++;
47396 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47397 des_int(n_nargs, nargs, 1);
47398 xmlResetLastError();
47399 if (mem_base != xmlMemBlocks()) {
47400 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47401 xmlMemBlocks() - mem_base);
47402 test_ret++;
47403 printf(" %d", n_ctxt);
47404 printf(" %d", n_nargs);
47405 printf("\n");
47406 }
47407 }
47408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047409 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047410#endif
47411
Daniel Veillarda82b1822004-11-08 16:24:57 +000047412 return(test_ret);
47413}
47414
47415
47416static int
47417test_xmlXPathTrueFunction(void) {
47418 int test_ret = 0;
47419
47420#ifdef LIBXML_XPATH_ENABLED
47421 int mem_base;
47422 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47423 int n_ctxt;
47424 int nargs; /* the number of arguments */
47425 int n_nargs;
47426
47427 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47428 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47429 mem_base = xmlMemBlocks();
47430 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47431 nargs = gen_int(n_nargs, 1);
47432
47433 xmlXPathTrueFunction(ctxt, nargs);
47434 call_tests++;
47435 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47436 des_int(n_nargs, nargs, 1);
47437 xmlResetLastError();
47438 if (mem_base != xmlMemBlocks()) {
47439 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47440 xmlMemBlocks() - mem_base);
47441 test_ret++;
47442 printf(" %d", n_ctxt);
47443 printf(" %d", n_nargs);
47444 printf("\n");
47445 }
47446 }
47447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047448 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047449#endif
47450
Daniel Veillarda82b1822004-11-08 16:24:57 +000047451 return(test_ret);
47452}
47453
47454
47455static int
47456test_xmlXPathValueFlipSign(void) {
47457 int test_ret = 0;
47458
47459#ifdef LIBXML_XPATH_ENABLED
47460 int mem_base;
47461 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47462 int n_ctxt;
47463
47464 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47465 mem_base = xmlMemBlocks();
47466 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47467
47468 xmlXPathValueFlipSign(ctxt);
47469 call_tests++;
47470 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47471 xmlResetLastError();
47472 if (mem_base != xmlMemBlocks()) {
47473 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47474 xmlMemBlocks() - mem_base);
47475 test_ret++;
47476 printf(" %d", n_ctxt);
47477 printf("\n");
47478 }
47479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047480 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047481#endif
47482
Daniel Veillarda82b1822004-11-08 16:24:57 +000047483 return(test_ret);
47484}
47485
47486
47487static int
47488test_xmlXPathVariableLookup(void) {
47489 int test_ret = 0;
47490
47491#ifdef LIBXML_XPATH_ENABLED
47492 int mem_base;
47493 xmlXPathObjectPtr ret_val;
47494 xmlXPathContextPtr ctxt; /* the XPath context */
47495 int n_ctxt;
47496 xmlChar * name; /* the variable name */
47497 int n_name;
47498
47499 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47500 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47501 mem_base = xmlMemBlocks();
47502 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47503 name = gen_const_xmlChar_ptr(n_name, 1);
47504
William M. Brackf13f77f2004-11-12 16:03:48 +000047505 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047506 desret_xmlXPathObjectPtr(ret_val);
47507 call_tests++;
47508 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047509 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047510 xmlResetLastError();
47511 if (mem_base != xmlMemBlocks()) {
47512 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47513 xmlMemBlocks() - mem_base);
47514 test_ret++;
47515 printf(" %d", n_ctxt);
47516 printf(" %d", n_name);
47517 printf("\n");
47518 }
47519 }
47520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047521 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047522#endif
47523
Daniel Veillarda82b1822004-11-08 16:24:57 +000047524 return(test_ret);
47525}
47526
47527
47528static int
47529test_xmlXPathVariableLookupNS(void) {
47530 int test_ret = 0;
47531
47532#ifdef LIBXML_XPATH_ENABLED
47533 int mem_base;
47534 xmlXPathObjectPtr ret_val;
47535 xmlXPathContextPtr ctxt; /* the XPath context */
47536 int n_ctxt;
47537 xmlChar * name; /* the variable name */
47538 int n_name;
47539 xmlChar * ns_uri; /* the variable namespace URI */
47540 int n_ns_uri;
47541
47542 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47543 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47544 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47545 mem_base = xmlMemBlocks();
47546 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47547 name = gen_const_xmlChar_ptr(n_name, 1);
47548 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47549
William M. Brackf13f77f2004-11-12 16:03:48 +000047550 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047551 desret_xmlXPathObjectPtr(ret_val);
47552 call_tests++;
47553 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047554 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47555 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047556 xmlResetLastError();
47557 if (mem_base != xmlMemBlocks()) {
47558 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47559 xmlMemBlocks() - mem_base);
47560 test_ret++;
47561 printf(" %d", n_ctxt);
47562 printf(" %d", n_name);
47563 printf(" %d", n_ns_uri);
47564 printf("\n");
47565 }
47566 }
47567 }
47568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047569 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047570#endif
47571
Daniel Veillarda82b1822004-11-08 16:24:57 +000047572 return(test_ret);
47573}
47574
47575
47576static int
47577test_xmlXPathWrapCString(void) {
47578 int test_ret = 0;
47579
47580#ifdef LIBXML_XPATH_ENABLED
47581 int mem_base;
47582 xmlXPathObjectPtr ret_val;
47583 char * val; /* the char * value */
47584 int n_val;
47585
47586 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47587 mem_base = xmlMemBlocks();
47588 val = gen_char_ptr(n_val, 0);
47589
47590 ret_val = xmlXPathWrapCString(val);
47591 desret_xmlXPathObjectPtr(ret_val);
47592 call_tests++;
47593 des_char_ptr(n_val, val, 0);
47594 xmlResetLastError();
47595 if (mem_base != xmlMemBlocks()) {
47596 printf("Leak of %d blocks found in xmlXPathWrapCString",
47597 xmlMemBlocks() - mem_base);
47598 test_ret++;
47599 printf(" %d", n_val);
47600 printf("\n");
47601 }
47602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047603 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047604#endif
47605
Daniel Veillarda82b1822004-11-08 16:24:57 +000047606 return(test_ret);
47607}
47608
47609
47610static int
47611test_xmlXPathWrapExternal(void) {
47612 int test_ret = 0;
47613
47614#ifdef LIBXML_XPATH_ENABLED
47615 int mem_base;
47616 xmlXPathObjectPtr ret_val;
47617 void * val; /* the user data */
47618 int n_val;
47619
47620 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47621 mem_base = xmlMemBlocks();
47622 val = gen_void_ptr(n_val, 0);
47623
47624 ret_val = xmlXPathWrapExternal(val);
47625 desret_xmlXPathObjectPtr(ret_val);
47626 call_tests++;
47627 des_void_ptr(n_val, val, 0);
47628 xmlResetLastError();
47629 if (mem_base != xmlMemBlocks()) {
47630 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47631 xmlMemBlocks() - mem_base);
47632 test_ret++;
47633 printf(" %d", n_val);
47634 printf("\n");
47635 }
47636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047637 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047638#endif
47639
Daniel Veillarda82b1822004-11-08 16:24:57 +000047640 return(test_ret);
47641}
47642
47643
47644static int
47645test_xmlXPathWrapNodeSet(void) {
47646 int test_ret = 0;
47647
47648#ifdef LIBXML_XPATH_ENABLED
47649 int mem_base;
47650 xmlXPathObjectPtr ret_val;
47651 xmlNodeSetPtr val; /* the NodePtr value */
47652 int n_val;
47653
47654 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47655 mem_base = xmlMemBlocks();
47656 val = gen_xmlNodeSetPtr(n_val, 0);
47657
47658 ret_val = xmlXPathWrapNodeSet(val);
47659 desret_xmlXPathObjectPtr(ret_val);
47660 call_tests++;
47661 des_xmlNodeSetPtr(n_val, val, 0);
47662 xmlResetLastError();
47663 if (mem_base != xmlMemBlocks()) {
47664 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47665 xmlMemBlocks() - mem_base);
47666 test_ret++;
47667 printf(" %d", n_val);
47668 printf("\n");
47669 }
47670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047671 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047672#endif
47673
Daniel Veillarda82b1822004-11-08 16:24:57 +000047674 return(test_ret);
47675}
47676
47677
47678static int
47679test_xmlXPatherror(void) {
47680 int test_ret = 0;
47681
47682#ifdef LIBXML_XPATH_ENABLED
47683 int mem_base;
47684 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47685 int n_ctxt;
47686 const char * file; /* the file name */
47687 int n_file;
47688 int line; /* the line number */
47689 int n_line;
47690 int no; /* the error number */
47691 int n_no;
47692
47693 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47694 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47695 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47696 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47697 mem_base = xmlMemBlocks();
47698 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47699 file = gen_filepath(n_file, 1);
47700 line = gen_int(n_line, 2);
47701 no = gen_int(n_no, 3);
47702
47703 xmlXPatherror(ctxt, file, line, no);
47704 call_tests++;
47705 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47706 des_filepath(n_file, file, 1);
47707 des_int(n_line, line, 2);
47708 des_int(n_no, no, 3);
47709 xmlResetLastError();
47710 if (mem_base != xmlMemBlocks()) {
47711 printf("Leak of %d blocks found in xmlXPatherror",
47712 xmlMemBlocks() - mem_base);
47713 test_ret++;
47714 printf(" %d", n_ctxt);
47715 printf(" %d", n_file);
47716 printf(" %d", n_line);
47717 printf(" %d", n_no);
47718 printf("\n");
47719 }
47720 }
47721 }
47722 }
47723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047724 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047725#endif
47726
Daniel Veillarda82b1822004-11-08 16:24:57 +000047727 return(test_ret);
47728}
47729
47730static int
47731test_xpathInternals(void) {
47732 int test_ret = 0;
47733
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047734 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047735 test_ret += test_valuePop();
47736 test_ret += test_valuePush();
47737 test_ret += test_xmlXPathAddValues();
47738 test_ret += test_xmlXPathBooleanFunction();
47739 test_ret += test_xmlXPathCeilingFunction();
47740 test_ret += test_xmlXPathCompareValues();
47741 test_ret += test_xmlXPathConcatFunction();
47742 test_ret += test_xmlXPathContainsFunction();
47743 test_ret += test_xmlXPathCountFunction();
47744 test_ret += test_xmlXPathDebugDumpCompExpr();
47745 test_ret += test_xmlXPathDebugDumpObject();
47746 test_ret += test_xmlXPathDifference();
47747 test_ret += test_xmlXPathDistinct();
47748 test_ret += test_xmlXPathDistinctSorted();
47749 test_ret += test_xmlXPathDivValues();
47750 test_ret += test_xmlXPathEqualValues();
47751 test_ret += test_xmlXPathErr();
47752 test_ret += test_xmlXPathEvalExpr();
47753 test_ret += test_xmlXPathEvaluatePredicateResult();
47754 test_ret += test_xmlXPathFalseFunction();
47755 test_ret += test_xmlXPathFloorFunction();
47756 test_ret += test_xmlXPathFunctionLookup();
47757 test_ret += test_xmlXPathFunctionLookupNS();
47758 test_ret += test_xmlXPathHasSameNodes();
47759 test_ret += test_xmlXPathIdFunction();
47760 test_ret += test_xmlXPathIntersection();
47761 test_ret += test_xmlXPathIsNodeType();
47762 test_ret += test_xmlXPathLangFunction();
47763 test_ret += test_xmlXPathLastFunction();
47764 test_ret += test_xmlXPathLeading();
47765 test_ret += test_xmlXPathLeadingSorted();
47766 test_ret += test_xmlXPathLocalNameFunction();
47767 test_ret += test_xmlXPathModValues();
47768 test_ret += test_xmlXPathMultValues();
47769 test_ret += test_xmlXPathNamespaceURIFunction();
47770 test_ret += test_xmlXPathNewBoolean();
47771 test_ret += test_xmlXPathNewCString();
47772 test_ret += test_xmlXPathNewFloat();
47773 test_ret += test_xmlXPathNewNodeSet();
47774 test_ret += test_xmlXPathNewNodeSetList();
47775 test_ret += test_xmlXPathNewParserContext();
47776 test_ret += test_xmlXPathNewString();
47777 test_ret += test_xmlXPathNextAncestor();
47778 test_ret += test_xmlXPathNextAncestorOrSelf();
47779 test_ret += test_xmlXPathNextAttribute();
47780 test_ret += test_xmlXPathNextChild();
47781 test_ret += test_xmlXPathNextDescendant();
47782 test_ret += test_xmlXPathNextDescendantOrSelf();
47783 test_ret += test_xmlXPathNextFollowing();
47784 test_ret += test_xmlXPathNextFollowingSibling();
47785 test_ret += test_xmlXPathNextNamespace();
47786 test_ret += test_xmlXPathNextParent();
47787 test_ret += test_xmlXPathNextPreceding();
47788 test_ret += test_xmlXPathNextPrecedingSibling();
47789 test_ret += test_xmlXPathNextSelf();
47790 test_ret += test_xmlXPathNodeLeading();
47791 test_ret += test_xmlXPathNodeLeadingSorted();
47792 test_ret += test_xmlXPathNodeSetAdd();
47793 test_ret += test_xmlXPathNodeSetAddNs();
47794 test_ret += test_xmlXPathNodeSetAddUnique();
47795 test_ret += test_xmlXPathNodeSetContains();
47796 test_ret += test_xmlXPathNodeSetDel();
47797 test_ret += test_xmlXPathNodeSetMerge();
47798 test_ret += test_xmlXPathNodeSetRemove();
47799 test_ret += test_xmlXPathNodeSetSort();
47800 test_ret += test_xmlXPathNodeTrailing();
47801 test_ret += test_xmlXPathNodeTrailingSorted();
47802 test_ret += test_xmlXPathNormalizeFunction();
47803 test_ret += test_xmlXPathNotEqualValues();
47804 test_ret += test_xmlXPathNotFunction();
47805 test_ret += test_xmlXPathNsLookup();
47806 test_ret += test_xmlXPathNumberFunction();
47807 test_ret += test_xmlXPathParseNCName();
47808 test_ret += test_xmlXPathParseName();
47809 test_ret += test_xmlXPathPopBoolean();
47810 test_ret += test_xmlXPathPopExternal();
47811 test_ret += test_xmlXPathPopNodeSet();
47812 test_ret += test_xmlXPathPopNumber();
47813 test_ret += test_xmlXPathPopString();
47814 test_ret += test_xmlXPathPositionFunction();
47815 test_ret += test_xmlXPathRegisterAllFunctions();
47816 test_ret += test_xmlXPathRegisterFunc();
47817 test_ret += test_xmlXPathRegisterFuncLookup();
47818 test_ret += test_xmlXPathRegisterFuncNS();
47819 test_ret += test_xmlXPathRegisterNs();
47820 test_ret += test_xmlXPathRegisterVariable();
47821 test_ret += test_xmlXPathRegisterVariableLookup();
47822 test_ret += test_xmlXPathRegisterVariableNS();
47823 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47824 test_ret += test_xmlXPathRegisteredNsCleanup();
47825 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47826 test_ret += test_xmlXPathRoot();
47827 test_ret += test_xmlXPathRoundFunction();
47828 test_ret += test_xmlXPathStartsWithFunction();
47829 test_ret += test_xmlXPathStringEvalNumber();
47830 test_ret += test_xmlXPathStringFunction();
47831 test_ret += test_xmlXPathStringLengthFunction();
47832 test_ret += test_xmlXPathSubValues();
47833 test_ret += test_xmlXPathSubstringAfterFunction();
47834 test_ret += test_xmlXPathSubstringBeforeFunction();
47835 test_ret += test_xmlXPathSubstringFunction();
47836 test_ret += test_xmlXPathSumFunction();
47837 test_ret += test_xmlXPathTrailing();
47838 test_ret += test_xmlXPathTrailingSorted();
47839 test_ret += test_xmlXPathTranslateFunction();
47840 test_ret += test_xmlXPathTrueFunction();
47841 test_ret += test_xmlXPathValueFlipSign();
47842 test_ret += test_xmlXPathVariableLookup();
47843 test_ret += test_xmlXPathVariableLookupNS();
47844 test_ret += test_xmlXPathWrapCString();
47845 test_ret += test_xmlXPathWrapExternal();
47846 test_ret += test_xmlXPathWrapNodeSet();
47847 test_ret += test_xmlXPatherror();
47848
47849 if (test_ret != 0)
47850 printf("Module xpathInternals: %d errors\n", test_ret);
47851 return(test_ret);
47852}
47853
Daniel Veillardd93f6252004-11-02 15:53:51 +000047854static int
47855test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047857
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047858#ifdef LIBXML_XPTR_ENABLED
47859 int mem_base;
47860 xmlNodePtr ret_val;
47861 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47862 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047863
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047864 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47865 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047866 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047867
47868 ret_val = xmlXPtrBuildNodeList(obj);
47869 desret_xmlNodePtr(ret_val);
47870 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047871 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047872 xmlResetLastError();
47873 if (mem_base != xmlMemBlocks()) {
47874 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047876 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047877 printf(" %d", n_obj);
47878 printf("\n");
47879 }
47880 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047881 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047882#endif
47883
Daniel Veillard42595322004-11-08 10:52:06 +000047884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047885}
47886
47887
47888static int
47889test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047891
Daniel Veillardce682bc2004-11-05 17:22:25 +000047892#ifdef LIBXML_XPTR_ENABLED
47893 int mem_base;
47894 xmlXPathObjectPtr ret_val;
47895 xmlChar * str; /* the XPointer expression */
47896 int n_str;
47897 xmlXPathContextPtr ctx; /* the XPointer context */
47898 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047899
Daniel Veillardce682bc2004-11-05 17:22:25 +000047900 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47901 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47902 mem_base = xmlMemBlocks();
47903 str = gen_const_xmlChar_ptr(n_str, 0);
47904 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47905
William M. Brackf13f77f2004-11-12 16:03:48 +000047906 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047907 desret_xmlXPathObjectPtr(ret_val);
47908 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047909 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047910 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47911 xmlResetLastError();
47912 if (mem_base != xmlMemBlocks()) {
47913 printf("Leak of %d blocks found in xmlXPtrEval",
47914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047915 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047916 printf(" %d", n_str);
47917 printf(" %d", n_ctx);
47918 printf("\n");
47919 }
47920 }
47921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047922 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047923#endif
47924
Daniel Veillard42595322004-11-08 10:52:06 +000047925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047926}
47927
47928
47929static int
47930test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047932
Daniel Veillardce682bc2004-11-05 17:22:25 +000047933#ifdef LIBXML_XPTR_ENABLED
47934 int mem_base;
47935 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47936 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047937
Daniel Veillardce682bc2004-11-05 17:22:25 +000047938 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47939 mem_base = xmlMemBlocks();
47940 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47941
47942 xmlXPtrEvalRangePredicate(ctxt);
47943 call_tests++;
47944 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47945 xmlResetLastError();
47946 if (mem_base != xmlMemBlocks()) {
47947 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047949 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047950 printf(" %d", n_ctxt);
47951 printf("\n");
47952 }
47953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047954 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047955#endif
47956
Daniel Veillard42595322004-11-08 10:52:06 +000047957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047958}
47959
Daniel Veillarda521d282004-11-09 14:59:59 +000047960#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000047961
Daniel Veillardce682bc2004-11-05 17:22:25 +000047962#define gen_nb_xmlLocationSetPtr 1
47963static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47964 return(NULL);
47965}
47966static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47967}
Daniel Veillarda521d282004-11-09 14:59:59 +000047968#endif
47969
Daniel Veillardce682bc2004-11-05 17:22:25 +000047970
Daniel Veillardd93f6252004-11-02 15:53:51 +000047971static int
47972test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047974
Daniel Veillardce682bc2004-11-05 17:22:25 +000047975#ifdef LIBXML_XPTR_ENABLED
47976 int mem_base;
47977 xmlLocationSetPtr cur; /* the initial range set */
47978 int n_cur;
47979 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
47980 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047981
Daniel Veillardce682bc2004-11-05 17:22:25 +000047982 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47983 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47984 mem_base = xmlMemBlocks();
47985 cur = gen_xmlLocationSetPtr(n_cur, 0);
47986 val = gen_xmlXPathObjectPtr(n_val, 1);
47987
47988 xmlXPtrLocationSetAdd(cur, val);
47989 call_tests++;
47990 des_xmlLocationSetPtr(n_cur, cur, 0);
47991 des_xmlXPathObjectPtr(n_val, val, 1);
47992 xmlResetLastError();
47993 if (mem_base != xmlMemBlocks()) {
47994 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
47995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047996 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047997 printf(" %d", n_cur);
47998 printf(" %d", n_val);
47999 printf("\n");
48000 }
48001 }
48002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048003 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048004#endif
48005
Daniel Veillard42595322004-11-08 10:52:06 +000048006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048007}
48008
48009
48010static int
48011test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048013
48014
48015 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048017}
48018
48019
48020static int
48021test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048023
Daniel Veillardce682bc2004-11-05 17:22:25 +000048024#ifdef LIBXML_XPTR_ENABLED
48025 int mem_base;
48026 xmlLocationSetPtr cur; /* the initial range set */
48027 int n_cur;
48028 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48029 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048030
Daniel Veillardce682bc2004-11-05 17:22:25 +000048031 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48032 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48033 mem_base = xmlMemBlocks();
48034 cur = gen_xmlLocationSetPtr(n_cur, 0);
48035 val = gen_xmlXPathObjectPtr(n_val, 1);
48036
48037 xmlXPtrLocationSetDel(cur, val);
48038 call_tests++;
48039 des_xmlLocationSetPtr(n_cur, cur, 0);
48040 des_xmlXPathObjectPtr(n_val, val, 1);
48041 xmlResetLastError();
48042 if (mem_base != xmlMemBlocks()) {
48043 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048045 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048046 printf(" %d", n_cur);
48047 printf(" %d", n_val);
48048 printf("\n");
48049 }
48050 }
48051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048052 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048053#endif
48054
Daniel Veillard42595322004-11-08 10:52:06 +000048055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048056}
48057
48058
48059static int
48060test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048062
48063
48064 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048066}
48067
48068
48069static int
48070test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048072
Daniel Veillardce682bc2004-11-05 17:22:25 +000048073#ifdef LIBXML_XPTR_ENABLED
48074 int mem_base;
48075 xmlLocationSetPtr cur; /* the initial range set */
48076 int n_cur;
48077 int val; /* the index to remove */
48078 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048079
Daniel Veillardce682bc2004-11-05 17:22:25 +000048080 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48081 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48082 mem_base = xmlMemBlocks();
48083 cur = gen_xmlLocationSetPtr(n_cur, 0);
48084 val = gen_int(n_val, 1);
48085
48086 xmlXPtrLocationSetRemove(cur, val);
48087 call_tests++;
48088 des_xmlLocationSetPtr(n_cur, cur, 0);
48089 des_int(n_val, val, 1);
48090 xmlResetLastError();
48091 if (mem_base != xmlMemBlocks()) {
48092 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048094 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048095 printf(" %d", n_cur);
48096 printf(" %d", n_val);
48097 printf("\n");
48098 }
48099 }
48100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048101 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048102#endif
48103
Daniel Veillard42595322004-11-08 10:52:06 +000048104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048105}
48106
48107
48108static int
48109test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048111
Daniel Veillard3d97e662004-11-04 10:49:00 +000048112#ifdef LIBXML_XPTR_ENABLED
48113 int mem_base;
48114 xmlXPathObjectPtr ret_val;
48115 xmlNodePtr start; /* the starting and ending node */
48116 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048117
Daniel Veillard3d97e662004-11-04 10:49:00 +000048118 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48119 mem_base = xmlMemBlocks();
48120 start = gen_xmlNodePtr(n_start, 0);
48121
48122 ret_val = xmlXPtrNewCollapsedRange(start);
48123 desret_xmlXPathObjectPtr(ret_val);
48124 call_tests++;
48125 des_xmlNodePtr(n_start, start, 0);
48126 xmlResetLastError();
48127 if (mem_base != xmlMemBlocks()) {
48128 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048130 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048131 printf(" %d", n_start);
48132 printf("\n");
48133 }
48134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048135 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048136#endif
48137
Daniel Veillard42595322004-11-08 10:52:06 +000048138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048139}
48140
48141
48142static int
48143test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048145
48146
48147 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048149}
48150
48151
48152static int
48153test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048155
Daniel Veillardce682bc2004-11-05 17:22:25 +000048156#ifdef LIBXML_XPTR_ENABLED
48157 int mem_base;
48158 xmlXPathObjectPtr ret_val;
48159 xmlNodeSetPtr set; /* a node set */
48160 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048161
Daniel Veillardce682bc2004-11-05 17:22:25 +000048162 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48163 mem_base = xmlMemBlocks();
48164 set = gen_xmlNodeSetPtr(n_set, 0);
48165
48166 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48167 desret_xmlXPathObjectPtr(ret_val);
48168 call_tests++;
48169 des_xmlNodeSetPtr(n_set, set, 0);
48170 xmlResetLastError();
48171 if (mem_base != xmlMemBlocks()) {
48172 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048174 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048175 printf(" %d", n_set);
48176 printf("\n");
48177 }
48178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048179 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048180#endif
48181
Daniel Veillard42595322004-11-08 10:52:06 +000048182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048183}
48184
48185
48186static int
48187test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048189
Daniel Veillard3d97e662004-11-04 10:49:00 +000048190#ifdef LIBXML_XPTR_ENABLED
48191 int mem_base;
48192 xmlXPathObjectPtr ret_val;
48193 xmlNodePtr start; /* the start NodePtr value */
48194 int n_start;
48195 xmlNodePtr end; /* the end NodePtr value or NULL */
48196 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048197
Daniel Veillard3d97e662004-11-04 10:49:00 +000048198 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48199 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48200 mem_base = xmlMemBlocks();
48201 start = gen_xmlNodePtr(n_start, 0);
48202 end = gen_xmlNodePtr(n_end, 1);
48203
48204 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48205 desret_xmlXPathObjectPtr(ret_val);
48206 call_tests++;
48207 des_xmlNodePtr(n_start, start, 0);
48208 des_xmlNodePtr(n_end, end, 1);
48209 xmlResetLastError();
48210 if (mem_base != xmlMemBlocks()) {
48211 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048213 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048214 printf(" %d", n_start);
48215 printf(" %d", n_end);
48216 printf("\n");
48217 }
48218 }
48219 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048220 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048221#endif
48222
Daniel Veillard42595322004-11-08 10:52:06 +000048223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048224}
48225
48226
48227static int
48228test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048230
Daniel Veillard3d97e662004-11-04 10:49:00 +000048231#ifdef LIBXML_XPTR_ENABLED
48232 int mem_base;
48233 xmlXPathObjectPtr ret_val;
48234 xmlNodePtr start; /* the starting node */
48235 int n_start;
48236 int startindex; /* the start index */
48237 int n_startindex;
48238 xmlNodePtr end; /* the ending point */
48239 int n_end;
48240 int endindex; /* the ending index */
48241 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048242
Daniel Veillard3d97e662004-11-04 10:49:00 +000048243 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48244 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48245 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48246 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48247 mem_base = xmlMemBlocks();
48248 start = gen_xmlNodePtr(n_start, 0);
48249 startindex = gen_int(n_startindex, 1);
48250 end = gen_xmlNodePtr(n_end, 2);
48251 endindex = gen_int(n_endindex, 3);
48252
48253 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48254 desret_xmlXPathObjectPtr(ret_val);
48255 call_tests++;
48256 des_xmlNodePtr(n_start, start, 0);
48257 des_int(n_startindex, startindex, 1);
48258 des_xmlNodePtr(n_end, end, 2);
48259 des_int(n_endindex, endindex, 3);
48260 xmlResetLastError();
48261 if (mem_base != xmlMemBlocks()) {
48262 printf("Leak of %d blocks found in xmlXPtrNewRange",
48263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048264 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048265 printf(" %d", n_start);
48266 printf(" %d", n_startindex);
48267 printf(" %d", n_end);
48268 printf(" %d", n_endindex);
48269 printf("\n");
48270 }
48271 }
48272 }
48273 }
48274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048275 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048276#endif
48277
Daniel Veillard42595322004-11-08 10:52:06 +000048278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048279}
48280
48281
48282static int
48283test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048285
Daniel Veillard3d97e662004-11-04 10:49:00 +000048286#ifdef LIBXML_XPTR_ENABLED
48287 int mem_base;
48288 xmlXPathObjectPtr ret_val;
48289 xmlNodePtr start; /* the starting node */
48290 int n_start;
48291 xmlXPathObjectPtr end; /* the ending object */
48292 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048293
Daniel Veillard3d97e662004-11-04 10:49:00 +000048294 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48295 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48296 mem_base = xmlMemBlocks();
48297 start = gen_xmlNodePtr(n_start, 0);
48298 end = gen_xmlXPathObjectPtr(n_end, 1);
48299
48300 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48301 desret_xmlXPathObjectPtr(ret_val);
48302 call_tests++;
48303 des_xmlNodePtr(n_start, start, 0);
48304 des_xmlXPathObjectPtr(n_end, end, 1);
48305 xmlResetLastError();
48306 if (mem_base != xmlMemBlocks()) {
48307 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048309 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048310 printf(" %d", n_start);
48311 printf(" %d", n_end);
48312 printf("\n");
48313 }
48314 }
48315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048316 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048317#endif
48318
Daniel Veillard42595322004-11-08 10:52:06 +000048319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048320}
48321
48322
48323static int
48324test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048326
Daniel Veillard3d97e662004-11-04 10:49:00 +000048327#ifdef LIBXML_XPTR_ENABLED
48328 int mem_base;
48329 xmlXPathObjectPtr ret_val;
48330 xmlNodePtr start; /* the starting node */
48331 int n_start;
48332 xmlXPathObjectPtr end; /* the ending point */
48333 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048334
Daniel Veillard3d97e662004-11-04 10:49:00 +000048335 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48336 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48337 mem_base = xmlMemBlocks();
48338 start = gen_xmlNodePtr(n_start, 0);
48339 end = gen_xmlXPathObjectPtr(n_end, 1);
48340
48341 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48342 desret_xmlXPathObjectPtr(ret_val);
48343 call_tests++;
48344 des_xmlNodePtr(n_start, start, 0);
48345 des_xmlXPathObjectPtr(n_end, end, 1);
48346 xmlResetLastError();
48347 if (mem_base != xmlMemBlocks()) {
48348 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048350 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048351 printf(" %d", n_start);
48352 printf(" %d", n_end);
48353 printf("\n");
48354 }
48355 }
48356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048357 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048358#endif
48359
Daniel Veillard42595322004-11-08 10:52:06 +000048360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048361}
48362
48363
48364static int
48365test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048367
Daniel Veillard3d97e662004-11-04 10:49:00 +000048368#ifdef LIBXML_XPTR_ENABLED
48369 int mem_base;
48370 xmlXPathObjectPtr ret_val;
48371 xmlNodePtr start; /* the starting node */
48372 int n_start;
48373 xmlNodePtr end; /* the ending node */
48374 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048375
Daniel Veillard3d97e662004-11-04 10:49:00 +000048376 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48377 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48378 mem_base = xmlMemBlocks();
48379 start = gen_xmlNodePtr(n_start, 0);
48380 end = gen_xmlNodePtr(n_end, 1);
48381
48382 ret_val = xmlXPtrNewRangeNodes(start, end);
48383 desret_xmlXPathObjectPtr(ret_val);
48384 call_tests++;
48385 des_xmlNodePtr(n_start, start, 0);
48386 des_xmlNodePtr(n_end, end, 1);
48387 xmlResetLastError();
48388 if (mem_base != xmlMemBlocks()) {
48389 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048391 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048392 printf(" %d", n_start);
48393 printf(" %d", n_end);
48394 printf("\n");
48395 }
48396 }
48397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048398 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048399#endif
48400
Daniel Veillard42595322004-11-08 10:52:06 +000048401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048402}
48403
48404
48405static int
48406test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048408
Daniel Veillard3d97e662004-11-04 10:49:00 +000048409#ifdef LIBXML_XPTR_ENABLED
48410 int mem_base;
48411 xmlXPathObjectPtr ret_val;
48412 xmlXPathObjectPtr start; /* the starting point */
48413 int n_start;
48414 xmlNodePtr end; /* the ending node */
48415 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048416
Daniel Veillard3d97e662004-11-04 10:49:00 +000048417 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48418 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48419 mem_base = xmlMemBlocks();
48420 start = gen_xmlXPathObjectPtr(n_start, 0);
48421 end = gen_xmlNodePtr(n_end, 1);
48422
48423 ret_val = xmlXPtrNewRangePointNode(start, end);
48424 desret_xmlXPathObjectPtr(ret_val);
48425 call_tests++;
48426 des_xmlXPathObjectPtr(n_start, start, 0);
48427 des_xmlNodePtr(n_end, end, 1);
48428 xmlResetLastError();
48429 if (mem_base != xmlMemBlocks()) {
48430 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048432 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048433 printf(" %d", n_start);
48434 printf(" %d", n_end);
48435 printf("\n");
48436 }
48437 }
48438 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048439 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048440#endif
48441
Daniel Veillard42595322004-11-08 10:52:06 +000048442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048443}
48444
48445
48446static int
48447test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048449
Daniel Veillard3d97e662004-11-04 10:49:00 +000048450#ifdef LIBXML_XPTR_ENABLED
48451 int mem_base;
48452 xmlXPathObjectPtr ret_val;
48453 xmlXPathObjectPtr start; /* the starting point */
48454 int n_start;
48455 xmlXPathObjectPtr end; /* the ending point */
48456 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048457
Daniel Veillard3d97e662004-11-04 10:49:00 +000048458 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48459 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48460 mem_base = xmlMemBlocks();
48461 start = gen_xmlXPathObjectPtr(n_start, 0);
48462 end = gen_xmlXPathObjectPtr(n_end, 1);
48463
48464 ret_val = xmlXPtrNewRangePoints(start, end);
48465 desret_xmlXPathObjectPtr(ret_val);
48466 call_tests++;
48467 des_xmlXPathObjectPtr(n_start, start, 0);
48468 des_xmlXPathObjectPtr(n_end, end, 1);
48469 xmlResetLastError();
48470 if (mem_base != xmlMemBlocks()) {
48471 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048473 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048474 printf(" %d", n_start);
48475 printf(" %d", n_end);
48476 printf("\n");
48477 }
48478 }
48479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048480 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048481#endif
48482
Daniel Veillard42595322004-11-08 10:52:06 +000048483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048484}
48485
48486
48487static int
48488test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048490
Daniel Veillardce682bc2004-11-05 17:22:25 +000048491#ifdef LIBXML_XPTR_ENABLED
48492 int mem_base;
48493 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48494 int n_ctxt;
48495 int nargs; /* the number of args */
48496 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048497
Daniel Veillardce682bc2004-11-05 17:22:25 +000048498 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48499 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48500 mem_base = xmlMemBlocks();
48501 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48502 nargs = gen_int(n_nargs, 1);
48503
48504 xmlXPtrRangeToFunction(ctxt, nargs);
48505 call_tests++;
48506 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48507 des_int(n_nargs, nargs, 1);
48508 xmlResetLastError();
48509 if (mem_base != xmlMemBlocks()) {
48510 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048512 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048513 printf(" %d", n_ctxt);
48514 printf(" %d", n_nargs);
48515 printf("\n");
48516 }
48517 }
48518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048519 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048520#endif
48521
Daniel Veillard42595322004-11-08 10:52:06 +000048522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048523}
48524
48525
48526static int
48527test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048529
Daniel Veillardce682bc2004-11-05 17:22:25 +000048530#ifdef LIBXML_XPTR_ENABLED
48531 int mem_base;
48532 xmlXPathObjectPtr ret_val;
48533 xmlLocationSetPtr val; /* the LocationSet value */
48534 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048535
Daniel Veillardce682bc2004-11-05 17:22:25 +000048536 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48537 mem_base = xmlMemBlocks();
48538 val = gen_xmlLocationSetPtr(n_val, 0);
48539
48540 ret_val = xmlXPtrWrapLocationSet(val);
48541 desret_xmlXPathObjectPtr(ret_val);
48542 call_tests++;
48543 des_xmlLocationSetPtr(n_val, val, 0);
48544 xmlResetLastError();
48545 if (mem_base != xmlMemBlocks()) {
48546 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048548 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048549 printf(" %d", n_val);
48550 printf("\n");
48551 }
48552 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048553 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048554#endif
48555
Daniel Veillard42595322004-11-08 10:52:06 +000048556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048557}
48558
48559static int
48560test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048562
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048563 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048564 test_ret += test_xmlXPtrBuildNodeList();
48565 test_ret += test_xmlXPtrEval();
48566 test_ret += test_xmlXPtrEvalRangePredicate();
48567 test_ret += test_xmlXPtrLocationSetAdd();
48568 test_ret += test_xmlXPtrLocationSetCreate();
48569 test_ret += test_xmlXPtrLocationSetDel();
48570 test_ret += test_xmlXPtrLocationSetMerge();
48571 test_ret += test_xmlXPtrLocationSetRemove();
48572 test_ret += test_xmlXPtrNewCollapsedRange();
48573 test_ret += test_xmlXPtrNewContext();
48574 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48575 test_ret += test_xmlXPtrNewLocationSetNodes();
48576 test_ret += test_xmlXPtrNewRange();
48577 test_ret += test_xmlXPtrNewRangeNodeObject();
48578 test_ret += test_xmlXPtrNewRangeNodePoint();
48579 test_ret += test_xmlXPtrNewRangeNodes();
48580 test_ret += test_xmlXPtrNewRangePointNode();
48581 test_ret += test_xmlXPtrNewRangePoints();
48582 test_ret += test_xmlXPtrRangeToFunction();
48583 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048584
Daniel Veillard42595322004-11-08 10:52:06 +000048585 if (test_ret != 0)
48586 printf("Module xpointer: %d errors\n", test_ret);
48587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048588}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048589static int
48590test_module(const char *module) {
48591 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48592 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048593 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048594 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048595 if (!strcmp(module, "catalog")) return(test_catalog());
48596 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048597 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048598 if (!strcmp(module, "dict")) return(test_dict());
48599 if (!strcmp(module, "encoding")) return(test_encoding());
48600 if (!strcmp(module, "entities")) return(test_entities());
48601 if (!strcmp(module, "hash")) return(test_hash());
48602 if (!strcmp(module, "list")) return(test_list());
48603 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48604 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48605 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048606 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048607 if (!strcmp(module, "pattern")) return(test_pattern());
48608 if (!strcmp(module, "relaxng")) return(test_relaxng());
48609 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48610 if (!strcmp(module, "tree")) return(test_tree());
48611 if (!strcmp(module, "uri")) return(test_uri());
48612 if (!strcmp(module, "valid")) return(test_valid());
48613 if (!strcmp(module, "xinclude")) return(test_xinclude());
48614 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048615 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048616 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
48617 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048618 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048619 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48620 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48621 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48622 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048623 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048624 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48625 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048626 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048627 if (!strcmp(module, "xpointer")) return(test_xpointer());
48628 return(0);
48629}