blob: c0f8025e61492c096e73307430c01d3090cb8317 [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
William M. Brackf13f77f2004-11-12 16:03:48 +0000190/*
191 We manually define xmlErrMemory because it's normal declaration
192 is "hidden" by #ifdef IN_LIBXML
193*/
194void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
195
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000196#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000197
Daniel Veillard3d97e662004-11-04 10:49:00 +0000198static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000199 return(NULL);
200}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000201static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000202}
203
Daniel Veillardce244ad2004-11-05 10:03:46 +0000204#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000205#define gen_nb_const_void_ptr 2
206
207static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
208 if (no == 0) return((const void *) "immutable string");
209 return(NULL);
210}
211static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
212}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000213#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000214
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000215#define gen_nb_userdata 3
216
Daniel Veillard3d97e662004-11-04 10:49:00 +0000217static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000218 if (no == 0) return((void *) &call_tests);
219 if (no == 1) return((void *) -1);
220 return(NULL);
221}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000222static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223}
224
225
Daniel Veillardd93f6252004-11-02 15:53:51 +0000226#define gen_nb_int 4
227
Daniel Veillard3d97e662004-11-04 10:49:00 +0000228static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
229 if (no == 0) return(0);
230 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000231 if (no == 2) return(-1);
232 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000233 return(-1);
234}
235
236static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
237}
238
Daniel Veillard6128c012004-11-08 17:16:15 +0000239#define gen_nb_parseroptions 5
240
241static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
242 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
243 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
244 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
245 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
246 return(XML_PARSE_SAX1);
247}
248
249static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
250}
251
Daniel Veillardce244ad2004-11-05 10:03:46 +0000252#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000253#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000254
255static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
256 if (no == 0) return(0);
257 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000258 if (no == 2) return(-1);
259 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000260 return(-1);
261}
262
263static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
264}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000265#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000266
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000267#define gen_nb_xmlChar 4
268
269static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
270 if (no == 0) return('a');
271 if (no == 1) return(' ');
272 if (no == 2) return('ø');
273 return(0);
274}
275
276static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
277}
278
Daniel Veillard3d97e662004-11-04 10:49:00 +0000279#define gen_nb_unsigned_int 3
280
281static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000282 if (no == 0) return(0);
283 if (no == 1) return(1);
284 if (no == 2) return(122);
285 return(-1);
286}
287
Daniel Veillard3d97e662004-11-04 10:49:00 +0000288static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000289}
290
Daniel Veillard3d95c732004-11-06 22:25:14 +0000291#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000292
293static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
294 if (no == 0) return(0);
295 if (no == 1) return(1);
296 if (no == 2) return(122);
297 return(-1);
298}
299
300static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
301}
302
Daniel Veillard3d95c732004-11-06 22:25:14 +0000303#define gen_nb_double 4
304
305static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
306 if (no == 0) return(0);
307 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000308#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000309 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000310#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311 return(-1);
312}
313
314static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
315}
316
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000317#define gen_nb_unsigned_long_ptr 2
318
319static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
320 if (no == 0) return(&longtab[nr]);
321 return(NULL);
322}
323
324static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
325}
326
327#define gen_nb_int_ptr 2
328
329static int *gen_int_ptr(int no, int nr) {
330 if (no == 0) return(&inttab[nr]);
331 return(NULL);
332}
333
334static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
335}
336
Daniel Veillardd93f6252004-11-02 15:53:51 +0000337#define gen_nb_const_char_ptr 4
338
Daniel Veillardce682bc2004-11-05 17:22:25 +0000339static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
340 if (no == 0) return((char *) "foo");
341 if (no == 1) return((char *) "<foo/>");
342 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000343 return(NULL);
344}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000345static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000346}
347
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000348#define gen_nb_xmlChar_ptr 2
349
Daniel Veillard3d97e662004-11-04 10:49:00 +0000350static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000351 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000352 return(NULL);
353}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000354static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000355}
356
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000357#define gen_nb_FILE_ptr 2
358
359static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
360 if (no == 0) return(fopen("test.out", "a+"));
361 return(NULL);
362}
363static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
364 if (val != NULL) fclose(val);
365}
366
Daniel Veillarda82b1822004-11-08 16:24:57 +0000367#define gen_nb_debug_FILE_ptr 2
368static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
369 return(fopen("test.out", "a+"));
370}
371static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillardd93f6252004-11-02 15:53:51 +0000375#define gen_nb_const_xmlChar_ptr 5
376
Daniel Veillardce682bc2004-11-05 17:22:25 +0000377static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
378 if (no == 0) return((xmlChar *) "foo");
379 if (no == 1) return((xmlChar *) "<foo/>");
380 if (no == 2) return((xmlChar *) "nøne");
381 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000382 return(NULL);
383}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000384static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000385}
386
387#define gen_nb_filepath 8
388
Daniel Veillard3d97e662004-11-04 10:49:00 +0000389static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 if (no == 0) return("missing.xml");
391 if (no == 1) return("<foo/>");
392 if (no == 2) return("test/ent2");
393 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000394 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000395 if (no == 5) return("http://missing.example.org/");
396 if (no == 6) return("http://missing. example.org/");
397 return(NULL);
398}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000399static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000400}
401
Daniel Veillard27f20102004-11-05 11:50:11 +0000402#define gen_nb_eaten_name 2
403
404static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000405 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000406 return(NULL);
407}
408static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
409}
410
Daniel Veillardd93f6252004-11-02 15:53:51 +0000411#define gen_nb_fileoutput 6
412
Daniel Veillard3d97e662004-11-04 10:49:00 +0000413static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000414 if (no == 0) return("/missing.xml");
415 if (no == 1) return("<foo/>");
416 if (no == 2) return("ftp://missing.example.org/foo");
417 if (no == 3) return("http://missing.example.org/");
418 if (no == 4) return("http://missing. example.org/");
419 return(NULL);
420}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422}
423
Daniel Veillarda521d282004-11-09 14:59:59 +0000424#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000425static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000426 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000427 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000428 return(NULL);
429}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000430static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000431 if (val != NULL)
432 xmlFreeParserCtxt(val);
433}
434
Daniel Veillard34099b42004-11-04 17:34:35 +0000435#define gen_nb_xmlSAXHandlerPtr 2
436static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000437#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000438 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000439#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000440 return(NULL);
441}
442static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
443}
444
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000445#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000446static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000448 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000449#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000450 return(NULL);
451}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000452static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000453#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000454 if (val != NULL)
455 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000456#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000457}
458
Daniel Veillard34099b42004-11-04 17:34:35 +0000459#define gen_nb_xmlParserInputBufferPtr 8
460
461static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
462 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
463 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
464 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
465 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
466 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
467 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
468 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
469 return(NULL);
470}
471static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
472 xmlFreeParserInputBuffer(val);
473}
474
Daniel Veillardd93f6252004-11-02 15:53:51 +0000475#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000476static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000477 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
478 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
479 return(NULL);
480}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000481static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000482 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483 xmlFreeDoc(val);
484}
485
Daniel Veillardce244ad2004-11-05 10:03:46 +0000486#define gen_nb_xmlAttrPtr 2
487static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
488 if (no == 0) return(get_api_attr());
489 return(NULL);
490}
491static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
492 if (no == 0) free_api_doc();
493}
494
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000495#define gen_nb_xmlDictPtr 2
496static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
497 if (no == 0) return(xmlDictCreate());
498 return(NULL);
499}
500static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
501 if (val != NULL)
502 xmlDictFree(val);
503}
504
Daniel Veillardce244ad2004-11-05 10:03:46 +0000505#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000506static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000507 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000508 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000509 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000510/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000511}
Daniel Veillard27f20102004-11-05 11:50:11 +0000512static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513 if (no == 1) free_api_doc();
514 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 xmlUnlinkNode(val);
516 xmlFreeNode(val);
517 }
518}
519
Daniel Veillard27f20102004-11-05 11:50:11 +0000520#define gen_nb_xmlDtdPtr 3
521static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000522 if (no == 0)
523 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000524 if (no == 1) return(get_api_dtd());
525 return(NULL);
526}
527static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
528 if (no == 1) free_api_doc();
529 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 xmlUnlinkNode((xmlNodePtr) val);
531 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 }
533}
534
535#define gen_nb_xmlNsPtr 2
536static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
537 if (no == 0) return(get_api_ns());
538 return(NULL);
539}
540static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
541 if (no == 0) free_api_doc();
542}
543
Daniel Veillardd93f6252004-11-02 15:53:51 +0000544#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000545static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000546 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
547 if (no == 0) return(xmlNewText(BAD_CAST "text"));
548 return(NULL);
549}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000550static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000551}
552
Daniel Veillardc8311492004-11-08 16:51:13 +0000553#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000554#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000555static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000556 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
557 return(NULL);
558}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000559static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000560 if (val != NULL) xmlFreeTextWriter(val);
561}
Daniel Veillardc8311492004-11-08 16:51:13 +0000562#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000563
Daniel Veillardc8311492004-11-08 16:51:13 +0000564#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000565#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000567 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
568 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
569 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
570 return(NULL);
571}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000572static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573 if (val != NULL) xmlFreeTextReader(val);
574}
Daniel Veillardc8311492004-11-08 16:51:13 +0000575#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000576
Daniel Veillard34099b42004-11-04 17:34:35 +0000577#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000578static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000579 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000580 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000581 return(NULL);
582}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000583static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000584 if (val != NULL) {
585 xmlBufferFree(val);
586 }
587}
588
589#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000590static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000591 if (no == 0) return(xmlListCreate(NULL, NULL));
592 return(NULL);
593}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000594static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000595 if (val != NULL) {
596 xmlListDelete(val);
597 }
598}
599
600#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000601static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000602 if (no == 0) return(xmlHashCreate(10));
603 return(NULL);
604}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000605static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000606 if (val != NULL) {
607 xmlHashFree(val, NULL);
608 }
609}
610
611#include <libxml/xpathInternals.h>
612
Daniel Veillardc8311492004-11-08 16:51:13 +0000613#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000615static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000616 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
617 if (no == 1) return(xmlXPathNewFloat(1.1));
618 if (no == 2) return(xmlXPathNewBoolean(1));
619 if (no == 3) return(xmlXPathNewNodeSet(NULL));
620 return(NULL);
621}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000622static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000623 if (val != NULL) {
624 xmlXPathFreeObject(val);
625 }
626}
Daniel Veillardc8311492004-11-08 16:51:13 +0000627#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000628
Daniel Veillardc8311492004-11-08 16:51:13 +0000629#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630#define gen_nb_xmlOutputBufferPtr 2
631static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
632 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
633 return(NULL);
634}
635static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
636 if (val != NULL) {
637 xmlOutputBufferClose(val);
638 }
639}
Daniel Veillardc8311492004-11-08 16:51:13 +0000640#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000641
Daniel Veillardc8311492004-11-08 16:51:13 +0000642#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000643#define gen_nb_xmlNanoFTPCtxtPtr 4
644static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
645 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
646 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
647 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
648 return(NULL);
649}
650static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
651 if (val != NULL) {
652 xmlNanoFTPFreeCtxt(val);
653 }
654}
Daniel Veillardc8311492004-11-08 16:51:13 +0000655#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000656
Daniel Veillardc8311492004-11-08 16:51:13 +0000657#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000658#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000659static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000660 return(NULL);
661}
662static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
663}
Daniel Veillardc8311492004-11-08 16:51:13 +0000664#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000665
Daniel Veillard3d97e662004-11-04 10:49:00 +0000666#define gen_nb_xmlCharEncoding 4
667static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
669 if (no == 1) return(XML_CHAR_ENCODING_NONE);
670 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
671 return(XML_CHAR_ENCODING_ERROR);
672}
673static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
674}
675
Daniel Veillard42595322004-11-08 10:52:06 +0000676#define gen_nb_xmlHashDeallocator 2
677static void
678test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
679}
680
681static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(test_xmlHashDeallocator);
683 return(NULL);
684}
685static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
686}
687
Daniel Veillardd93f6252004-11-02 15:53:51 +0000688
689static void desret_int(int val ATTRIBUTE_UNUSED) {
690}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000691static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
692}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000693static void desret_long(long val ATTRIBUTE_UNUSED) {
694}
William M. Brack094dd862004-11-14 14:28:34 +0000695static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
696}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000697static void desret_double(double val ATTRIBUTE_UNUSED) {
698}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000699static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
700}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000701#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000702static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
703}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000704#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000705static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
706}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000707static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
708}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000709static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000711static void desret_xmlChar_ptr(xmlChar *val) {
712 if (val != NULL)
713 xmlFree(val);
714}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000715static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000716 if (val != api_doc)
717 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000718}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000719static void desret_xmlDictPtr(xmlDictPtr val) {
720 xmlDictFree(val);
721}
Daniel Veillardc8311492004-11-08 16:51:13 +0000722#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000723static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
724 xmlOutputBufferClose(val);
725}
Daniel Veillardc8311492004-11-08 16:51:13 +0000726#endif
727#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000728static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
729 xmlFreeTextReader(val);
730}
Daniel Veillardc8311492004-11-08 16:51:13 +0000731#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000733 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
734 xmlUnlinkNode(val);
735 xmlFreeNode(val);
736 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000737}
Daniel Veillard57b25162004-11-06 14:50:18 +0000738static void desret_xmlAttrPtr(xmlAttrPtr val) {
739 if (val != NULL) {
740 xmlUnlinkNode((xmlNodePtr) val);
741 xmlFreeNode((xmlNodePtr) val);
742 }
743}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000744static void desret_xmlEntityPtr(xmlEntityPtr val) {
745 if (val != NULL) {
746 xmlUnlinkNode((xmlNodePtr) val);
747 xmlFreeNode((xmlNodePtr) val);
748 }
749}
Daniel Veillard42595322004-11-08 10:52:06 +0000750static void desret_xmlElementPtr(xmlElementPtr val) {
751 if (val != NULL) {
752 xmlUnlinkNode((xmlNodePtr) val);
753 }
754}
755static void desret_xmlAttributePtr(xmlAttributePtr val) {
756 if (val != NULL) {
757 xmlUnlinkNode((xmlNodePtr) val);
758 }
759}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000760static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
761}
Daniel Veillard34099b42004-11-04 17:34:35 +0000762static void desret_xmlDtdPtr(xmlDtdPtr val) {
763 desret_xmlNodePtr((xmlNodePtr)val);
764}
Daniel Veillardc8311492004-11-08 16:51:13 +0000765#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000766static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000767 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000768}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000769static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
770 xmlXPathFreeNodeSet(val);
771}
Daniel Veillardc8311492004-11-08 16:51:13 +0000772#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000773static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
774 xmlFreeParserCtxt(val);
775}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000776static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
777 xmlFreeParserInputBuffer(val);
778}
Daniel Veillard42595322004-11-08 10:52:06 +0000779static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
780 xmlFreeInputStream(val);
781}
Daniel Veillardc8311492004-11-08 16:51:13 +0000782#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000783static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
784 xmlFreeTextWriter(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000787static void desret_xmlBufferPtr(xmlBufferPtr val) {
788 xmlBufferFree(val);
789}
Daniel Veillardc8311492004-11-08 16:51:13 +0000790#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000791static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
792 xmlSchemaFreeParserCtxt(val);
793}
794static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
795}
796static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
797 xmlRelaxNGFreeParserCtxt(val);
798}
Daniel Veillardc8311492004-11-08 16:51:13 +0000799#endif
800#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000801static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000802}
Daniel Veillardc8311492004-11-08 16:51:13 +0000803#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000804
Daniel Veillarda521d282004-11-09 14:59:59 +0000805/* cut and pasted from autogenerated to avoid troubles */
806#define gen_nb_const_xmlChar_ptr_ptr 1
807static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
808 return(NULL);
809}
810static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
811}
812
813#define gen_nb_unsigned_char_ptr 1
814static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
815 return(NULL);
816}
817static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
818}
819
820#define gen_nb_const_unsigned_char_ptr 1
821static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
822 return(NULL);
823}
824static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
825}
826
827#ifdef LIBXML_HTML_ENABLED
828#define gen_nb_const_htmlNodePtr 1
829static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
830 return(NULL);
831}
832static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
833}
834#endif
835
836#ifdef LIBXML_HTML_ENABLED
837#define gen_nb_htmlDocPtr 3
838static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839 if (no == 0) return(htmlNewDoc(NULL, NULL));
840 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
841 return(NULL);
842}
843static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
844 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
845 xmlFreeDoc(val);
846}
847static void desret_htmlDocPtr(htmlDocPtr val) {
848 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
849 xmlFreeDoc(val);
850}
851#define gen_nb_htmlParserCtxtPtr 3
852static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
853 if (no == 0) return(xmlNewParserCtxt());
854 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
855 return(NULL);
856}
857static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
858 if (val != NULL)
859 htmlFreeParserCtxt(val);
860}
861static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
862 if (val != NULL)
863 htmlFreeParserCtxt(val);
864}
865#endif
866
867#ifdef LIBXML_XPATH_ENABLED
868#define gen_nb_xmlNodeSetPtr 1
869static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
870 return(NULL);
871}
872static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
873}
874#endif
875
876#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000877#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000878#define gen_nb_xmlShellCtxtPtr 1
879static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
880 return(NULL);
881}
882static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
883}
884#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000885#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000886
887#ifdef LIBXML_PATTERN_ENABLED
888#define gen_nb_xmlPatternPtr 1
889static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
890 return(NULL);
891}
892static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
893}
894#endif
895
William M. Brack094dd862004-11-14 14:28:34 +0000896#define gen_nb_xmlElementContentPtr 1
897static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
898 return(NULL);
899}
900static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
901 if (val != NULL)
902 xmlFreeElementContent(val);
903}
904static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
905 if (val != NULL)
906 xmlFreeElementContent(val);
907}
908
909#define gen_nb_xmlParserNodeInfoSeqPtr 1
910static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915
916static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
917}
918
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000919/************************************************************************
920 * *
921 * WARNING: end of the manually maintained part of the test code *
922 * do not remove or alter the CUT HERE line *
923 * *
924 ************************************************************************/
925
Daniel Veillard34099b42004-11-04 17:34:35 +0000926/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000927#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000928static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
929}
930
Daniel Veillarda521d282004-11-09 14:59:59 +0000931#endif
932
Daniel Veillard57b25162004-11-06 14:50:18 +0000933#define gen_nb_xmlAttributeDefault 4
934static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
935 if (no == 1) return(XML_ATTRIBUTE_FIXED);
936 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
937 if (no == 3) return(XML_ATTRIBUTE_NONE);
938 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
939 return(0);
940}
William M. Brack094dd862004-11-14 14:28:34 +0000941
Daniel Veillard57b25162004-11-06 14:50:18 +0000942static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
943}
Daniel Veillard57b25162004-11-06 14:50:18 +0000944
945#define gen_nb_xmlAttributeType 4
946static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
947 if (no == 1) return(XML_ATTRIBUTE_CDATA);
948 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
949 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
950 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
951 return(0);
952}
William M. Brack094dd862004-11-14 14:28:34 +0000953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
955}
Daniel Veillard57b25162004-11-06 14:50:18 +0000956
957#define gen_nb_xmlBufferAllocationScheme 3
958static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
959 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
960 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
961 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
962 return(0);
963}
William M. Brack094dd862004-11-14 14:28:34 +0000964
Daniel Veillard57b25162004-11-06 14:50:18 +0000965static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
966}
William M. Brack094dd862004-11-14 14:28:34 +0000967
Daniel Veillard57b25162004-11-06 14:50:18 +0000968static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
969}
970
Daniel Veillarda521d282004-11-09 14:59:59 +0000971#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000972#define gen_nb_xmlCatalogAllow 4
973static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
974 if (no == 1) return(XML_CATA_ALLOW_ALL);
975 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
976 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
977 if (no == 4) return(XML_CATA_ALLOW_NONE);
978 return(0);
979}
William M. Brack094dd862004-11-14 14:28:34 +0000980
Daniel Veillard57b25162004-11-06 14:50:18 +0000981static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
982}
William M. Brack094dd862004-11-14 14:28:34 +0000983
Daniel Veillard57b25162004-11-06 14:50:18 +0000984static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
985}
986
Daniel Veillarda521d282004-11-09 14:59:59 +0000987#endif
988
989#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000990#define gen_nb_xmlCatalogPrefer 3
991static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
992 if (no == 1) return(XML_CATA_PREFER_NONE);
993 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
994 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
995 return(0);
996}
William M. Brack094dd862004-11-14 14:28:34 +0000997
Daniel Veillard57b25162004-11-06 14:50:18 +0000998static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
999}
William M. Brack094dd862004-11-14 14:28:34 +00001000
Daniel Veillard57b25162004-11-06 14:50:18 +00001001static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1002}
1003
Daniel Veillarda521d282004-11-09 14:59:59 +00001004#endif
1005
Daniel Veillard57b25162004-11-06 14:50:18 +00001006#define gen_nb_xmlElementContentType 4
1007static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1008 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1009 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1010 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1011 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1012 return(0);
1013}
Daniel Veillard57b25162004-11-06 14:50:18 +00001014
William M. Brack094dd862004-11-14 14:28:34 +00001015static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001016}
1017
1018#define gen_nb_xmlElementTypeVal 4
1019static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1020 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1021 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1022 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1023 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1024 return(0);
1025}
William M. Brack094dd862004-11-14 14:28:34 +00001026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1028}
Daniel Veillard57b25162004-11-06 14:50:18 +00001029
Daniel Veillard57b25162004-11-06 14:50:18 +00001030static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1031}
1032
Daniel Veillarda521d282004-11-09 14:59:59 +00001033#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001034#define gen_nb_xmlSchemaValType 4
1035static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1036 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1037 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1038 if (no == 3) return(XML_SCHEMAS_ANYURI);
1039 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1040 return(0);
1041}
William M. Brack094dd862004-11-14 14:28:34 +00001042
Daniel Veillard57b25162004-11-06 14:50:18 +00001043static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1044}
Daniel Veillard57b25162004-11-06 14:50:18 +00001045
Daniel Veillarda521d282004-11-09 14:59:59 +00001046#endif
1047
Daniel Veillard34099b42004-11-04 17:34:35 +00001048#include <libxml/HTMLparser.h>
1049#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001050#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001051#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001052#include <libxml/catalog.h>
1053#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001054#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001055#include <libxml/dict.h>
1056#include <libxml/encoding.h>
1057#include <libxml/entities.h>
1058#include <libxml/hash.h>
1059#include <libxml/list.h>
1060#include <libxml/nanoftp.h>
1061#include <libxml/nanohttp.h>
1062#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001063#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001064#include <libxml/pattern.h>
1065#include <libxml/relaxng.h>
1066#include <libxml/schemasInternals.h>
1067#include <libxml/tree.h>
1068#include <libxml/uri.h>
1069#include <libxml/valid.h>
1070#include <libxml/xinclude.h>
1071#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001072#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001073#include <libxml/xmlerror.h>
1074#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001075#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001076#include <libxml/xmlsave.h>
1077#include <libxml/xmlschemas.h>
1078#include <libxml/xmlschemastypes.h>
1079#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001080#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001081#include <libxml/xmlwriter.h>
1082#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001083#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001084#include <libxml/xpointer.h>
1085static int test_HTMLparser(void);
1086static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001087static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001088static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001089static int test_catalog(void);
1090static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001091static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001092static int test_dict(void);
1093static int test_encoding(void);
1094static int test_entities(void);
1095static int test_hash(void);
1096static int test_list(void);
1097static int test_nanoftp(void);
1098static int test_nanohttp(void);
1099static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001100static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001101static int test_pattern(void);
1102static int test_relaxng(void);
1103static int test_schemasInternals(void);
1104static int test_tree(void);
1105static int test_uri(void);
1106static int test_valid(void);
1107static int test_xinclude(void);
1108static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001109static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001110static int test_xmlerror(void);
1111static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001112static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001113static int test_xmlsave(void);
1114static int test_xmlschemas(void);
1115static int test_xmlschemastypes(void);
1116static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001117static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001118static int test_xmlwriter(void);
1119static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001120static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001121static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001122
1123/**
1124 * testlibxml2:
1125 *
1126 * Main entry point of the tester for the full libxml2 module,
1127 * it calls all the tester entry point for each module.
1128 *
1129 * Returns the number of error found
1130 */
1131static int
1132testlibxml2(void)
1133{
Daniel Veillard42595322004-11-08 10:52:06 +00001134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001135
Daniel Veillard42595322004-11-08 10:52:06 +00001136 test_ret += test_HTMLparser();
1137 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001138 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001139 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001140 test_ret += test_catalog();
1141 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001142 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001143 test_ret += test_dict();
1144 test_ret += test_encoding();
1145 test_ret += test_entities();
1146 test_ret += test_hash();
1147 test_ret += test_list();
1148 test_ret += test_nanoftp();
1149 test_ret += test_nanohttp();
1150 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001151 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001152 test_ret += test_pattern();
1153 test_ret += test_relaxng();
1154 test_ret += test_schemasInternals();
1155 test_ret += test_tree();
1156 test_ret += test_uri();
1157 test_ret += test_valid();
1158 test_ret += test_xinclude();
1159 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001160 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001161 test_ret += test_xmlerror();
1162 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001163 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001164 test_ret += test_xmlsave();
1165 test_ret += test_xmlschemas();
1166 test_ret += test_xmlschemastypes();
1167 test_ret += test_xmlstring();
1168 test_ret += test_xmlunicode();
1169 test_ret += test_xmlwriter();
1170 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001171 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001172 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001173
Daniel Veillard3d97e662004-11-04 10:49:00 +00001174 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001175 function_tests, call_tests, test_ret);
1176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001177}
1178
1179
1180static int
1181test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001183
Daniel Veillardce682bc2004-11-05 17:22:25 +00001184#ifdef LIBXML_HTML_ENABLED
1185 int mem_base;
1186 int ret_val;
1187 unsigned char * out; /* a pointer to an array of bytes to store the result */
1188 int n_out;
1189 int * outlen; /* the length of @out */
1190 int n_outlen;
1191 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1192 int n_in;
1193 int * inlen; /* the length of @in */
1194 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001195
Daniel Veillardce682bc2004-11-05 17:22:25 +00001196 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1197 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1198 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1199 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1200 mem_base = xmlMemBlocks();
1201 out = gen_unsigned_char_ptr(n_out, 0);
1202 outlen = gen_int_ptr(n_outlen, 1);
1203 in = gen_const_unsigned_char_ptr(n_in, 2);
1204 inlen = gen_int_ptr(n_inlen, 3);
1205
William M. Brackf13f77f2004-11-12 16:03:48 +00001206 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001207 desret_int(ret_val);
1208 call_tests++;
1209 des_unsigned_char_ptr(n_out, out, 0);
1210 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001211 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001212 des_int_ptr(n_inlen, inlen, 3);
1213 xmlResetLastError();
1214 if (mem_base != xmlMemBlocks()) {
1215 printf("Leak of %d blocks found in UTF8ToHtml",
1216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001217 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001218 printf(" %d", n_out);
1219 printf(" %d", n_outlen);
1220 printf(" %d", n_in);
1221 printf(" %d", n_inlen);
1222 printf("\n");
1223 }
1224 }
1225 }
1226 }
1227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001228 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001229#endif
1230
Daniel Veillard42595322004-11-08 10:52:06 +00001231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001232}
1233
Daniel Veillarda521d282004-11-09 14:59:59 +00001234#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001235
Daniel Veillardce682bc2004-11-05 17:22:25 +00001236#define gen_nb_const_htmlElemDesc_ptr 1
1237static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1238 return(NULL);
1239}
1240static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1241}
Daniel Veillarda521d282004-11-09 14:59:59 +00001242#endif
1243
Daniel Veillardce682bc2004-11-05 17:22:25 +00001244
Daniel Veillardd93f6252004-11-02 15:53:51 +00001245static int
1246test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001248
Daniel Veillard57b25162004-11-06 14:50:18 +00001249#ifdef LIBXML_HTML_ENABLED
1250 int mem_base;
1251 htmlStatus ret_val;
1252 htmlElemDesc * elt; /* HTML element */
1253 int n_elt;
1254 xmlChar * attr; /* HTML attribute */
1255 int n_attr;
1256 int legacy; /* whether to allow deprecated attributes */
1257 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001258
Daniel Veillard57b25162004-11-06 14:50:18 +00001259 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1260 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1261 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1262 mem_base = xmlMemBlocks();
1263 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1264 attr = gen_const_xmlChar_ptr(n_attr, 1);
1265 legacy = gen_int(n_legacy, 2);
1266
William M. Brackf13f77f2004-11-12 16:03:48 +00001267 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001268 desret_htmlStatus(ret_val);
1269 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001270 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1271 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001272 des_int(n_legacy, legacy, 2);
1273 xmlResetLastError();
1274 if (mem_base != xmlMemBlocks()) {
1275 printf("Leak of %d blocks found in htmlAttrAllowed",
1276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001277 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001278 printf(" %d", n_elt);
1279 printf(" %d", n_attr);
1280 printf(" %d", n_legacy);
1281 printf("\n");
1282 }
1283 }
1284 }
1285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001286 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001287#endif
1288
Daniel Veillard42595322004-11-08 10:52:06 +00001289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001290}
1291
Daniel Veillarda521d282004-11-09 14:59:59 +00001292#ifdef LIBXML_HTML_ENABLED
1293
1294#define gen_nb_htmlNodePtr 1
1295static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1296 return(NULL);
1297}
1298static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1299}
1300#endif
1301
Daniel Veillardd93f6252004-11-02 15:53:51 +00001302
1303static int
1304test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001306
Daniel Veillarda03e3652004-11-02 18:45:30 +00001307#ifdef LIBXML_HTML_ENABLED
1308 int mem_base;
1309 int ret_val;
1310 htmlDocPtr doc; /* the HTML document */
1311 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001312 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001313 int n_name;
1314 htmlNodePtr elem; /* the HTML element */
1315 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001316
Daniel Veillarda521d282004-11-09 14:59:59 +00001317 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001318 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001319 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001320 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001321 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001322 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001323 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001324
William M. Brackf13f77f2004-11-12 16:03:48 +00001325 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001326 desret_int(ret_val);
1327 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001328 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001329 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001330 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001331 xmlResetLastError();
1332 if (mem_base != xmlMemBlocks()) {
1333 printf("Leak of %d blocks found in htmlAutoCloseTag",
1334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001335 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001336 printf(" %d", n_doc);
1337 printf(" %d", n_name);
1338 printf(" %d", n_elem);
1339 printf("\n");
1340 }
1341 }
1342 }
1343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001344 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001345#endif
1346
Daniel Veillard42595322004-11-08 10:52:06 +00001347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001348}
1349
1350
1351static int
1352test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001354
Daniel Veillard34099b42004-11-04 17:34:35 +00001355#ifdef LIBXML_HTML_ENABLED
1356 int mem_base;
1357 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001358 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001359 int n_buffer;
1360 int size; /* the size of the array */
1361 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001362
Daniel Veillard34099b42004-11-04 17:34:35 +00001363 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1364 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1365 mem_base = xmlMemBlocks();
1366 buffer = gen_const_char_ptr(n_buffer, 0);
1367 size = gen_int(n_size, 1);
1368
William M. Brackf13f77f2004-11-12 16:03:48 +00001369 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001370 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001371 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001372 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001373 des_int(n_size, size, 1);
1374 xmlResetLastError();
1375 if (mem_base != xmlMemBlocks()) {
1376 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001378 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001379 printf(" %d", n_buffer);
1380 printf(" %d", n_size);
1381 printf("\n");
1382 }
1383 }
1384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001385 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001386#endif
1387
Daniel Veillard42595322004-11-08 10:52:06 +00001388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001389}
1390
Daniel Veillarda521d282004-11-09 14:59:59 +00001391#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001392
Daniel Veillardce682bc2004-11-05 17:22:25 +00001393#define gen_nb_htmlSAXHandlerPtr 1
1394static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1395 return(NULL);
1396}
1397static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1398}
Daniel Veillarda521d282004-11-09 14:59:59 +00001399#endif
1400
Daniel Veillardce682bc2004-11-05 17:22:25 +00001401
Daniel Veillardd93f6252004-11-02 15:53:51 +00001402static int
1403test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001405
Daniel Veillardce682bc2004-11-05 17:22:25 +00001406#ifdef LIBXML_HTML_ENABLED
1407#ifdef LIBXML_PUSH_ENABLED
1408 int mem_base;
1409 htmlParserCtxtPtr ret_val;
1410 htmlSAXHandlerPtr sax; /* a SAX handler */
1411 int n_sax;
1412 void * user_data; /* The user data returned on SAX callbacks */
1413 int n_user_data;
1414 char * chunk; /* a pointer to an array of chars */
1415 int n_chunk;
1416 int size; /* number of chars in the array */
1417 int n_size;
1418 const char * filename; /* an optional file name or URI */
1419 int n_filename;
1420 xmlCharEncoding enc; /* an optional encoding */
1421 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001422
Daniel Veillardce682bc2004-11-05 17:22:25 +00001423 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1424 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1425 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1426 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001427 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001428 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1429 mem_base = xmlMemBlocks();
1430 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1431 user_data = gen_userdata(n_user_data, 1);
1432 chunk = gen_const_char_ptr(n_chunk, 2);
1433 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001434 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001435 enc = gen_xmlCharEncoding(n_enc, 5);
1436
William M. Brackf13f77f2004-11-12 16:03:48 +00001437 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001438 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001439 call_tests++;
1440 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1441 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001442 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001443 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001444 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001445 des_xmlCharEncoding(n_enc, enc, 5);
1446 xmlResetLastError();
1447 if (mem_base != xmlMemBlocks()) {
1448 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001450 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001451 printf(" %d", n_sax);
1452 printf(" %d", n_user_data);
1453 printf(" %d", n_chunk);
1454 printf(" %d", n_size);
1455 printf(" %d", n_filename);
1456 printf(" %d", n_enc);
1457 printf("\n");
1458 }
1459 }
1460 }
1461 }
1462 }
1463 }
1464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001465 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466#endif
1467#endif
1468
Daniel Veillard42595322004-11-08 10:52:06 +00001469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001470}
1471
1472
1473static int
1474test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001476
Daniel Veillarda03e3652004-11-02 18:45:30 +00001477#ifdef LIBXML_HTML_ENABLED
1478 int mem_base;
1479 htmlDocPtr ret_val;
1480 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1481 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001482 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001483 int n_cur;
1484 const char * URL; /* the base URL to use for the document */
1485 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001486 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001487 int n_encoding;
1488 int options; /* a combination of htmlParserOption(s) */
1489 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001490
Daniel Veillarda521d282004-11-09 14:59:59 +00001491 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001492 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1493 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1494 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1495 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1496 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001497 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001498 cur = gen_const_xmlChar_ptr(n_cur, 1);
1499 URL = gen_filepath(n_URL, 2);
1500 encoding = gen_const_char_ptr(n_encoding, 3);
1501 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001502
William M. Brackf13f77f2004-11-12 16:03:48 +00001503 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001504 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001505 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001506 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001507 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001508 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001509 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001510 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001511 xmlResetLastError();
1512 if (mem_base != xmlMemBlocks()) {
1513 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001515 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001516 printf(" %d", n_ctxt);
1517 printf(" %d", n_cur);
1518 printf(" %d", n_URL);
1519 printf(" %d", n_encoding);
1520 printf(" %d", n_options);
1521 printf("\n");
1522 }
1523 }
1524 }
1525 }
1526 }
1527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001528 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001529#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001530
Daniel Veillard42595322004-11-08 10:52:06 +00001531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001532}
1533
1534
1535static int
1536test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001538
Daniel Veillarda03e3652004-11-02 18:45:30 +00001539#ifdef LIBXML_HTML_ENABLED
Daniel Veillarda03e3652004-11-02 18:45:30 +00001540 htmlDocPtr ret_val;
1541 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1542 int n_ctxt;
1543 const char * filename; /* a file or URL */
1544 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001545 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001546 int n_encoding;
1547 int options; /* a combination of htmlParserOption(s) */
1548 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001549
Daniel Veillarda521d282004-11-09 14:59:59 +00001550 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001551 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1552 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1553 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001554 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001555 filename = gen_filepath(n_filename, 1);
1556 encoding = gen_const_char_ptr(n_encoding, 2);
1557 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001558
William M. Brackf13f77f2004-11-12 16:03:48 +00001559 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001560 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001561 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001562 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001563 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001564 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001565 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001566 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001567 }
1568 }
1569 }
1570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001571 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001572#endif
1573
Daniel Veillard42595322004-11-08 10:52:06 +00001574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001575}
1576
1577
1578static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001579test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001581
Daniel Veillarda03e3652004-11-02 18:45:30 +00001582#ifdef LIBXML_HTML_ENABLED
1583 int mem_base;
1584 htmlDocPtr ret_val;
1585 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1586 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001587 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001588 int n_buffer;
1589 int size; /* the size of the array */
1590 int n_size;
1591 const char * URL; /* the base URL to use for the document */
1592 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001593 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001594 int n_encoding;
1595 int options; /* a combination of htmlParserOption(s) */
1596 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001597
Daniel Veillarda521d282004-11-09 14:59:59 +00001598 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001599 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1600 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1601 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1602 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1603 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1604 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001605 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001606 buffer = gen_const_char_ptr(n_buffer, 1);
1607 size = gen_int(n_size, 2);
1608 URL = gen_filepath(n_URL, 3);
1609 encoding = gen_const_char_ptr(n_encoding, 4);
1610 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001611
William M. Brackf13f77f2004-11-12 16:03:48 +00001612 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001613 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001614 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001615 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001616 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001617 des_int(n_size, size, 2);
1618 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001619 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001620 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001621 xmlResetLastError();
1622 if (mem_base != xmlMemBlocks()) {
1623 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001625 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001626 printf(" %d", n_ctxt);
1627 printf(" %d", n_buffer);
1628 printf(" %d", n_size);
1629 printf(" %d", n_URL);
1630 printf(" %d", n_encoding);
1631 printf(" %d", n_options);
1632 printf("\n");
1633 }
1634 }
1635 }
1636 }
1637 }
1638 }
1639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001640 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001641#endif
1642
Daniel Veillard42595322004-11-08 10:52:06 +00001643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001644}
1645
1646
1647static int
1648test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001650
Daniel Veillarda03e3652004-11-02 18:45:30 +00001651#ifdef LIBXML_HTML_ENABLED
1652 int mem_base;
1653 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1654 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001655
Daniel Veillarda521d282004-11-09 14:59:59 +00001656 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001657 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001658 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001659
1660 htmlCtxtReset(ctxt);
1661 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001662 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001663 xmlResetLastError();
1664 if (mem_base != xmlMemBlocks()) {
1665 printf("Leak of %d blocks found in htmlCtxtReset",
1666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001667 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001668 printf(" %d", n_ctxt);
1669 printf("\n");
1670 }
1671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001672 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001673#endif
1674
Daniel Veillard42595322004-11-08 10:52:06 +00001675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001676}
1677
1678
1679static int
1680test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001682
Daniel Veillarda03e3652004-11-02 18:45:30 +00001683#ifdef LIBXML_HTML_ENABLED
1684 int mem_base;
1685 int ret_val;
1686 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1687 int n_ctxt;
1688 int options; /* a combination of htmlParserOption(s) */
1689 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001690
Daniel Veillarda521d282004-11-09 14:59:59 +00001691 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001692 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1693 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001694 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001695 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001696
1697 ret_val = htmlCtxtUseOptions(ctxt, options);
1698 desret_int(ret_val);
1699 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001700 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001701 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001702 xmlResetLastError();
1703 if (mem_base != xmlMemBlocks()) {
1704 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001706 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001707 printf(" %d", n_ctxt);
1708 printf(" %d", n_options);
1709 printf("\n");
1710 }
1711 }
1712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001713 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001714#endif
1715
Daniel Veillard42595322004-11-08 10:52:06 +00001716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001717}
1718
1719
1720static int
1721test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001723
Daniel Veillardce682bc2004-11-05 17:22:25 +00001724#ifdef LIBXML_HTML_ENABLED
1725 int mem_base;
1726 int ret_val;
1727 htmlElemDesc * parent; /* HTML parent element */
1728 int n_parent;
1729 xmlChar * elt; /* HTML element */
1730 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001731
Daniel Veillardce682bc2004-11-05 17:22:25 +00001732 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1733 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1734 mem_base = xmlMemBlocks();
1735 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1736 elt = gen_const_xmlChar_ptr(n_elt, 1);
1737
William M. Brackf13f77f2004-11-12 16:03:48 +00001738 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001739 desret_int(ret_val);
1740 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001741 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1742 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001743 xmlResetLastError();
1744 if (mem_base != xmlMemBlocks()) {
1745 printf("Leak of %d blocks found in htmlElementAllowedHere",
1746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001747 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001748 printf(" %d", n_parent);
1749 printf(" %d", n_elt);
1750 printf("\n");
1751 }
1752 }
1753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001754 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001755#endif
1756
Daniel Veillard42595322004-11-08 10:52:06 +00001757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001758}
1759
1760
1761static int
1762test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001764
Daniel Veillard57b25162004-11-06 14:50:18 +00001765#ifdef LIBXML_HTML_ENABLED
1766 int mem_base;
1767 htmlStatus ret_val;
1768 htmlElemDesc * parent; /* HTML parent element */
1769 int n_parent;
1770 htmlElemDesc * elt; /* HTML element */
1771 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001772
Daniel Veillard57b25162004-11-06 14:50:18 +00001773 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1774 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1775 mem_base = xmlMemBlocks();
1776 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1777 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1778
William M. Brackf13f77f2004-11-12 16:03:48 +00001779 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001780 desret_htmlStatus(ret_val);
1781 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001782 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1783 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001784 xmlResetLastError();
1785 if (mem_base != xmlMemBlocks()) {
1786 printf("Leak of %d blocks found in htmlElementStatusHere",
1787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001788 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001789 printf(" %d", n_parent);
1790 printf(" %d", n_elt);
1791 printf("\n");
1792 }
1793 }
1794 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001795 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001796#endif
1797
Daniel Veillard42595322004-11-08 10:52:06 +00001798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001799}
1800
1801
1802static int
1803test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001805
Daniel Veillardce682bc2004-11-05 17:22:25 +00001806#ifdef LIBXML_HTML_ENABLED
1807 int mem_base;
1808 int ret_val;
1809 unsigned char * out; /* a pointer to an array of bytes to store the result */
1810 int n_out;
1811 int * outlen; /* the length of @out */
1812 int n_outlen;
1813 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1814 int n_in;
1815 int * inlen; /* the length of @in */
1816 int n_inlen;
1817 int quoteChar; /* the quote character to escape (' or ") or zero. */
1818 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001819
Daniel Veillardce682bc2004-11-05 17:22:25 +00001820 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1821 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1822 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1823 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1824 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1825 mem_base = xmlMemBlocks();
1826 out = gen_unsigned_char_ptr(n_out, 0);
1827 outlen = gen_int_ptr(n_outlen, 1);
1828 in = gen_const_unsigned_char_ptr(n_in, 2);
1829 inlen = gen_int_ptr(n_inlen, 3);
1830 quoteChar = gen_int(n_quoteChar, 4);
1831
William M. Brackf13f77f2004-11-12 16:03:48 +00001832 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001833 desret_int(ret_val);
1834 call_tests++;
1835 des_unsigned_char_ptr(n_out, out, 0);
1836 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001837 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001838 des_int_ptr(n_inlen, inlen, 3);
1839 des_int(n_quoteChar, quoteChar, 4);
1840 xmlResetLastError();
1841 if (mem_base != xmlMemBlocks()) {
1842 printf("Leak of %d blocks found in htmlEncodeEntities",
1843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001844 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001845 printf(" %d", n_out);
1846 printf(" %d", n_outlen);
1847 printf(" %d", n_in);
1848 printf(" %d", n_inlen);
1849 printf(" %d", n_quoteChar);
1850 printf("\n");
1851 }
1852 }
1853 }
1854 }
1855 }
1856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001857 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001858#endif
1859
Daniel Veillard42595322004-11-08 10:52:06 +00001860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001861}
1862
1863
1864static int
1865test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001867
Daniel Veillard42595322004-11-08 10:52:06 +00001868#ifdef LIBXML_HTML_ENABLED
1869 int mem_base;
1870 const htmlEntityDesc * ret_val;
1871 xmlChar * name; /* the entity name */
1872 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001873
Daniel Veillard42595322004-11-08 10:52:06 +00001874 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1875 mem_base = xmlMemBlocks();
1876 name = gen_const_xmlChar_ptr(n_name, 0);
1877
William M. Brackf13f77f2004-11-12 16:03:48 +00001878 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001879 desret_const_htmlEntityDesc_ptr(ret_val);
1880 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001881 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001882 xmlResetLastError();
1883 if (mem_base != xmlMemBlocks()) {
1884 printf("Leak of %d blocks found in htmlEntityLookup",
1885 xmlMemBlocks() - mem_base);
1886 test_ret++;
1887 printf(" %d", n_name);
1888 printf("\n");
1889 }
1890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001891 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001892#endif
1893
Daniel Veillard42595322004-11-08 10:52:06 +00001894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001895}
1896
1897
1898static int
1899test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001901
Daniel Veillard42595322004-11-08 10:52:06 +00001902#ifdef LIBXML_HTML_ENABLED
1903 int mem_base;
1904 const htmlEntityDesc * ret_val;
1905 unsigned int value; /* the entity's unicode value */
1906 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001907
Daniel Veillard42595322004-11-08 10:52:06 +00001908 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1909 mem_base = xmlMemBlocks();
1910 value = gen_unsigned_int(n_value, 0);
1911
1912 ret_val = htmlEntityValueLookup(value);
1913 desret_const_htmlEntityDesc_ptr(ret_val);
1914 call_tests++;
1915 des_unsigned_int(n_value, value, 0);
1916 xmlResetLastError();
1917 if (mem_base != xmlMemBlocks()) {
1918 printf("Leak of %d blocks found in htmlEntityValueLookup",
1919 xmlMemBlocks() - mem_base);
1920 test_ret++;
1921 printf(" %d", n_value);
1922 printf("\n");
1923 }
1924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001925 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001926#endif
1927
Daniel Veillard42595322004-11-08 10:52:06 +00001928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001929}
1930
1931
1932static int
1933test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001935
1936#ifdef LIBXML_HTML_ENABLED
1937 int mem_base;
1938 int ret_val;
1939 int val; /* int 0 or 1 */
1940 int n_val;
1941
1942 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001944 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001945
1946 ret_val = htmlHandleOmittedElem(val);
1947 desret_int(ret_val);
1948 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001949 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001950 xmlResetLastError();
1951 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001952 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001954 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001955 printf(" %d", n_val);
1956 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001957 }
1958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001959 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001960#endif
1961
Daniel Veillard42595322004-11-08 10:52:06 +00001962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001963}
1964
1965
1966static int
1967test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001969
Daniel Veillarda03e3652004-11-02 18:45:30 +00001970#ifdef LIBXML_HTML_ENABLED
1971 int mem_base;
1972 int ret_val;
1973 htmlDocPtr doc; /* the HTML document */
1974 int n_doc;
1975 htmlNodePtr elem; /* the HTML element */
1976 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001977
Daniel Veillarda521d282004-11-09 14:59:59 +00001978 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
1979 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001980 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001981 doc = gen_htmlDocPtr(n_doc, 0);
1982 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001983
1984 ret_val = htmlIsAutoClosed(doc, elem);
1985 desret_int(ret_val);
1986 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001987 des_htmlDocPtr(n_doc, doc, 0);
1988 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001989 xmlResetLastError();
1990 if (mem_base != xmlMemBlocks()) {
1991 printf("Leak of %d blocks found in htmlIsAutoClosed",
1992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001993 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001994 printf(" %d", n_doc);
1995 printf(" %d", n_elem);
1996 printf("\n");
1997 }
1998 }
1999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002000 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002001#endif
2002
Daniel Veillard42595322004-11-08 10:52:06 +00002003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002004}
2005
2006
2007static int
2008test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002010
2011#ifdef LIBXML_HTML_ENABLED
2012 int mem_base;
2013 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002014 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002015 int n_name;
2016
2017 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2018 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002019 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002020
William M. Brackf13f77f2004-11-12 16:03:48 +00002021 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002022 desret_int(ret_val);
2023 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002024 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002025 xmlResetLastError();
2026 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002027 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002029 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002030 printf(" %d", n_name);
2031 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002032 }
2033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002034 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002035#endif
2036
Daniel Veillard42595322004-11-08 10:52:06 +00002037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002038}
2039
2040
2041static int
2042test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002044
Daniel Veillard57b25162004-11-06 14:50:18 +00002045#ifdef LIBXML_HTML_ENABLED
2046 int mem_base;
2047 htmlStatus ret_val;
2048 htmlNodePtr node; /* an htmlNodePtr in a tree */
2049 int n_node;
2050 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2051 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002052
Daniel Veillarda521d282004-11-09 14:59:59 +00002053 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002054 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2055 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002056 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002057 legacy = gen_int(n_legacy, 1);
2058
William M. Brackf13f77f2004-11-12 16:03:48 +00002059 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002060 desret_htmlStatus(ret_val);
2061 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002062 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002063 des_int(n_legacy, legacy, 1);
2064 xmlResetLastError();
2065 if (mem_base != xmlMemBlocks()) {
2066 printf("Leak of %d blocks found in htmlNodeStatus",
2067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002068 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002069 printf(" %d", n_node);
2070 printf(" %d", n_legacy);
2071 printf("\n");
2072 }
2073 }
2074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002075 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002076#endif
2077
Daniel Veillard42595322004-11-08 10:52:06 +00002078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002079}
2080
2081
2082static int
2083test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002085
Daniel Veillarda03e3652004-11-02 18:45:30 +00002086#ifdef LIBXML_HTML_ENABLED
2087 int mem_base;
2088 int ret_val;
2089 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2090 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002091
Daniel Veillarda521d282004-11-09 14:59:59 +00002092 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002093 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002094 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002095
2096 ret_val = htmlParseCharRef(ctxt);
2097 desret_int(ret_val);
2098 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002099 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002100 xmlResetLastError();
2101 if (mem_base != xmlMemBlocks()) {
2102 printf("Leak of %d blocks found in htmlParseCharRef",
2103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002104 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002105 printf(" %d", n_ctxt);
2106 printf("\n");
2107 }
2108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002109 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002110#endif
2111
Daniel Veillard42595322004-11-08 10:52:06 +00002112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002113}
2114
2115
2116static int
2117test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002119
Daniel Veillarda03e3652004-11-02 18:45:30 +00002120#ifdef LIBXML_HTML_ENABLED
2121#ifdef LIBXML_PUSH_ENABLED
2122 int mem_base;
2123 int ret_val;
2124 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2125 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002126 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002127 int n_chunk;
2128 int size; /* the size in byte of the chunk */
2129 int n_size;
2130 int terminate; /* last chunk indicator */
2131 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002132
Daniel Veillarda521d282004-11-09 14:59:59 +00002133 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002134 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2135 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2136 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2137 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002138 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002139 chunk = gen_const_char_ptr(n_chunk, 1);
2140 size = gen_int(n_size, 2);
2141 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142
William M. Brackf13f77f2004-11-12 16:03:48 +00002143 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002144 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002145 desret_int(ret_val);
2146 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002147 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002148 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002149 des_int(n_size, size, 2);
2150 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002151 xmlResetLastError();
2152 if (mem_base != xmlMemBlocks()) {
2153 printf("Leak of %d blocks found in htmlParseChunk",
2154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002156 printf(" %d", n_ctxt);
2157 printf(" %d", n_chunk);
2158 printf(" %d", n_size);
2159 printf(" %d", n_terminate);
2160 printf("\n");
2161 }
2162 }
2163 }
2164 }
2165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002166 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002167#endif
2168#endif
2169
Daniel Veillard42595322004-11-08 10:52:06 +00002170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002171}
2172
2173
2174static int
2175test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002177
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002178#ifdef LIBXML_HTML_ENABLED
2179 int mem_base;
2180 htmlDocPtr ret_val;
2181 xmlChar * cur; /* a pointer to an array of xmlChar */
2182 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002183 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002184 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002185
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002186 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2187 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2188 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002189 cur = gen_xmlChar_ptr(n_cur, 0);
2190 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002191
William M. Brackf13f77f2004-11-12 16:03:48 +00002192 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002193 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002194 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002195 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002196 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002197 xmlResetLastError();
2198 if (mem_base != xmlMemBlocks()) {
2199 printf("Leak of %d blocks found in htmlParseDoc",
2200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002201 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002202 printf(" %d", n_cur);
2203 printf(" %d", n_encoding);
2204 printf("\n");
2205 }
2206 }
2207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002208 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002209#endif
2210
Daniel Veillard42595322004-11-08 10:52:06 +00002211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002212}
2213
2214
2215static int
2216test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002218
Daniel Veillarda03e3652004-11-02 18:45:30 +00002219#ifdef LIBXML_HTML_ENABLED
2220 int mem_base;
2221 int ret_val;
2222 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2223 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002224
Daniel Veillarda521d282004-11-09 14:59:59 +00002225 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002226 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002227 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002228
2229 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002230 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002231 desret_int(ret_val);
2232 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002233 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002234 xmlResetLastError();
2235 if (mem_base != xmlMemBlocks()) {
2236 printf("Leak of %d blocks found in htmlParseDocument",
2237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002238 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002239 printf(" %d", n_ctxt);
2240 printf("\n");
2241 }
2242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002243 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002244#endif
2245
Daniel Veillard42595322004-11-08 10:52:06 +00002246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002247}
2248
2249
2250static int
2251test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002253
Daniel Veillarda03e3652004-11-02 18:45:30 +00002254#ifdef LIBXML_HTML_ENABLED
2255 int mem_base;
2256 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2257 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002258
Daniel Veillarda521d282004-11-09 14:59:59 +00002259 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002260 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002261 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002262
2263 htmlParseElement(ctxt);
2264 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002265 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002266 xmlResetLastError();
2267 if (mem_base != xmlMemBlocks()) {
2268 printf("Leak of %d blocks found in htmlParseElement",
2269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002270 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002271 printf(" %d", n_ctxt);
2272 printf("\n");
2273 }
2274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002275 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002276#endif
2277
Daniel Veillard42595322004-11-08 10:52:06 +00002278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002279}
2280
2281
2282static int
2283test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002285
Daniel Veillard42595322004-11-08 10:52:06 +00002286#ifdef LIBXML_HTML_ENABLED
2287 int mem_base;
2288 const htmlEntityDesc * ret_val;
2289 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2290 int n_ctxt;
2291 xmlChar ** str; /* location to store the entity name */
2292 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002293
Daniel Veillarda521d282004-11-09 14:59:59 +00002294 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002295 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2296 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002297 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002298 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2299
William M. Brackf13f77f2004-11-12 16:03:48 +00002300 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002301 desret_const_htmlEntityDesc_ptr(ret_val);
2302 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002303 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002304 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002305 xmlResetLastError();
2306 if (mem_base != xmlMemBlocks()) {
2307 printf("Leak of %d blocks found in htmlParseEntityRef",
2308 xmlMemBlocks() - mem_base);
2309 test_ret++;
2310 printf(" %d", n_ctxt);
2311 printf(" %d", n_str);
2312 printf("\n");
2313 }
2314 }
2315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002316 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002317#endif
2318
Daniel Veillard42595322004-11-08 10:52:06 +00002319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002320}
2321
2322
2323static int
2324test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002326
Daniel Veillarda03e3652004-11-02 18:45:30 +00002327#ifdef LIBXML_HTML_ENABLED
2328 htmlDocPtr ret_val;
2329 const char * filename; /* the filename */
2330 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002331 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002332 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002333
Daniel Veillarda03e3652004-11-02 18:45:30 +00002334 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2335 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002336 filename = gen_filepath(n_filename, 0);
2337 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002338
William M. Brackf13f77f2004-11-12 16:03:48 +00002339 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002340 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002341 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002342 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002343 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002344 xmlResetLastError();
2345 }
2346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002347 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002348#endif
2349
Daniel Veillard42595322004-11-08 10:52:06 +00002350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002351}
2352
2353
2354static int
2355test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002357
Daniel Veillarda03e3652004-11-02 18:45:30 +00002358#ifdef LIBXML_HTML_ENABLED
2359 int mem_base;
2360 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002361 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002362 int n_cur;
2363 const char * URL; /* the base URL to use for the document */
2364 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002365 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002366 int n_encoding;
2367 int options; /* a combination of htmlParserOption(s) */
2368 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002369
Daniel Veillarda03e3652004-11-02 18:45:30 +00002370 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2371 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2372 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2373 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2374 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002375 cur = gen_const_xmlChar_ptr(n_cur, 0);
2376 URL = gen_filepath(n_URL, 1);
2377 encoding = gen_const_char_ptr(n_encoding, 2);
2378 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002379
William M. Brackf13f77f2004-11-12 16:03:48 +00002380 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002381 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002382 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002383 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002384 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002385 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002386 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002387 xmlResetLastError();
2388 if (mem_base != xmlMemBlocks()) {
2389 printf("Leak of %d blocks found in htmlReadDoc",
2390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002391 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002392 printf(" %d", n_cur);
2393 printf(" %d", n_URL);
2394 printf(" %d", n_encoding);
2395 printf(" %d", n_options);
2396 printf("\n");
2397 }
2398 }
2399 }
2400 }
2401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002402 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002403#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002404
Daniel Veillard42595322004-11-08 10:52:06 +00002405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002406}
2407
2408
2409static int
2410test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002412
Daniel Veillarda03e3652004-11-02 18:45:30 +00002413#ifdef LIBXML_HTML_ENABLED
2414 int mem_base;
2415 htmlDocPtr ret_val;
2416 const char * filename; /* a file or URL */
2417 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002418 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002419 int n_encoding;
2420 int options; /* a combination of htmlParserOption(s) */
2421 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002422
Daniel Veillarda03e3652004-11-02 18:45:30 +00002423 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2424 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2425 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2426 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002427 filename = gen_filepath(n_filename, 0);
2428 encoding = gen_const_char_ptr(n_encoding, 1);
2429 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002430
William M. Brackf13f77f2004-11-12 16:03:48 +00002431 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002432 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002434 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002435 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002436 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002437 xmlResetLastError();
2438 if (mem_base != xmlMemBlocks()) {
2439 printf("Leak of %d blocks found in htmlReadFile",
2440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002441 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002442 printf(" %d", n_filename);
2443 printf(" %d", n_encoding);
2444 printf(" %d", n_options);
2445 printf("\n");
2446 }
2447 }
2448 }
2449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002450 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002451#endif
2452
Daniel Veillard42595322004-11-08 10:52:06 +00002453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002454}
2455
2456
2457static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002458test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002460
Daniel Veillarda03e3652004-11-02 18:45:30 +00002461#ifdef LIBXML_HTML_ENABLED
2462 int mem_base;
2463 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002464 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002465 int n_buffer;
2466 int size; /* the size of the array */
2467 int n_size;
2468 const char * URL; /* the base URL to use for the document */
2469 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002470 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002471 int n_encoding;
2472 int options; /* a combination of htmlParserOption(s) */
2473 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002474
Daniel Veillarda03e3652004-11-02 18:45:30 +00002475 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2476 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2477 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2478 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2479 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002481 buffer = gen_const_char_ptr(n_buffer, 0);
2482 size = gen_int(n_size, 1);
2483 URL = gen_filepath(n_URL, 2);
2484 encoding = gen_const_char_ptr(n_encoding, 3);
2485 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002486
William M. Brackf13f77f2004-11-12 16:03:48 +00002487 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002488 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002489 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002490 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002491 des_int(n_size, size, 1);
2492 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002493 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002494 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002495 xmlResetLastError();
2496 if (mem_base != xmlMemBlocks()) {
2497 printf("Leak of %d blocks found in htmlReadMemory",
2498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002500 printf(" %d", n_buffer);
2501 printf(" %d", n_size);
2502 printf(" %d", n_URL);
2503 printf(" %d", n_encoding);
2504 printf(" %d", n_options);
2505 printf("\n");
2506 }
2507 }
2508 }
2509 }
2510 }
2511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002512 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002513#endif
2514
Daniel Veillard42595322004-11-08 10:52:06 +00002515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002516}
2517
2518
2519static int
2520test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002522
Daniel Veillardce682bc2004-11-05 17:22:25 +00002523#ifdef LIBXML_HTML_ENABLED
2524 int mem_base;
2525 htmlDocPtr ret_val;
2526 xmlChar * cur; /* a pointer to an array of xmlChar */
2527 int n_cur;
2528 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2529 int n_encoding;
2530 htmlSAXHandlerPtr sax; /* the SAX handler block */
2531 int n_sax;
2532 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2533 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002534
Daniel Veillardce682bc2004-11-05 17:22:25 +00002535 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2536 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2537 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2538 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2539 mem_base = xmlMemBlocks();
2540 cur = gen_xmlChar_ptr(n_cur, 0);
2541 encoding = gen_const_char_ptr(n_encoding, 1);
2542 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2543 userData = gen_userdata(n_userData, 3);
2544
William M. Brackf13f77f2004-11-12 16:03:48 +00002545 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002546 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002547 call_tests++;
2548 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 Veillardce682bc2004-11-05 17:22:25 +00002550 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2551 des_userdata(n_userData, userData, 3);
2552 xmlResetLastError();
2553 if (mem_base != xmlMemBlocks()) {
2554 printf("Leak of %d blocks found in htmlSAXParseDoc",
2555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002556 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002557 printf(" %d", n_cur);
2558 printf(" %d", n_encoding);
2559 printf(" %d", n_sax);
2560 printf(" %d", n_userData);
2561 printf("\n");
2562 }
2563 }
2564 }
2565 }
2566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002567 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002568#endif
2569
Daniel Veillard42595322004-11-08 10:52:06 +00002570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002571}
2572
2573
2574static int
2575test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002577
Daniel Veillardce682bc2004-11-05 17:22:25 +00002578#ifdef LIBXML_HTML_ENABLED
2579 int mem_base;
2580 htmlDocPtr ret_val;
2581 const char * filename; /* the filename */
2582 int n_filename;
2583 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2584 int n_encoding;
2585 htmlSAXHandlerPtr sax; /* the SAX handler block */
2586 int n_sax;
2587 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2588 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002589
Daniel Veillardce682bc2004-11-05 17:22:25 +00002590 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2591 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2592 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2593 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2594 mem_base = xmlMemBlocks();
2595 filename = gen_filepath(n_filename, 0);
2596 encoding = gen_const_char_ptr(n_encoding, 1);
2597 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2598 userData = gen_userdata(n_userData, 3);
2599
William M. Brackf13f77f2004-11-12 16:03:48 +00002600 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002601 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002602 call_tests++;
2603 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002604 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002605 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2606 des_userdata(n_userData, userData, 3);
2607 xmlResetLastError();
2608 if (mem_base != xmlMemBlocks()) {
2609 printf("Leak of %d blocks found in htmlSAXParseFile",
2610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002611 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002612 printf(" %d", n_filename);
2613 printf(" %d", n_encoding);
2614 printf(" %d", n_sax);
2615 printf(" %d", n_userData);
2616 printf("\n");
2617 }
2618 }
2619 }
2620 }
2621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002622 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002623#endif
2624
Daniel Veillard42595322004-11-08 10:52:06 +00002625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002626}
2627
2628
2629static int
2630test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002632
2633
2634 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002636}
2637
2638static int
2639test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002641
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002642 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002643 test_ret += test_UTF8ToHtml();
2644 test_ret += test_htmlAttrAllowed();
2645 test_ret += test_htmlAutoCloseTag();
2646 test_ret += test_htmlCreateMemoryParserCtxt();
2647 test_ret += test_htmlCreatePushParserCtxt();
2648 test_ret += test_htmlCtxtReadDoc();
2649 test_ret += test_htmlCtxtReadFile();
2650 test_ret += test_htmlCtxtReadMemory();
2651 test_ret += test_htmlCtxtReset();
2652 test_ret += test_htmlCtxtUseOptions();
2653 test_ret += test_htmlElementAllowedHere();
2654 test_ret += test_htmlElementStatusHere();
2655 test_ret += test_htmlEncodeEntities();
2656 test_ret += test_htmlEntityLookup();
2657 test_ret += test_htmlEntityValueLookup();
2658 test_ret += test_htmlHandleOmittedElem();
2659 test_ret += test_htmlIsAutoClosed();
2660 test_ret += test_htmlIsScriptAttribute();
2661 test_ret += test_htmlNodeStatus();
2662 test_ret += test_htmlParseCharRef();
2663 test_ret += test_htmlParseChunk();
2664 test_ret += test_htmlParseDoc();
2665 test_ret += test_htmlParseDocument();
2666 test_ret += test_htmlParseElement();
2667 test_ret += test_htmlParseEntityRef();
2668 test_ret += test_htmlParseFile();
2669 test_ret += test_htmlReadDoc();
2670 test_ret += test_htmlReadFile();
2671 test_ret += test_htmlReadMemory();
2672 test_ret += test_htmlSAXParseDoc();
2673 test_ret += test_htmlSAXParseFile();
2674 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002675
Daniel Veillard42595322004-11-08 10:52:06 +00002676 if (test_ret != 0)
2677 printf("Module HTMLparser: %d errors\n", test_ret);
2678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002679}
2680
2681static int
2682test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002684
Daniel Veillard3d97e662004-11-04 10:49:00 +00002685#ifdef LIBXML_HTML_ENABLED
2686#ifdef LIBXML_OUTPUT_ENABLED
2687 int mem_base;
2688 xmlOutputBufferPtr buf; /* the HTML buffer output */
2689 int n_buf;
2690 xmlDocPtr cur; /* the document */
2691 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002692 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002693 int n_encoding;
2694 int format; /* should formatting spaces been added */
2695 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002696
Daniel Veillard3d97e662004-11-04 10:49:00 +00002697 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2698 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2699 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2700 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2701 mem_base = xmlMemBlocks();
2702 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2703 cur = gen_xmlDocPtr(n_cur, 1);
2704 encoding = gen_const_char_ptr(n_encoding, 2);
2705 format = gen_int(n_format, 3);
2706
William M. Brackf13f77f2004-11-12 16:03:48 +00002707 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002708 call_tests++;
2709 des_xmlOutputBufferPtr(n_buf, buf, 0);
2710 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002711 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002712 des_int(n_format, format, 3);
2713 xmlResetLastError();
2714 if (mem_base != xmlMemBlocks()) {
2715 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002717 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002718 printf(" %d", n_buf);
2719 printf(" %d", n_cur);
2720 printf(" %d", n_encoding);
2721 printf(" %d", n_format);
2722 printf("\n");
2723 }
2724 }
2725 }
2726 }
2727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002728 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002729#endif
2730#endif
2731
Daniel Veillard42595322004-11-08 10:52:06 +00002732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002733}
2734
2735
2736static int
2737test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002739
Daniel Veillard3d97e662004-11-04 10:49:00 +00002740#ifdef LIBXML_HTML_ENABLED
2741#ifdef LIBXML_OUTPUT_ENABLED
2742 int mem_base;
2743 xmlOutputBufferPtr buf; /* the HTML buffer output */
2744 int n_buf;
2745 xmlDocPtr cur; /* the document */
2746 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002747 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002748 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002749
Daniel Veillard3d97e662004-11-04 10:49:00 +00002750 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2751 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2752 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2753 mem_base = xmlMemBlocks();
2754 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2755 cur = gen_xmlDocPtr(n_cur, 1);
2756 encoding = gen_const_char_ptr(n_encoding, 2);
2757
William M. Brackf13f77f2004-11-12 16:03:48 +00002758 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002759 call_tests++;
2760 des_xmlOutputBufferPtr(n_buf, buf, 0);
2761 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002762 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002763 xmlResetLastError();
2764 if (mem_base != xmlMemBlocks()) {
2765 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002767 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002768 printf(" %d", n_buf);
2769 printf(" %d", n_cur);
2770 printf(" %d", n_encoding);
2771 printf("\n");
2772 }
2773 }
2774 }
2775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002776 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002777#endif
2778#endif
2779
Daniel Veillard42595322004-11-08 10:52:06 +00002780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002781}
2782
2783
2784static int
2785test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002787
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002788#ifdef LIBXML_HTML_ENABLED
2789#ifdef LIBXML_OUTPUT_ENABLED
2790 int mem_base;
2791 int ret_val;
2792 FILE * f; /* the FILE* */
2793 int n_f;
2794 xmlDocPtr cur; /* the document */
2795 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002796
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002797 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2798 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2799 mem_base = xmlMemBlocks();
2800 f = gen_FILE_ptr(n_f, 0);
2801 cur = gen_xmlDocPtr(n_cur, 1);
2802
2803 ret_val = htmlDocDump(f, cur);
2804 desret_int(ret_val);
2805 call_tests++;
2806 des_FILE_ptr(n_f, f, 0);
2807 des_xmlDocPtr(n_cur, cur, 1);
2808 xmlResetLastError();
2809 if (mem_base != xmlMemBlocks()) {
2810 printf("Leak of %d blocks found in htmlDocDump",
2811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002812 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002813 printf(" %d", n_f);
2814 printf(" %d", n_cur);
2815 printf("\n");
2816 }
2817 }
2818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002819 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002820#endif
2821#endif
2822
Daniel Veillard42595322004-11-08 10:52:06 +00002823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002824}
2825
2826
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002827#define gen_nb_xmlChar_ptr_ptr 1
2828static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2829 return(NULL);
2830}
2831static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2832}
2833
Daniel Veillardd93f6252004-11-02 15:53:51 +00002834static int
2835test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002837
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002838#ifdef LIBXML_HTML_ENABLED
2839#ifdef LIBXML_OUTPUT_ENABLED
2840 int mem_base;
2841 xmlDocPtr cur; /* the document */
2842 int n_cur;
2843 xmlChar ** mem; /* OUT: the memory pointer */
2844 int n_mem;
2845 int * size; /* OUT: the memory length */
2846 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002847
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002848 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2849 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2850 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2851 mem_base = xmlMemBlocks();
2852 cur = gen_xmlDocPtr(n_cur, 0);
2853 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2854 size = gen_int_ptr(n_size, 2);
2855
2856 htmlDocDumpMemory(cur, mem, size);
2857 call_tests++;
2858 des_xmlDocPtr(n_cur, cur, 0);
2859 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2860 des_int_ptr(n_size, size, 2);
2861 xmlResetLastError();
2862 if (mem_base != xmlMemBlocks()) {
2863 printf("Leak of %d blocks found in htmlDocDumpMemory",
2864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002865 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002866 printf(" %d", n_cur);
2867 printf(" %d", n_mem);
2868 printf(" %d", n_size);
2869 printf("\n");
2870 }
2871 }
2872 }
2873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002874 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002875#endif
2876#endif
2877
Daniel Veillard42595322004-11-08 10:52:06 +00002878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002879}
2880
2881
2882static int
2883test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002885
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002886#ifdef LIBXML_HTML_ENABLED
2887 int mem_base;
2888 const xmlChar * ret_val;
2889 htmlDocPtr doc; /* the document */
2890 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002891
Daniel Veillarda521d282004-11-09 14:59:59 +00002892 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002893 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002894 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002895
2896 ret_val = htmlGetMetaEncoding(doc);
2897 desret_const_xmlChar_ptr(ret_val);
2898 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002899 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002900 xmlResetLastError();
2901 if (mem_base != xmlMemBlocks()) {
2902 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002904 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002905 printf(" %d", n_doc);
2906 printf("\n");
2907 }
2908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002909 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002910#endif
2911
Daniel Veillard42595322004-11-08 10:52:06 +00002912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002913}
2914
2915
2916static int
2917test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002919
2920#ifdef LIBXML_HTML_ENABLED
2921 int mem_base;
2922 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002923 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002924 int n_name;
2925
2926 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002928 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002929
William M. Brackf13f77f2004-11-12 16:03:48 +00002930 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002931 desret_int(ret_val);
2932 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002933 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002934 xmlResetLastError();
2935 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002936 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002938 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002939 printf(" %d", n_name);
2940 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002941 }
2942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002943 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002944#endif
2945
Daniel Veillard42595322004-11-08 10:52:06 +00002946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002947}
2948
2949
2950static int
2951test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002953
Daniel Veillarda03e3652004-11-02 18:45:30 +00002954#ifdef LIBXML_HTML_ENABLED
2955 int mem_base;
2956 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002957 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002958 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002959 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002960 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002961
Daniel Veillarda03e3652004-11-02 18:45:30 +00002962 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2963 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2964 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002965 URI = gen_const_xmlChar_ptr(n_URI, 0);
2966 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002967
William M. Brackf13f77f2004-11-12 16:03:48 +00002968 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002969 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002970 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002971 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2972 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002973 xmlResetLastError();
2974 if (mem_base != xmlMemBlocks()) {
2975 printf("Leak of %d blocks found in htmlNewDoc",
2976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002977 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002978 printf(" %d", n_URI);
2979 printf(" %d", n_ExternalID);
2980 printf("\n");
2981 }
2982 }
2983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002984 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002985#endif
2986
Daniel Veillard42595322004-11-08 10:52:06 +00002987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002988}
2989
2990
2991static int
2992test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002994
Daniel Veillarda03e3652004-11-02 18:45:30 +00002995#ifdef LIBXML_HTML_ENABLED
2996 int mem_base;
2997 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002998 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002999 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003000 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003001 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003002
Daniel Veillarda03e3652004-11-02 18:45:30 +00003003 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3004 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003006 URI = gen_const_xmlChar_ptr(n_URI, 0);
3007 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003008
William M. Brackf13f77f2004-11-12 16:03:48 +00003009 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003010 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003011 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003012 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3013 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003014 xmlResetLastError();
3015 if (mem_base != xmlMemBlocks()) {
3016 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003018 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003019 printf(" %d", n_URI);
3020 printf(" %d", n_ExternalID);
3021 printf("\n");
3022 }
3023 }
3024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003025 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003026#endif
3027
Daniel Veillard42595322004-11-08 10:52:06 +00003028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003029}
3030
3031
3032static int
3033test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003035
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003036#ifdef LIBXML_HTML_ENABLED
3037#ifdef LIBXML_OUTPUT_ENABLED
3038 int mem_base;
3039 int ret_val;
3040 xmlBufferPtr buf; /* the HTML buffer output */
3041 int n_buf;
3042 xmlDocPtr doc; /* the document */
3043 int n_doc;
3044 xmlNodePtr cur; /* the current node */
3045 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003046
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003047 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3048 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3049 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003051 buf = gen_xmlBufferPtr(n_buf, 0);
3052 doc = gen_xmlDocPtr(n_doc, 1);
3053 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003054
3055 ret_val = htmlNodeDump(buf, doc, cur);
3056 desret_int(ret_val);
3057 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003058 des_xmlBufferPtr(n_buf, buf, 0);
3059 des_xmlDocPtr(n_doc, doc, 1);
3060 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003061 xmlResetLastError();
3062 if (mem_base != xmlMemBlocks()) {
3063 printf("Leak of %d blocks found in htmlNodeDump",
3064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003065 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003066 printf(" %d", n_buf);
3067 printf(" %d", n_doc);
3068 printf(" %d", n_cur);
3069 printf("\n");
3070 }
3071 }
3072 }
3073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003074 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003075#endif
3076#endif
3077
Daniel Veillard42595322004-11-08 10:52:06 +00003078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003079}
3080
3081
3082static int
3083test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003085
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003086#ifdef LIBXML_HTML_ENABLED
3087#ifdef LIBXML_OUTPUT_ENABLED
3088 int mem_base;
3089 FILE * out; /* the FILE pointer */
3090 int n_out;
3091 xmlDocPtr doc; /* the document */
3092 int n_doc;
3093 xmlNodePtr cur; /* the current node */
3094 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003095
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003096 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3097 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3098 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3099 mem_base = xmlMemBlocks();
3100 out = gen_FILE_ptr(n_out, 0);
3101 doc = gen_xmlDocPtr(n_doc, 1);
3102 cur = gen_xmlNodePtr(n_cur, 2);
3103
3104 htmlNodeDumpFile(out, doc, cur);
3105 call_tests++;
3106 des_FILE_ptr(n_out, out, 0);
3107 des_xmlDocPtr(n_doc, doc, 1);
3108 des_xmlNodePtr(n_cur, cur, 2);
3109 xmlResetLastError();
3110 if (mem_base != xmlMemBlocks()) {
3111 printf("Leak of %d blocks found in htmlNodeDumpFile",
3112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003113 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003114 printf(" %d", n_out);
3115 printf(" %d", n_doc);
3116 printf(" %d", n_cur);
3117 printf("\n");
3118 }
3119 }
3120 }
3121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003122 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003123#endif
3124#endif
3125
Daniel Veillard42595322004-11-08 10:52:06 +00003126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003127}
3128
3129
3130static int
3131test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003133
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003134#ifdef LIBXML_HTML_ENABLED
3135#ifdef LIBXML_OUTPUT_ENABLED
3136 int mem_base;
3137 int ret_val;
3138 FILE * out; /* the FILE pointer */
3139 int n_out;
3140 xmlDocPtr doc; /* the document */
3141 int n_doc;
3142 xmlNodePtr cur; /* the current node */
3143 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003144 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003145 int n_encoding;
3146 int format; /* should formatting spaces been added */
3147 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003148
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003149 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3150 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3151 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3152 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3153 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3154 mem_base = xmlMemBlocks();
3155 out = gen_FILE_ptr(n_out, 0);
3156 doc = gen_xmlDocPtr(n_doc, 1);
3157 cur = gen_xmlNodePtr(n_cur, 2);
3158 encoding = gen_const_char_ptr(n_encoding, 3);
3159 format = gen_int(n_format, 4);
3160
William M. Brackf13f77f2004-11-12 16:03:48 +00003161 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003162 desret_int(ret_val);
3163 call_tests++;
3164 des_FILE_ptr(n_out, out, 0);
3165 des_xmlDocPtr(n_doc, doc, 1);
3166 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003167 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003168 des_int(n_format, format, 4);
3169 xmlResetLastError();
3170 if (mem_base != xmlMemBlocks()) {
3171 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003173 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003174 printf(" %d", n_out);
3175 printf(" %d", n_doc);
3176 printf(" %d", n_cur);
3177 printf(" %d", n_encoding);
3178 printf(" %d", n_format);
3179 printf("\n");
3180 }
3181 }
3182 }
3183 }
3184 }
3185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003186 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003187#endif
3188#endif
3189
Daniel Veillard42595322004-11-08 10:52:06 +00003190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003191}
3192
3193
3194static int
3195test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003197
Daniel Veillard3d97e662004-11-04 10:49:00 +00003198#ifdef LIBXML_HTML_ENABLED
3199#ifdef LIBXML_OUTPUT_ENABLED
3200 int mem_base;
3201 xmlOutputBufferPtr buf; /* the HTML buffer output */
3202 int n_buf;
3203 xmlDocPtr doc; /* the document */
3204 int n_doc;
3205 xmlNodePtr cur; /* the current node */
3206 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003207 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003208 int n_encoding;
3209 int format; /* should formatting spaces been added */
3210 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003211
Daniel Veillard3d97e662004-11-04 10:49:00 +00003212 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3213 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3214 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3215 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3216 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3217 mem_base = xmlMemBlocks();
3218 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3219 doc = gen_xmlDocPtr(n_doc, 1);
3220 cur = gen_xmlNodePtr(n_cur, 2);
3221 encoding = gen_const_char_ptr(n_encoding, 3);
3222 format = gen_int(n_format, 4);
3223
William M. Brackf13f77f2004-11-12 16:03:48 +00003224 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003225 call_tests++;
3226 des_xmlOutputBufferPtr(n_buf, buf, 0);
3227 des_xmlDocPtr(n_doc, doc, 1);
3228 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003229 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003230 des_int(n_format, format, 4);
3231 xmlResetLastError();
3232 if (mem_base != xmlMemBlocks()) {
3233 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003235 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003236 printf(" %d", n_buf);
3237 printf(" %d", n_doc);
3238 printf(" %d", n_cur);
3239 printf(" %d", n_encoding);
3240 printf(" %d", n_format);
3241 printf("\n");
3242 }
3243 }
3244 }
3245 }
3246 }
3247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003248 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003249#endif
3250#endif
3251
Daniel Veillard42595322004-11-08 10:52:06 +00003252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003253}
3254
3255
3256static int
3257test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003259
Daniel Veillard3d97e662004-11-04 10:49:00 +00003260#ifdef LIBXML_HTML_ENABLED
3261#ifdef LIBXML_OUTPUT_ENABLED
3262 int mem_base;
3263 xmlOutputBufferPtr buf; /* the HTML buffer output */
3264 int n_buf;
3265 xmlDocPtr doc; /* the document */
3266 int n_doc;
3267 xmlNodePtr cur; /* the current node */
3268 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003269 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003271
Daniel Veillard3d97e662004-11-04 10:49:00 +00003272 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3273 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3274 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3275 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3276 mem_base = xmlMemBlocks();
3277 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3278 doc = gen_xmlDocPtr(n_doc, 1);
3279 cur = gen_xmlNodePtr(n_cur, 2);
3280 encoding = gen_const_char_ptr(n_encoding, 3);
3281
William M. Brackf13f77f2004-11-12 16:03:48 +00003282 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003283 call_tests++;
3284 des_xmlOutputBufferPtr(n_buf, buf, 0);
3285 des_xmlDocPtr(n_doc, doc, 1);
3286 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003287 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003288 xmlResetLastError();
3289 if (mem_base != xmlMemBlocks()) {
3290 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003292 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003293 printf(" %d", n_buf);
3294 printf(" %d", n_doc);
3295 printf(" %d", n_cur);
3296 printf(" %d", n_encoding);
3297 printf("\n");
3298 }
3299 }
3300 }
3301 }
3302 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003303 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003304#endif
3305#endif
3306
Daniel Veillard42595322004-11-08 10:52:06 +00003307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003308}
3309
3310
3311static int
3312test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003314
3315#ifdef LIBXML_HTML_ENABLED
3316#ifdef LIBXML_OUTPUT_ENABLED
3317 int mem_base;
3318 int ret_val;
3319 const char * filename; /* the filename (or URL) */
3320 int n_filename;
3321 xmlDocPtr cur; /* the document */
3322 int n_cur;
3323
3324 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3325 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003327 filename = gen_fileoutput(n_filename, 0);
3328 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003329
3330 ret_val = htmlSaveFile(filename, cur);
3331 desret_int(ret_val);
3332 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003333 des_fileoutput(n_filename, filename, 0);
3334 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003335 xmlResetLastError();
3336 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003337 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003339 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003340 printf(" %d", n_filename);
3341 printf(" %d", n_cur);
3342 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003343 }
3344 }
3345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003346 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003347#endif
3348#endif
3349
Daniel Veillard42595322004-11-08 10:52:06 +00003350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003351}
3352
3353
3354static int
3355test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003357
3358#ifdef LIBXML_HTML_ENABLED
3359#ifdef LIBXML_OUTPUT_ENABLED
3360 int mem_base;
3361 int ret_val;
3362 const char * filename; /* the filename */
3363 int n_filename;
3364 xmlDocPtr cur; /* the document */
3365 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003366 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003367 int n_encoding;
3368
3369 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3370 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3371 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003373 filename = gen_fileoutput(n_filename, 0);
3374 cur = gen_xmlDocPtr(n_cur, 1);
3375 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003376
William M. Brackf13f77f2004-11-12 16:03:48 +00003377 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003378 desret_int(ret_val);
3379 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003380 des_fileoutput(n_filename, filename, 0);
3381 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003382 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003383 xmlResetLastError();
3384 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003385 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003387 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003388 printf(" %d", n_filename);
3389 printf(" %d", n_cur);
3390 printf(" %d", n_encoding);
3391 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003392 }
3393 }
3394 }
3395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003396 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003397#endif
3398#endif
3399
Daniel Veillard42595322004-11-08 10:52:06 +00003400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003401}
3402
3403
3404static int
3405test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003407
3408#ifdef LIBXML_HTML_ENABLED
3409#ifdef LIBXML_OUTPUT_ENABLED
3410 int mem_base;
3411 int ret_val;
3412 const char * filename; /* the filename */
3413 int n_filename;
3414 xmlDocPtr cur; /* the document */
3415 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003416 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003417 int n_encoding;
3418 int format; /* should formatting spaces been added */
3419 int n_format;
3420
3421 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3422 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3423 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3424 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003426 filename = gen_fileoutput(n_filename, 0);
3427 cur = gen_xmlDocPtr(n_cur, 1);
3428 encoding = gen_const_char_ptr(n_encoding, 2);
3429 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003430
William M. Brackf13f77f2004-11-12 16:03:48 +00003431 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003432 desret_int(ret_val);
3433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003434 des_fileoutput(n_filename, filename, 0);
3435 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003436 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003437 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003438 xmlResetLastError();
3439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003440 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003443 printf(" %d", n_filename);
3444 printf(" %d", n_cur);
3445 printf(" %d", n_encoding);
3446 printf(" %d", n_format);
3447 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003448 }
3449 }
3450 }
3451 }
3452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003453 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003454#endif
3455#endif
3456
Daniel Veillard42595322004-11-08 10:52:06 +00003457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003458}
3459
3460
3461static int
3462test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003464
Daniel Veillarda03e3652004-11-02 18:45:30 +00003465#ifdef LIBXML_HTML_ENABLED
3466 int mem_base;
3467 int ret_val;
3468 htmlDocPtr doc; /* the document */
3469 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003470 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003471 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003472
Daniel Veillarda521d282004-11-09 14:59:59 +00003473 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003474 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3475 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003476 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003477 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003478
William M. Brackf13f77f2004-11-12 16:03:48 +00003479 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003480 desret_int(ret_val);
3481 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003482 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003483 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003484 xmlResetLastError();
3485 if (mem_base != xmlMemBlocks()) {
3486 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003488 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003489 printf(" %d", n_doc);
3490 printf(" %d", n_encoding);
3491 printf("\n");
3492 }
3493 }
3494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003495 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003496#endif
3497
Daniel Veillard42595322004-11-08 10:52:06 +00003498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003499}
3500
3501static int
3502test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003504
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003505 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003506 test_ret += test_htmlDocContentDumpFormatOutput();
3507 test_ret += test_htmlDocContentDumpOutput();
3508 test_ret += test_htmlDocDump();
3509 test_ret += test_htmlDocDumpMemory();
3510 test_ret += test_htmlGetMetaEncoding();
3511 test_ret += test_htmlIsBooleanAttr();
3512 test_ret += test_htmlNewDoc();
3513 test_ret += test_htmlNewDocNoDtD();
3514 test_ret += test_htmlNodeDump();
3515 test_ret += test_htmlNodeDumpFile();
3516 test_ret += test_htmlNodeDumpFileFormat();
3517 test_ret += test_htmlNodeDumpFormatOutput();
3518 test_ret += test_htmlNodeDumpOutput();
3519 test_ret += test_htmlSaveFile();
3520 test_ret += test_htmlSaveFileEnc();
3521 test_ret += test_htmlSaveFileFormat();
3522 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003523
Daniel Veillard42595322004-11-08 10:52:06 +00003524 if (test_ret != 0)
3525 printf("Module HTMLtree: %d errors\n", test_ret);
3526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003527}
3528
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003529static int
3530test_docbDefaultSAXHandlerInit(void) {
3531 int test_ret = 0;
3532
Daniel Veillarda521d282004-11-09 14:59:59 +00003533#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003534 int mem_base;
3535
3536 mem_base = xmlMemBlocks();
3537
3538 docbDefaultSAXHandlerInit();
3539 call_tests++;
3540 xmlResetLastError();
3541 if (mem_base != xmlMemBlocks()) {
3542 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3543 xmlMemBlocks() - mem_base);
3544 test_ret++;
3545 printf("\n");
3546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003547 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003548#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003549
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003550 return(test_ret);
3551}
3552
3553
3554static int
3555test_htmlDefaultSAXHandlerInit(void) {
3556 int test_ret = 0;
3557
Daniel Veillarda521d282004-11-09 14:59:59 +00003558#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003559 int mem_base;
3560
3561 mem_base = xmlMemBlocks();
3562
3563 htmlDefaultSAXHandlerInit();
3564 call_tests++;
3565 xmlResetLastError();
3566 if (mem_base != xmlMemBlocks()) {
3567 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3568 xmlMemBlocks() - mem_base);
3569 test_ret++;
3570 printf("\n");
3571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003572 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003573#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003574
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003575 return(test_ret);
3576}
3577
3578
3579static int
3580test_xmlDefaultSAXHandlerInit(void) {
3581 int test_ret = 0;
3582
3583 int mem_base;
3584
3585 mem_base = xmlMemBlocks();
3586
3587 xmlDefaultSAXHandlerInit();
3588 call_tests++;
3589 xmlResetLastError();
3590 if (mem_base != xmlMemBlocks()) {
3591 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3592 xmlMemBlocks() - mem_base);
3593 test_ret++;
3594 printf("\n");
3595 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003596 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003597
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003598 return(test_ret);
3599}
3600
3601
3602#define gen_nb_xmlEnumerationPtr 1
3603static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3604 return(NULL);
3605}
3606static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3607}
3608
3609static int
3610test_xmlSAX2AttributeDecl(void) {
3611 int test_ret = 0;
3612
3613 int mem_base;
3614 void * ctx; /* the user data (XML parser context) */
3615 int n_ctx;
3616 xmlChar * elem; /* the name of the element */
3617 int n_elem;
3618 xmlChar * fullname; /* the attribute name */
3619 int n_fullname;
3620 int type; /* the attribute type */
3621 int n_type;
3622 int def; /* the type of default value */
3623 int n_def;
3624 xmlChar * defaultValue; /* the attribute default value */
3625 int n_defaultValue;
3626 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3627 int n_tree;
3628
3629 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3630 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3631 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3632 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3633 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3634 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3635 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3636 mem_base = xmlMemBlocks();
3637 ctx = gen_void_ptr(n_ctx, 0);
3638 elem = gen_const_xmlChar_ptr(n_elem, 1);
3639 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3640 type = gen_int(n_type, 3);
3641 def = gen_int(n_def, 4);
3642 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3643 tree = gen_xmlEnumerationPtr(n_tree, 6);
3644
William M. Brackf13f77f2004-11-12 16:03:48 +00003645 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003646 call_tests++;
3647 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003648 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3649 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003650 des_int(n_type, type, 3);
3651 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003652 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003653 des_xmlEnumerationPtr(n_tree, tree, 6);
3654 xmlResetLastError();
3655 if (mem_base != xmlMemBlocks()) {
3656 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3657 xmlMemBlocks() - mem_base);
3658 test_ret++;
3659 printf(" %d", n_ctx);
3660 printf(" %d", n_elem);
3661 printf(" %d", n_fullname);
3662 printf(" %d", n_type);
3663 printf(" %d", n_def);
3664 printf(" %d", n_defaultValue);
3665 printf(" %d", n_tree);
3666 printf("\n");
3667 }
3668 }
3669 }
3670 }
3671 }
3672 }
3673 }
3674 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003676
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003677 return(test_ret);
3678}
3679
3680
3681static int
3682test_xmlSAX2CDataBlock(void) {
3683 int test_ret = 0;
3684
3685 int mem_base;
3686 void * ctx; /* the user data (XML parser context) */
3687 int n_ctx;
3688 xmlChar * value; /* The pcdata content */
3689 int n_value;
3690 int len; /* the block length */
3691 int n_len;
3692
3693 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3694 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3695 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3696 mem_base = xmlMemBlocks();
3697 ctx = gen_void_ptr(n_ctx, 0);
3698 value = gen_const_xmlChar_ptr(n_value, 1);
3699 len = gen_int(n_len, 2);
3700
William M. Brackf13f77f2004-11-12 16:03:48 +00003701 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003702 call_tests++;
3703 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003704 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003705 des_int(n_len, len, 2);
3706 xmlResetLastError();
3707 if (mem_base != xmlMemBlocks()) {
3708 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3709 xmlMemBlocks() - mem_base);
3710 test_ret++;
3711 printf(" %d", n_ctx);
3712 printf(" %d", n_value);
3713 printf(" %d", n_len);
3714 printf("\n");
3715 }
3716 }
3717 }
3718 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003719 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003720
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003721 return(test_ret);
3722}
3723
3724
3725static int
3726test_xmlSAX2Characters(void) {
3727 int test_ret = 0;
3728
3729 int mem_base;
3730 void * ctx; /* the user data (XML parser context) */
3731 int n_ctx;
3732 xmlChar * ch; /* a xmlChar string */
3733 int n_ch;
3734 int len; /* the number of xmlChar */
3735 int n_len;
3736
3737 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3738 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3739 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3740 mem_base = xmlMemBlocks();
3741 ctx = gen_void_ptr(n_ctx, 0);
3742 ch = gen_const_xmlChar_ptr(n_ch, 1);
3743 len = gen_int(n_len, 2);
3744
William M. Brackf13f77f2004-11-12 16:03:48 +00003745 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003746 call_tests++;
3747 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003748 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003749 des_int(n_len, len, 2);
3750 xmlResetLastError();
3751 if (mem_base != xmlMemBlocks()) {
3752 printf("Leak of %d blocks found in xmlSAX2Characters",
3753 xmlMemBlocks() - mem_base);
3754 test_ret++;
3755 printf(" %d", n_ctx);
3756 printf(" %d", n_ch);
3757 printf(" %d", n_len);
3758 printf("\n");
3759 }
3760 }
3761 }
3762 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003763 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003764
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003765 return(test_ret);
3766}
3767
3768
3769static int
3770test_xmlSAX2Comment(void) {
3771 int test_ret = 0;
3772
3773 int mem_base;
3774 void * ctx; /* the user data (XML parser context) */
3775 int n_ctx;
3776 xmlChar * value; /* the xmlSAX2Comment content */
3777 int n_value;
3778
3779 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3780 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3781 mem_base = xmlMemBlocks();
3782 ctx = gen_void_ptr(n_ctx, 0);
3783 value = gen_const_xmlChar_ptr(n_value, 1);
3784
William M. Brackf13f77f2004-11-12 16:03:48 +00003785 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003786 call_tests++;
3787 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003788 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003789 xmlResetLastError();
3790 if (mem_base != xmlMemBlocks()) {
3791 printf("Leak of %d blocks found in xmlSAX2Comment",
3792 xmlMemBlocks() - mem_base);
3793 test_ret++;
3794 printf(" %d", n_ctx);
3795 printf(" %d", n_value);
3796 printf("\n");
3797 }
3798 }
3799 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003800 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003801
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003802 return(test_ret);
3803}
3804
3805
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003806static int
3807test_xmlSAX2ElementDecl(void) {
3808 int test_ret = 0;
3809
3810 int mem_base;
3811 void * ctx; /* the user data (XML parser context) */
3812 int n_ctx;
3813 xmlChar * name; /* the element name */
3814 int n_name;
3815 int type; /* the element type */
3816 int n_type;
3817 xmlElementContentPtr content; /* the element value tree */
3818 int n_content;
3819
3820 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3821 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3822 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3823 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3824 mem_base = xmlMemBlocks();
3825 ctx = gen_void_ptr(n_ctx, 0);
3826 name = gen_const_xmlChar_ptr(n_name, 1);
3827 type = gen_int(n_type, 2);
3828 content = gen_xmlElementContentPtr(n_content, 3);
3829
William M. Brackf13f77f2004-11-12 16:03:48 +00003830 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003831 call_tests++;
3832 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003833 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003834 des_int(n_type, type, 2);
3835 des_xmlElementContentPtr(n_content, content, 3);
3836 xmlResetLastError();
3837 if (mem_base != xmlMemBlocks()) {
3838 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3839 xmlMemBlocks() - mem_base);
3840 test_ret++;
3841 printf(" %d", n_ctx);
3842 printf(" %d", n_name);
3843 printf(" %d", n_type);
3844 printf(" %d", n_content);
3845 printf("\n");
3846 }
3847 }
3848 }
3849 }
3850 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003851 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003852
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003853 return(test_ret);
3854}
3855
3856
3857static int
3858test_xmlSAX2EndDocument(void) {
3859 int test_ret = 0;
3860
3861 int mem_base;
3862 void * ctx; /* the user data (XML parser context) */
3863 int n_ctx;
3864
3865 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3866 mem_base = xmlMemBlocks();
3867 ctx = gen_void_ptr(n_ctx, 0);
3868
3869 xmlSAX2EndDocument(ctx);
3870 call_tests++;
3871 des_void_ptr(n_ctx, ctx, 0);
3872 xmlResetLastError();
3873 if (mem_base != xmlMemBlocks()) {
3874 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3875 xmlMemBlocks() - mem_base);
3876 test_ret++;
3877 printf(" %d", n_ctx);
3878 printf("\n");
3879 }
3880 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003881 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003882
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003883 return(test_ret);
3884}
3885
3886
3887static int
3888test_xmlSAX2EndElement(void) {
3889 int test_ret = 0;
3890
Daniel Veillarda521d282004-11-09 14:59:59 +00003891#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003892 int mem_base;
3893 void * ctx; /* the user data (XML parser context) */
3894 int n_ctx;
3895 xmlChar * name; /* The element name */
3896 int n_name;
3897
3898 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3899 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3900 mem_base = xmlMemBlocks();
3901 ctx = gen_void_ptr(n_ctx, 0);
3902 name = gen_const_xmlChar_ptr(n_name, 1);
3903
William M. Brackf13f77f2004-11-12 16:03:48 +00003904 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003905 call_tests++;
3906 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003907 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003908 xmlResetLastError();
3909 if (mem_base != xmlMemBlocks()) {
3910 printf("Leak of %d blocks found in xmlSAX2EndElement",
3911 xmlMemBlocks() - mem_base);
3912 test_ret++;
3913 printf(" %d", n_ctx);
3914 printf(" %d", n_name);
3915 printf("\n");
3916 }
3917 }
3918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003919 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003920#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003921
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003922 return(test_ret);
3923}
3924
3925
3926static int
3927test_xmlSAX2EndElementNs(void) {
3928 int test_ret = 0;
3929
3930 int mem_base;
3931 void * ctx; /* the user data (XML parser context) */
3932 int n_ctx;
3933 xmlChar * localname; /* the local name of the element */
3934 int n_localname;
3935 xmlChar * prefix; /* the element namespace prefix if available */
3936 int n_prefix;
3937 xmlChar * URI; /* the element namespace name if available */
3938 int n_URI;
3939
3940 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3941 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3942 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3943 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3944 mem_base = xmlMemBlocks();
3945 ctx = gen_void_ptr(n_ctx, 0);
3946 localname = gen_const_xmlChar_ptr(n_localname, 1);
3947 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3948 URI = gen_const_xmlChar_ptr(n_URI, 3);
3949
William M. Brackf13f77f2004-11-12 16:03:48 +00003950 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003951 call_tests++;
3952 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003953 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3954 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3955 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003956 xmlResetLastError();
3957 if (mem_base != xmlMemBlocks()) {
3958 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3959 xmlMemBlocks() - mem_base);
3960 test_ret++;
3961 printf(" %d", n_ctx);
3962 printf(" %d", n_localname);
3963 printf(" %d", n_prefix);
3964 printf(" %d", n_URI);
3965 printf("\n");
3966 }
3967 }
3968 }
3969 }
3970 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003971 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003972
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003973 return(test_ret);
3974}
3975
3976
3977static int
3978test_xmlSAX2EntityDecl(void) {
3979 int test_ret = 0;
3980
3981 int mem_base;
3982 void * ctx; /* the user data (XML parser context) */
3983 int n_ctx;
3984 xmlChar * name; /* the entity name */
3985 int n_name;
3986 int type; /* the entity type */
3987 int n_type;
3988 xmlChar * publicId; /* The public ID of the entity */
3989 int n_publicId;
3990 xmlChar * systemId; /* The system ID of the entity */
3991 int n_systemId;
3992 xmlChar * content; /* the entity value (without processing). */
3993 int n_content;
3994
3995 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3996 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3997 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3998 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
3999 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4000 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4001 mem_base = xmlMemBlocks();
4002 ctx = gen_void_ptr(n_ctx, 0);
4003 name = gen_const_xmlChar_ptr(n_name, 1);
4004 type = gen_int(n_type, 2);
4005 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4006 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4007 content = gen_xmlChar_ptr(n_content, 5);
4008
William M. Brackf13f77f2004-11-12 16:03:48 +00004009 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004010 call_tests++;
4011 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004012 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004013 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004014 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4015 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004016 des_xmlChar_ptr(n_content, content, 5);
4017 xmlResetLastError();
4018 if (mem_base != xmlMemBlocks()) {
4019 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4020 xmlMemBlocks() - mem_base);
4021 test_ret++;
4022 printf(" %d", n_ctx);
4023 printf(" %d", n_name);
4024 printf(" %d", n_type);
4025 printf(" %d", n_publicId);
4026 printf(" %d", n_systemId);
4027 printf(" %d", n_content);
4028 printf("\n");
4029 }
4030 }
4031 }
4032 }
4033 }
4034 }
4035 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004036 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004037
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004038 return(test_ret);
4039}
4040
4041
4042static int
4043test_xmlSAX2ExternalSubset(void) {
4044 int test_ret = 0;
4045
4046 int mem_base;
4047 void * ctx; /* the user data (XML parser context) */
4048 int n_ctx;
4049 xmlChar * name; /* the root element name */
4050 int n_name;
4051 xmlChar * ExternalID; /* the external ID */
4052 int n_ExternalID;
4053 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4054 int n_SystemID;
4055
4056 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4057 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4058 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4059 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4060 mem_base = xmlMemBlocks();
4061 ctx = gen_void_ptr(n_ctx, 0);
4062 name = gen_const_xmlChar_ptr(n_name, 1);
4063 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4064 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4065
William M. Brackf13f77f2004-11-12 16:03:48 +00004066 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004067 call_tests++;
4068 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004069 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4070 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4071 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004072 xmlResetLastError();
4073 if (mem_base != xmlMemBlocks()) {
4074 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4075 xmlMemBlocks() - mem_base);
4076 test_ret++;
4077 printf(" %d", n_ctx);
4078 printf(" %d", n_name);
4079 printf(" %d", n_ExternalID);
4080 printf(" %d", n_SystemID);
4081 printf("\n");
4082 }
4083 }
4084 }
4085 }
4086 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004087 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004088
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004089 return(test_ret);
4090}
4091
4092
4093static int
4094test_xmlSAX2GetColumnNumber(void) {
4095 int test_ret = 0;
4096
4097 int mem_base;
4098 int ret_val;
4099 void * ctx; /* the user data (XML parser context) */
4100 int n_ctx;
4101
4102 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4103 mem_base = xmlMemBlocks();
4104 ctx = gen_void_ptr(n_ctx, 0);
4105
4106 ret_val = xmlSAX2GetColumnNumber(ctx);
4107 desret_int(ret_val);
4108 call_tests++;
4109 des_void_ptr(n_ctx, ctx, 0);
4110 xmlResetLastError();
4111 if (mem_base != xmlMemBlocks()) {
4112 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4113 xmlMemBlocks() - mem_base);
4114 test_ret++;
4115 printf(" %d", n_ctx);
4116 printf("\n");
4117 }
4118 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004119 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004120
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004121 return(test_ret);
4122}
4123
4124
4125static int
4126test_xmlSAX2GetEntity(void) {
4127 int test_ret = 0;
4128
4129 int mem_base;
4130 xmlEntityPtr ret_val;
4131 void * ctx; /* the user data (XML parser context) */
4132 int n_ctx;
4133 xmlChar * name; /* The entity name */
4134 int n_name;
4135
4136 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4137 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4138 mem_base = xmlMemBlocks();
4139 ctx = gen_void_ptr(n_ctx, 0);
4140 name = gen_const_xmlChar_ptr(n_name, 1);
4141
William M. Brackf13f77f2004-11-12 16:03:48 +00004142 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004143 desret_xmlEntityPtr(ret_val);
4144 call_tests++;
4145 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004146 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004147 xmlResetLastError();
4148 if (mem_base != xmlMemBlocks()) {
4149 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4150 xmlMemBlocks() - mem_base);
4151 test_ret++;
4152 printf(" %d", n_ctx);
4153 printf(" %d", n_name);
4154 printf("\n");
4155 }
4156 }
4157 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004158 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004159
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004160 return(test_ret);
4161}
4162
4163
4164static int
4165test_xmlSAX2GetLineNumber(void) {
4166 int test_ret = 0;
4167
4168 int mem_base;
4169 int ret_val;
4170 void * ctx; /* the user data (XML parser context) */
4171 int n_ctx;
4172
4173 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4174 mem_base = xmlMemBlocks();
4175 ctx = gen_void_ptr(n_ctx, 0);
4176
4177 ret_val = xmlSAX2GetLineNumber(ctx);
4178 desret_int(ret_val);
4179 call_tests++;
4180 des_void_ptr(n_ctx, ctx, 0);
4181 xmlResetLastError();
4182 if (mem_base != xmlMemBlocks()) {
4183 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4184 xmlMemBlocks() - mem_base);
4185 test_ret++;
4186 printf(" %d", n_ctx);
4187 printf("\n");
4188 }
4189 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004190 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004191
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004192 return(test_ret);
4193}
4194
4195
4196static int
4197test_xmlSAX2GetParameterEntity(void) {
4198 int test_ret = 0;
4199
4200 int mem_base;
4201 xmlEntityPtr ret_val;
4202 void * ctx; /* the user data (XML parser context) */
4203 int n_ctx;
4204 xmlChar * name; /* The entity name */
4205 int n_name;
4206
4207 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4208 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4209 mem_base = xmlMemBlocks();
4210 ctx = gen_void_ptr(n_ctx, 0);
4211 name = gen_const_xmlChar_ptr(n_name, 1);
4212
William M. Brackf13f77f2004-11-12 16:03:48 +00004213 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004214 desret_xmlEntityPtr(ret_val);
4215 call_tests++;
4216 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004217 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004218 xmlResetLastError();
4219 if (mem_base != xmlMemBlocks()) {
4220 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4221 xmlMemBlocks() - mem_base);
4222 test_ret++;
4223 printf(" %d", n_ctx);
4224 printf(" %d", n_name);
4225 printf("\n");
4226 }
4227 }
4228 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004229 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004230
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004231 return(test_ret);
4232}
4233
4234
4235static int
4236test_xmlSAX2GetPublicId(void) {
4237 int test_ret = 0;
4238
4239 int mem_base;
4240 const xmlChar * ret_val;
4241 void * ctx; /* the user data (XML parser context) */
4242 int n_ctx;
4243
4244 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4245 mem_base = xmlMemBlocks();
4246 ctx = gen_void_ptr(n_ctx, 0);
4247
4248 ret_val = xmlSAX2GetPublicId(ctx);
4249 desret_const_xmlChar_ptr(ret_val);
4250 call_tests++;
4251 des_void_ptr(n_ctx, ctx, 0);
4252 xmlResetLastError();
4253 if (mem_base != xmlMemBlocks()) {
4254 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4255 xmlMemBlocks() - mem_base);
4256 test_ret++;
4257 printf(" %d", n_ctx);
4258 printf("\n");
4259 }
4260 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004261 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004262
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004263 return(test_ret);
4264}
4265
4266
4267static int
4268test_xmlSAX2GetSystemId(void) {
4269 int test_ret = 0;
4270
4271 int mem_base;
4272 const xmlChar * ret_val;
4273 void * ctx; /* the user data (XML parser context) */
4274 int n_ctx;
4275
4276 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4277 mem_base = xmlMemBlocks();
4278 ctx = gen_void_ptr(n_ctx, 0);
4279
4280 ret_val = xmlSAX2GetSystemId(ctx);
4281 desret_const_xmlChar_ptr(ret_val);
4282 call_tests++;
4283 des_void_ptr(n_ctx, ctx, 0);
4284 xmlResetLastError();
4285 if (mem_base != xmlMemBlocks()) {
4286 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4287 xmlMemBlocks() - mem_base);
4288 test_ret++;
4289 printf(" %d", n_ctx);
4290 printf("\n");
4291 }
4292 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004293 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004294
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004295 return(test_ret);
4296}
4297
4298
4299static int
4300test_xmlSAX2HasExternalSubset(void) {
4301 int test_ret = 0;
4302
4303 int mem_base;
4304 int ret_val;
4305 void * ctx; /* the user data (XML parser context) */
4306 int n_ctx;
4307
4308 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4309 mem_base = xmlMemBlocks();
4310 ctx = gen_void_ptr(n_ctx, 0);
4311
4312 ret_val = xmlSAX2HasExternalSubset(ctx);
4313 desret_int(ret_val);
4314 call_tests++;
4315 des_void_ptr(n_ctx, ctx, 0);
4316 xmlResetLastError();
4317 if (mem_base != xmlMemBlocks()) {
4318 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4319 xmlMemBlocks() - mem_base);
4320 test_ret++;
4321 printf(" %d", n_ctx);
4322 printf("\n");
4323 }
4324 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004325 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004326
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004327 return(test_ret);
4328}
4329
4330
4331static int
4332test_xmlSAX2HasInternalSubset(void) {
4333 int test_ret = 0;
4334
4335 int mem_base;
4336 int ret_val;
4337 void * ctx; /* the user data (XML parser context) */
4338 int n_ctx;
4339
4340 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4341 mem_base = xmlMemBlocks();
4342 ctx = gen_void_ptr(n_ctx, 0);
4343
4344 ret_val = xmlSAX2HasInternalSubset(ctx);
4345 desret_int(ret_val);
4346 call_tests++;
4347 des_void_ptr(n_ctx, ctx, 0);
4348 xmlResetLastError();
4349 if (mem_base != xmlMemBlocks()) {
4350 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4351 xmlMemBlocks() - mem_base);
4352 test_ret++;
4353 printf(" %d", n_ctx);
4354 printf("\n");
4355 }
4356 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004357 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004358
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004359 return(test_ret);
4360}
4361
4362
4363static int
4364test_xmlSAX2IgnorableWhitespace(void) {
4365 int test_ret = 0;
4366
4367 int mem_base;
4368 void * ctx; /* the user data (XML parser context) */
4369 int n_ctx;
4370 xmlChar * ch; /* a xmlChar string */
4371 int n_ch;
4372 int len; /* the number of xmlChar */
4373 int n_len;
4374
4375 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4376 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4377 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4378 mem_base = xmlMemBlocks();
4379 ctx = gen_void_ptr(n_ctx, 0);
4380 ch = gen_const_xmlChar_ptr(n_ch, 1);
4381 len = gen_int(n_len, 2);
4382
William M. Brackf13f77f2004-11-12 16:03:48 +00004383 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004384 call_tests++;
4385 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004386 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004387 des_int(n_len, len, 2);
4388 xmlResetLastError();
4389 if (mem_base != xmlMemBlocks()) {
4390 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4391 xmlMemBlocks() - mem_base);
4392 test_ret++;
4393 printf(" %d", n_ctx);
4394 printf(" %d", n_ch);
4395 printf(" %d", n_len);
4396 printf("\n");
4397 }
4398 }
4399 }
4400 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004401 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004402
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004403 return(test_ret);
4404}
4405
4406
4407#define gen_nb_xmlSAXHandler_ptr 1
4408static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4409 return(NULL);
4410}
4411static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4412}
4413
4414static int
4415test_xmlSAX2InitDefaultSAXHandler(void) {
4416 int test_ret = 0;
4417
4418 int mem_base;
4419 xmlSAXHandler * hdlr; /* the SAX handler */
4420 int n_hdlr;
4421 int warning; /* flag if non-zero sets the handler warning procedure */
4422 int n_warning;
4423
4424 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4425 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4426 mem_base = xmlMemBlocks();
4427 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4428 warning = gen_int(n_warning, 1);
4429
4430 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4431 call_tests++;
4432 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4433 des_int(n_warning, warning, 1);
4434 xmlResetLastError();
4435 if (mem_base != xmlMemBlocks()) {
4436 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4437 xmlMemBlocks() - mem_base);
4438 test_ret++;
4439 printf(" %d", n_hdlr);
4440 printf(" %d", n_warning);
4441 printf("\n");
4442 }
4443 }
4444 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004445 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004446
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004447 return(test_ret);
4448}
4449
4450
4451static int
4452test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4453 int test_ret = 0;
4454
4455#ifdef LIBXML_DOCB_ENABLED
4456 int mem_base;
4457 xmlSAXHandler * hdlr; /* the SAX handler */
4458 int n_hdlr;
4459
4460 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4461 mem_base = xmlMemBlocks();
4462 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4463
4464 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4465 call_tests++;
4466 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4467 xmlResetLastError();
4468 if (mem_base != xmlMemBlocks()) {
4469 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4470 xmlMemBlocks() - mem_base);
4471 test_ret++;
4472 printf(" %d", n_hdlr);
4473 printf("\n");
4474 }
4475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004476 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004477#endif
4478
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004479 return(test_ret);
4480}
4481
4482
4483static int
4484test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4485 int test_ret = 0;
4486
4487#ifdef LIBXML_HTML_ENABLED
4488 int mem_base;
4489 xmlSAXHandler * hdlr; /* the SAX handler */
4490 int n_hdlr;
4491
4492 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4493 mem_base = xmlMemBlocks();
4494 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4495
4496 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4497 call_tests++;
4498 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4499 xmlResetLastError();
4500 if (mem_base != xmlMemBlocks()) {
4501 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4502 xmlMemBlocks() - mem_base);
4503 test_ret++;
4504 printf(" %d", n_hdlr);
4505 printf("\n");
4506 }
4507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004508 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004509#endif
4510
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004511 return(test_ret);
4512}
4513
4514
4515static int
4516test_xmlSAX2InternalSubset(void) {
4517 int test_ret = 0;
4518
4519 int mem_base;
4520 void * ctx; /* the user data (XML parser context) */
4521 int n_ctx;
4522 xmlChar * name; /* the root element name */
4523 int n_name;
4524 xmlChar * ExternalID; /* the external ID */
4525 int n_ExternalID;
4526 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4527 int n_SystemID;
4528
4529 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4530 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4531 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4532 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4533 mem_base = xmlMemBlocks();
4534 ctx = gen_void_ptr(n_ctx, 0);
4535 name = gen_const_xmlChar_ptr(n_name, 1);
4536 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4537 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4538
William M. Brackf13f77f2004-11-12 16:03:48 +00004539 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004540 call_tests++;
4541 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004542 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4543 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4544 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004545 xmlResetLastError();
4546 if (mem_base != xmlMemBlocks()) {
4547 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4548 xmlMemBlocks() - mem_base);
4549 test_ret++;
4550 printf(" %d", n_ctx);
4551 printf(" %d", n_name);
4552 printf(" %d", n_ExternalID);
4553 printf(" %d", n_SystemID);
4554 printf("\n");
4555 }
4556 }
4557 }
4558 }
4559 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004560 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004561
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004562 return(test_ret);
4563}
4564
4565
4566static int
4567test_xmlSAX2IsStandalone(void) {
4568 int test_ret = 0;
4569
4570 int mem_base;
4571 int ret_val;
4572 void * ctx; /* the user data (XML parser context) */
4573 int n_ctx;
4574
4575 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4576 mem_base = xmlMemBlocks();
4577 ctx = gen_void_ptr(n_ctx, 0);
4578
4579 ret_val = xmlSAX2IsStandalone(ctx);
4580 desret_int(ret_val);
4581 call_tests++;
4582 des_void_ptr(n_ctx, ctx, 0);
4583 xmlResetLastError();
4584 if (mem_base != xmlMemBlocks()) {
4585 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4586 xmlMemBlocks() - mem_base);
4587 test_ret++;
4588 printf(" %d", n_ctx);
4589 printf("\n");
4590 }
4591 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004592 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004593
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004594 return(test_ret);
4595}
4596
4597
4598static int
4599test_xmlSAX2NotationDecl(void) {
4600 int test_ret = 0;
4601
4602 int mem_base;
4603 void * ctx; /* the user data (XML parser context) */
4604 int n_ctx;
4605 xmlChar * name; /* The name of the notation */
4606 int n_name;
4607 xmlChar * publicId; /* The public ID of the entity */
4608 int n_publicId;
4609 xmlChar * systemId; /* The system ID of the entity */
4610 int n_systemId;
4611
4612 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4613 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4614 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4615 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4616 mem_base = xmlMemBlocks();
4617 ctx = gen_void_ptr(n_ctx, 0);
4618 name = gen_const_xmlChar_ptr(n_name, 1);
4619 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4620 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4621
William M. Brackf13f77f2004-11-12 16:03:48 +00004622 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004623 call_tests++;
4624 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004625 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4626 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4627 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004628 xmlResetLastError();
4629 if (mem_base != xmlMemBlocks()) {
4630 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4631 xmlMemBlocks() - mem_base);
4632 test_ret++;
4633 printf(" %d", n_ctx);
4634 printf(" %d", n_name);
4635 printf(" %d", n_publicId);
4636 printf(" %d", n_systemId);
4637 printf("\n");
4638 }
4639 }
4640 }
4641 }
4642 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004644
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004645 return(test_ret);
4646}
4647
4648
4649static int
4650test_xmlSAX2ProcessingInstruction(void) {
4651 int test_ret = 0;
4652
4653 int mem_base;
4654 void * ctx; /* the user data (XML parser context) */
4655 int n_ctx;
4656 xmlChar * target; /* the target name */
4657 int n_target;
4658 xmlChar * data; /* the PI data's */
4659 int n_data;
4660
4661 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4662 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4663 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4664 mem_base = xmlMemBlocks();
4665 ctx = gen_void_ptr(n_ctx, 0);
4666 target = gen_const_xmlChar_ptr(n_target, 1);
4667 data = gen_const_xmlChar_ptr(n_data, 2);
4668
William M. Brackf13f77f2004-11-12 16:03:48 +00004669 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004670 call_tests++;
4671 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004672 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4673 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004674 xmlResetLastError();
4675 if (mem_base != xmlMemBlocks()) {
4676 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4677 xmlMemBlocks() - mem_base);
4678 test_ret++;
4679 printf(" %d", n_ctx);
4680 printf(" %d", n_target);
4681 printf(" %d", n_data);
4682 printf("\n");
4683 }
4684 }
4685 }
4686 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004687 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004688
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004689 return(test_ret);
4690}
4691
4692
4693static int
4694test_xmlSAX2Reference(void) {
4695 int test_ret = 0;
4696
4697 int mem_base;
4698 void * ctx; /* the user data (XML parser context) */
4699 int n_ctx;
4700 xmlChar * name; /* The entity name */
4701 int n_name;
4702
4703 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4704 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4705 mem_base = xmlMemBlocks();
4706 ctx = gen_void_ptr(n_ctx, 0);
4707 name = gen_const_xmlChar_ptr(n_name, 1);
4708
William M. Brackf13f77f2004-11-12 16:03:48 +00004709 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004710 call_tests++;
4711 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004712 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004713 xmlResetLastError();
4714 if (mem_base != xmlMemBlocks()) {
4715 printf("Leak of %d blocks found in xmlSAX2Reference",
4716 xmlMemBlocks() - mem_base);
4717 test_ret++;
4718 printf(" %d", n_ctx);
4719 printf(" %d", n_name);
4720 printf("\n");
4721 }
4722 }
4723 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004725
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004726 return(test_ret);
4727}
4728
4729
4730static int
4731test_xmlSAX2ResolveEntity(void) {
4732 int test_ret = 0;
4733
4734 int mem_base;
4735 xmlParserInputPtr ret_val;
4736 void * ctx; /* the user data (XML parser context) */
4737 int n_ctx;
4738 xmlChar * publicId; /* The public ID of the entity */
4739 int n_publicId;
4740 xmlChar * systemId; /* The system ID of the entity */
4741 int n_systemId;
4742
4743 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4744 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4745 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4746 mem_base = xmlMemBlocks();
4747 ctx = gen_void_ptr(n_ctx, 0);
4748 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4749 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4750
William M. Brackf13f77f2004-11-12 16:03:48 +00004751 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004752 desret_xmlParserInputPtr(ret_val);
4753 call_tests++;
4754 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004755 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4756 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004757 xmlResetLastError();
4758 if (mem_base != xmlMemBlocks()) {
4759 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4760 xmlMemBlocks() - mem_base);
4761 test_ret++;
4762 printf(" %d", n_ctx);
4763 printf(" %d", n_publicId);
4764 printf(" %d", n_systemId);
4765 printf("\n");
4766 }
4767 }
4768 }
4769 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004770 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004771
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004772 return(test_ret);
4773}
4774
4775
4776#define gen_nb_xmlSAXLocatorPtr 1
4777static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4778 return(NULL);
4779}
4780static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4781}
4782
4783static int
4784test_xmlSAX2SetDocumentLocator(void) {
4785 int test_ret = 0;
4786
4787 int mem_base;
4788 void * ctx; /* the user data (XML parser context) */
4789 int n_ctx;
4790 xmlSAXLocatorPtr loc; /* A SAX Locator */
4791 int n_loc;
4792
4793 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4794 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4795 mem_base = xmlMemBlocks();
4796 ctx = gen_void_ptr(n_ctx, 0);
4797 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4798
4799 xmlSAX2SetDocumentLocator(ctx, loc);
4800 call_tests++;
4801 des_void_ptr(n_ctx, ctx, 0);
4802 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4803 xmlResetLastError();
4804 if (mem_base != xmlMemBlocks()) {
4805 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4806 xmlMemBlocks() - mem_base);
4807 test_ret++;
4808 printf(" %d", n_ctx);
4809 printf(" %d", n_loc);
4810 printf("\n");
4811 }
4812 }
4813 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004814 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004815
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004816 return(test_ret);
4817}
4818
4819
4820static int
4821test_xmlSAX2StartDocument(void) {
4822 int test_ret = 0;
4823
4824 int mem_base;
4825 void * ctx; /* the user data (XML parser context) */
4826 int n_ctx;
4827
4828 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4829 mem_base = xmlMemBlocks();
4830 ctx = gen_void_ptr(n_ctx, 0);
4831
4832 xmlSAX2StartDocument(ctx);
4833 call_tests++;
4834 des_void_ptr(n_ctx, ctx, 0);
4835 xmlResetLastError();
4836 if (mem_base != xmlMemBlocks()) {
4837 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4838 xmlMemBlocks() - mem_base);
4839 test_ret++;
4840 printf(" %d", n_ctx);
4841 printf("\n");
4842 }
4843 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004844 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004845
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004846 return(test_ret);
4847}
4848
4849
4850static int
4851test_xmlSAX2StartElement(void) {
4852 int test_ret = 0;
4853
Daniel Veillarda521d282004-11-09 14:59:59 +00004854#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004855 int mem_base;
4856 void * ctx; /* the user data (XML parser context) */
4857 int n_ctx;
4858 xmlChar * fullname; /* The element name, including namespace prefix */
4859 int n_fullname;
4860 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4861 int n_atts;
4862
4863 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4864 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4865 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4866 mem_base = xmlMemBlocks();
4867 ctx = gen_void_ptr(n_ctx, 0);
4868 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4869 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4870
William M. Brackf13f77f2004-11-12 16:03:48 +00004871 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004872 call_tests++;
4873 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004874 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4875 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004876 xmlResetLastError();
4877 if (mem_base != xmlMemBlocks()) {
4878 printf("Leak of %d blocks found in xmlSAX2StartElement",
4879 xmlMemBlocks() - mem_base);
4880 test_ret++;
4881 printf(" %d", n_ctx);
4882 printf(" %d", n_fullname);
4883 printf(" %d", n_atts);
4884 printf("\n");
4885 }
4886 }
4887 }
4888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004889 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004890#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004891
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004892 return(test_ret);
4893}
4894
4895
4896static int
4897test_xmlSAX2StartElementNs(void) {
4898 int test_ret = 0;
4899
4900 int mem_base;
4901 void * ctx; /* the user data (XML parser context) */
4902 int n_ctx;
4903 xmlChar * localname; /* the local name of the element */
4904 int n_localname;
4905 xmlChar * prefix; /* the element namespace prefix if available */
4906 int n_prefix;
4907 xmlChar * URI; /* the element namespace name if available */
4908 int n_URI;
4909 int nb_namespaces; /* number of namespace definitions on that node */
4910 int n_nb_namespaces;
4911 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4912 int n_namespaces;
4913 int nb_attributes; /* the number of attributes on that node */
4914 int n_nb_attributes;
4915 int nb_defaulted; /* the number of defaulted attributes. */
4916 int n_nb_defaulted;
4917 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4918 int n_attributes;
4919
4920 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4921 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4922 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4923 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4924 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4925 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4926 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4927 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4928 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4929 mem_base = xmlMemBlocks();
4930 ctx = gen_void_ptr(n_ctx, 0);
4931 localname = gen_const_xmlChar_ptr(n_localname, 1);
4932 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4933 URI = gen_const_xmlChar_ptr(n_URI, 3);
4934 nb_namespaces = gen_int(n_nb_namespaces, 4);
4935 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4936 nb_attributes = gen_int(n_nb_attributes, 6);
4937 nb_defaulted = gen_int(n_nb_defaulted, 7);
4938 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4939
William M. Brackf13f77f2004-11-12 16:03:48 +00004940 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 +00004941 call_tests++;
4942 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004943 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4944 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4945 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004946 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004947 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004948 des_int(n_nb_attributes, nb_attributes, 6);
4949 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004950 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004951 xmlResetLastError();
4952 if (mem_base != xmlMemBlocks()) {
4953 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4954 xmlMemBlocks() - mem_base);
4955 test_ret++;
4956 printf(" %d", n_ctx);
4957 printf(" %d", n_localname);
4958 printf(" %d", n_prefix);
4959 printf(" %d", n_URI);
4960 printf(" %d", n_nb_namespaces);
4961 printf(" %d", n_namespaces);
4962 printf(" %d", n_nb_attributes);
4963 printf(" %d", n_nb_defaulted);
4964 printf(" %d", n_attributes);
4965 printf("\n");
4966 }
4967 }
4968 }
4969 }
4970 }
4971 }
4972 }
4973 }
4974 }
4975 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004976 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004977
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004978 return(test_ret);
4979}
4980
4981
4982static int
4983test_xmlSAX2UnparsedEntityDecl(void) {
4984 int test_ret = 0;
4985
4986 int mem_base;
4987 void * ctx; /* the user data (XML parser context) */
4988 int n_ctx;
4989 xmlChar * name; /* The name of the entity */
4990 int n_name;
4991 xmlChar * publicId; /* The public ID of the entity */
4992 int n_publicId;
4993 xmlChar * systemId; /* The system ID of the entity */
4994 int n_systemId;
4995 xmlChar * notationName; /* the name of the notation */
4996 int n_notationName;
4997
4998 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4999 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5000 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5001 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5002 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5003 mem_base = xmlMemBlocks();
5004 ctx = gen_void_ptr(n_ctx, 0);
5005 name = gen_const_xmlChar_ptr(n_name, 1);
5006 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5007 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5008 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5009
William M. Brackf13f77f2004-11-12 16:03:48 +00005010 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005011 call_tests++;
5012 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005013 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5014 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5015 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5016 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005017 xmlResetLastError();
5018 if (mem_base != xmlMemBlocks()) {
5019 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5020 xmlMemBlocks() - mem_base);
5021 test_ret++;
5022 printf(" %d", n_ctx);
5023 printf(" %d", n_name);
5024 printf(" %d", n_publicId);
5025 printf(" %d", n_systemId);
5026 printf(" %d", n_notationName);
5027 printf("\n");
5028 }
5029 }
5030 }
5031 }
5032 }
5033 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005034 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005035
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005036 return(test_ret);
5037}
5038
5039
5040static int
5041test_xmlSAXDefaultVersion(void) {
5042 int test_ret = 0;
5043
Daniel Veillarda521d282004-11-09 14:59:59 +00005044#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005045 int mem_base;
5046 int ret_val;
5047 int version; /* the version, 1 or 2 */
5048 int n_version;
5049
5050 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5051 mem_base = xmlMemBlocks();
5052 version = gen_int(n_version, 0);
5053
5054 ret_val = xmlSAXDefaultVersion(version);
5055 desret_int(ret_val);
5056 call_tests++;
5057 des_int(n_version, version, 0);
5058 xmlResetLastError();
5059 if (mem_base != xmlMemBlocks()) {
5060 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5061 xmlMemBlocks() - mem_base);
5062 test_ret++;
5063 printf(" %d", n_version);
5064 printf("\n");
5065 }
5066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005067 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005068#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005069
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005070 return(test_ret);
5071}
5072
5073
5074static int
5075test_xmlSAXVersion(void) {
5076 int test_ret = 0;
5077
5078 int mem_base;
5079 int ret_val;
5080 xmlSAXHandler * hdlr; /* the SAX handler */
5081 int n_hdlr;
5082 int version; /* the version, 1 or 2 */
5083 int n_version;
5084
5085 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5086 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5087 mem_base = xmlMemBlocks();
5088 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5089 version = gen_int(n_version, 1);
5090
5091 ret_val = xmlSAXVersion(hdlr, version);
5092 desret_int(ret_val);
5093 call_tests++;
5094 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5095 des_int(n_version, version, 1);
5096 xmlResetLastError();
5097 if (mem_base != xmlMemBlocks()) {
5098 printf("Leak of %d blocks found in xmlSAXVersion",
5099 xmlMemBlocks() - mem_base);
5100 test_ret++;
5101 printf(" %d", n_hdlr);
5102 printf(" %d", n_version);
5103 printf("\n");
5104 }
5105 }
5106 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005107 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005108
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005109 return(test_ret);
5110}
5111
5112static int
5113test_SAX2(void) {
5114 int test_ret = 0;
5115
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005116 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005117 test_ret += test_docbDefaultSAXHandlerInit();
5118 test_ret += test_htmlDefaultSAXHandlerInit();
5119 test_ret += test_xmlDefaultSAXHandlerInit();
5120 test_ret += test_xmlSAX2AttributeDecl();
5121 test_ret += test_xmlSAX2CDataBlock();
5122 test_ret += test_xmlSAX2Characters();
5123 test_ret += test_xmlSAX2Comment();
5124 test_ret += test_xmlSAX2ElementDecl();
5125 test_ret += test_xmlSAX2EndDocument();
5126 test_ret += test_xmlSAX2EndElement();
5127 test_ret += test_xmlSAX2EndElementNs();
5128 test_ret += test_xmlSAX2EntityDecl();
5129 test_ret += test_xmlSAX2ExternalSubset();
5130 test_ret += test_xmlSAX2GetColumnNumber();
5131 test_ret += test_xmlSAX2GetEntity();
5132 test_ret += test_xmlSAX2GetLineNumber();
5133 test_ret += test_xmlSAX2GetParameterEntity();
5134 test_ret += test_xmlSAX2GetPublicId();
5135 test_ret += test_xmlSAX2GetSystemId();
5136 test_ret += test_xmlSAX2HasExternalSubset();
5137 test_ret += test_xmlSAX2HasInternalSubset();
5138 test_ret += test_xmlSAX2IgnorableWhitespace();
5139 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5140 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5141 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5142 test_ret += test_xmlSAX2InternalSubset();
5143 test_ret += test_xmlSAX2IsStandalone();
5144 test_ret += test_xmlSAX2NotationDecl();
5145 test_ret += test_xmlSAX2ProcessingInstruction();
5146 test_ret += test_xmlSAX2Reference();
5147 test_ret += test_xmlSAX2ResolveEntity();
5148 test_ret += test_xmlSAX2SetDocumentLocator();
5149 test_ret += test_xmlSAX2StartDocument();
5150 test_ret += test_xmlSAX2StartElement();
5151 test_ret += test_xmlSAX2StartElementNs();
5152 test_ret += test_xmlSAX2UnparsedEntityDecl();
5153 test_ret += test_xmlSAXDefaultVersion();
5154 test_ret += test_xmlSAXVersion();
5155
5156 if (test_ret != 0)
5157 printf("Module SAX2: %d errors\n", test_ret);
5158 return(test_ret);
5159}
5160
Daniel Veillarda82b1822004-11-08 16:24:57 +00005161static int
5162test_xmlC14NDocDumpMemory(void) {
5163 int test_ret = 0;
5164
5165#ifdef LIBXML_C14N_ENABLED
5166#ifdef LIBXML_OUTPUT_ENABLED
5167 int mem_base;
5168 int ret_val;
5169 xmlDocPtr doc; /* the XML document for canonization */
5170 int n_doc;
5171 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5172 int n_nodes;
5173 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5174 int n_exclusive;
5175 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) */
5176 int n_inclusive_ns_prefixes;
5177 int with_comments; /* include comments in the result (!=0) or not (==0) */
5178 int n_with_comments;
5179 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 */
5180 int n_doc_txt_ptr;
5181
5182 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5183 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5184 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5185 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5186 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5187 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5188 mem_base = xmlMemBlocks();
5189 doc = gen_xmlDocPtr(n_doc, 0);
5190 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5191 exclusive = gen_int(n_exclusive, 2);
5192 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5193 with_comments = gen_int(n_with_comments, 4);
5194 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5195
5196 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5197 desret_int(ret_val);
5198 call_tests++;
5199 des_xmlDocPtr(n_doc, doc, 0);
5200 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5201 des_int(n_exclusive, exclusive, 2);
5202 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5203 des_int(n_with_comments, with_comments, 4);
5204 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5205 xmlResetLastError();
5206 if (mem_base != xmlMemBlocks()) {
5207 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5208 xmlMemBlocks() - mem_base);
5209 test_ret++;
5210 printf(" %d", n_doc);
5211 printf(" %d", n_nodes);
5212 printf(" %d", n_exclusive);
5213 printf(" %d", n_inclusive_ns_prefixes);
5214 printf(" %d", n_with_comments);
5215 printf(" %d", n_doc_txt_ptr);
5216 printf("\n");
5217 }
5218 }
5219 }
5220 }
5221 }
5222 }
5223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005224 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005225#endif
5226#endif
5227
Daniel Veillarda82b1822004-11-08 16:24:57 +00005228 return(test_ret);
5229}
5230
5231
5232static int
5233test_xmlC14NDocSave(void) {
5234 int test_ret = 0;
5235
5236#ifdef LIBXML_C14N_ENABLED
5237#ifdef LIBXML_OUTPUT_ENABLED
5238 int mem_base;
5239 int ret_val;
5240 xmlDocPtr doc; /* the XML document for canonization */
5241 int n_doc;
5242 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5243 int n_nodes;
5244 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5245 int n_exclusive;
5246 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) */
5247 int n_inclusive_ns_prefixes;
5248 int with_comments; /* include comments in the result (!=0) or not (==0) */
5249 int n_with_comments;
5250 const char * filename; /* the filename to store canonical XML image */
5251 int n_filename;
5252 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5253 int n_compression;
5254
5255 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5256 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5257 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5258 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5259 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5260 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5261 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5262 mem_base = xmlMemBlocks();
5263 doc = gen_xmlDocPtr(n_doc, 0);
5264 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5265 exclusive = gen_int(n_exclusive, 2);
5266 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5267 with_comments = gen_int(n_with_comments, 4);
5268 filename = gen_fileoutput(n_filename, 5);
5269 compression = gen_int(n_compression, 6);
5270
5271 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5272 desret_int(ret_val);
5273 call_tests++;
5274 des_xmlDocPtr(n_doc, doc, 0);
5275 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5276 des_int(n_exclusive, exclusive, 2);
5277 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5278 des_int(n_with_comments, with_comments, 4);
5279 des_fileoutput(n_filename, filename, 5);
5280 des_int(n_compression, compression, 6);
5281 xmlResetLastError();
5282 if (mem_base != xmlMemBlocks()) {
5283 printf("Leak of %d blocks found in xmlC14NDocSave",
5284 xmlMemBlocks() - mem_base);
5285 test_ret++;
5286 printf(" %d", n_doc);
5287 printf(" %d", n_nodes);
5288 printf(" %d", n_exclusive);
5289 printf(" %d", n_inclusive_ns_prefixes);
5290 printf(" %d", n_with_comments);
5291 printf(" %d", n_filename);
5292 printf(" %d", n_compression);
5293 printf("\n");
5294 }
5295 }
5296 }
5297 }
5298 }
5299 }
5300 }
5301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005302 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005303#endif
5304#endif
5305
Daniel Veillarda82b1822004-11-08 16:24:57 +00005306 return(test_ret);
5307}
5308
5309
5310static int
5311test_xmlC14NDocSaveTo(void) {
5312 int test_ret = 0;
5313
5314#ifdef LIBXML_C14N_ENABLED
5315#ifdef LIBXML_OUTPUT_ENABLED
5316 int mem_base;
5317 int ret_val;
5318 xmlDocPtr doc; /* the XML document for canonization */
5319 int n_doc;
5320 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5321 int n_nodes;
5322 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5323 int n_exclusive;
5324 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) */
5325 int n_inclusive_ns_prefixes;
5326 int with_comments; /* include comments in the result (!=0) or not (==0) */
5327 int n_with_comments;
5328 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5329 int n_buf;
5330
5331 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5332 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5333 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5334 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5335 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5336 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5337 mem_base = xmlMemBlocks();
5338 doc = gen_xmlDocPtr(n_doc, 0);
5339 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5340 exclusive = gen_int(n_exclusive, 2);
5341 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5342 with_comments = gen_int(n_with_comments, 4);
5343 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5344
5345 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5346 desret_int(ret_val);
5347 call_tests++;
5348 des_xmlDocPtr(n_doc, doc, 0);
5349 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5350 des_int(n_exclusive, exclusive, 2);
5351 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5352 des_int(n_with_comments, with_comments, 4);
5353 des_xmlOutputBufferPtr(n_buf, buf, 5);
5354 xmlResetLastError();
5355 if (mem_base != xmlMemBlocks()) {
5356 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5357 xmlMemBlocks() - mem_base);
5358 test_ret++;
5359 printf(" %d", n_doc);
5360 printf(" %d", n_nodes);
5361 printf(" %d", n_exclusive);
5362 printf(" %d", n_inclusive_ns_prefixes);
5363 printf(" %d", n_with_comments);
5364 printf(" %d", n_buf);
5365 printf("\n");
5366 }
5367 }
5368 }
5369 }
5370 }
5371 }
5372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005373 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005374#endif
5375#endif
5376
Daniel Veillarda82b1822004-11-08 16:24:57 +00005377 return(test_ret);
5378}
5379
5380
5381static int
5382test_xmlC14NExecute(void) {
5383 int test_ret = 0;
5384
5385
5386 /* missing type support */
5387 return(test_ret);
5388}
5389
5390static int
5391test_c14n(void) {
5392 int test_ret = 0;
5393
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005394 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005395 test_ret += test_xmlC14NDocDumpMemory();
5396 test_ret += test_xmlC14NDocSave();
5397 test_ret += test_xmlC14NDocSaveTo();
5398 test_ret += test_xmlC14NExecute();
5399
5400 if (test_ret != 0)
5401 printf("Module c14n: %d errors\n", test_ret);
5402 return(test_ret);
5403}
Daniel Veillarda521d282004-11-09 14:59:59 +00005404#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005405
Daniel Veillardce682bc2004-11-05 17:22:25 +00005406#define gen_nb_xmlCatalogPtr 1
5407static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5408 return(NULL);
5409}
5410static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5411}
Daniel Veillarda521d282004-11-09 14:59:59 +00005412#endif
5413
Daniel Veillardce682bc2004-11-05 17:22:25 +00005414
Daniel Veillardd93f6252004-11-02 15:53:51 +00005415static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005416test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005418
Daniel Veillardce682bc2004-11-05 17:22:25 +00005419#ifdef LIBXML_CATALOG_ENABLED
5420 int mem_base;
5421 int ret_val;
5422 xmlCatalogPtr catal; /* a Catalog */
5423 int n_catal;
5424 xmlChar * type; /* the type of record to add to the catalog */
5425 int n_type;
5426 xmlChar * orig; /* the system, public or prefix to match */
5427 int n_orig;
5428 xmlChar * replace; /* the replacement value for the match */
5429 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005430
Daniel Veillardce682bc2004-11-05 17:22:25 +00005431 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5432 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5433 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5434 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5435 mem_base = xmlMemBlocks();
5436 catal = gen_xmlCatalogPtr(n_catal, 0);
5437 type = gen_const_xmlChar_ptr(n_type, 1);
5438 orig = gen_const_xmlChar_ptr(n_orig, 2);
5439 replace = gen_const_xmlChar_ptr(n_replace, 3);
5440
William M. Brackf13f77f2004-11-12 16:03:48 +00005441 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005442 desret_int(ret_val);
5443 call_tests++;
5444 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005445 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5446 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5447 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005448 xmlResetLastError();
5449 if (mem_base != xmlMemBlocks()) {
5450 printf("Leak of %d blocks found in xmlACatalogAdd",
5451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005452 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005453 printf(" %d", n_catal);
5454 printf(" %d", n_type);
5455 printf(" %d", n_orig);
5456 printf(" %d", n_replace);
5457 printf("\n");
5458 }
5459 }
5460 }
5461 }
5462 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005463 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005464#endif
5465
Daniel Veillard42595322004-11-08 10:52:06 +00005466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005467}
5468
5469
5470static int
5471test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005473
Daniel Veillardce682bc2004-11-05 17:22:25 +00005474#ifdef LIBXML_CATALOG_ENABLED
5475#ifdef LIBXML_OUTPUT_ENABLED
5476 int mem_base;
5477 xmlCatalogPtr catal; /* a Catalog */
5478 int n_catal;
5479 FILE * out; /* the file. */
5480 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005481
Daniel Veillardce682bc2004-11-05 17:22:25 +00005482 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5483 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5484 mem_base = xmlMemBlocks();
5485 catal = gen_xmlCatalogPtr(n_catal, 0);
5486 out = gen_FILE_ptr(n_out, 1);
5487
5488 xmlACatalogDump(catal, out);
5489 call_tests++;
5490 des_xmlCatalogPtr(n_catal, catal, 0);
5491 des_FILE_ptr(n_out, out, 1);
5492 xmlResetLastError();
5493 if (mem_base != xmlMemBlocks()) {
5494 printf("Leak of %d blocks found in xmlACatalogDump",
5495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005496 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005497 printf(" %d", n_catal);
5498 printf(" %d", n_out);
5499 printf("\n");
5500 }
5501 }
5502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005503 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005504#endif
5505#endif
5506
Daniel Veillard42595322004-11-08 10:52:06 +00005507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005508}
5509
5510
5511static int
5512test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005514
Daniel Veillardce682bc2004-11-05 17:22:25 +00005515#ifdef LIBXML_CATALOG_ENABLED
5516 int mem_base;
5517 int ret_val;
5518 xmlCatalogPtr catal; /* a Catalog */
5519 int n_catal;
5520 xmlChar * value; /* the value to remove */
5521 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005522
Daniel Veillardce682bc2004-11-05 17:22:25 +00005523 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5524 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5525 mem_base = xmlMemBlocks();
5526 catal = gen_xmlCatalogPtr(n_catal, 0);
5527 value = gen_const_xmlChar_ptr(n_value, 1);
5528
William M. Brackf13f77f2004-11-12 16:03:48 +00005529 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005530 desret_int(ret_val);
5531 call_tests++;
5532 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005533 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005534 xmlResetLastError();
5535 if (mem_base != xmlMemBlocks()) {
5536 printf("Leak of %d blocks found in xmlACatalogRemove",
5537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005538 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005539 printf(" %d", n_catal);
5540 printf(" %d", n_value);
5541 printf("\n");
5542 }
5543 }
5544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005545 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005546#endif
5547
Daniel Veillard42595322004-11-08 10:52:06 +00005548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005549}
5550
5551
5552static int
5553test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005555
Daniel Veillardce682bc2004-11-05 17:22:25 +00005556#ifdef LIBXML_CATALOG_ENABLED
5557 int mem_base;
5558 xmlChar * ret_val;
5559 xmlCatalogPtr catal; /* a Catalog */
5560 int n_catal;
5561 xmlChar * pubID; /* the public ID string */
5562 int n_pubID;
5563 xmlChar * sysID; /* the system ID string */
5564 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005565
Daniel Veillardce682bc2004-11-05 17:22:25 +00005566 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5567 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5568 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5569 mem_base = xmlMemBlocks();
5570 catal = gen_xmlCatalogPtr(n_catal, 0);
5571 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5572 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5573
William M. Brackf13f77f2004-11-12 16:03:48 +00005574 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005575 desret_xmlChar_ptr(ret_val);
5576 call_tests++;
5577 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005578 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5579 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005580 xmlResetLastError();
5581 if (mem_base != xmlMemBlocks()) {
5582 printf("Leak of %d blocks found in xmlACatalogResolve",
5583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005584 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005585 printf(" %d", n_catal);
5586 printf(" %d", n_pubID);
5587 printf(" %d", n_sysID);
5588 printf("\n");
5589 }
5590 }
5591 }
5592 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005593 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005594#endif
5595
Daniel Veillard42595322004-11-08 10:52:06 +00005596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005597}
5598
5599
5600static int
5601test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005603
Daniel Veillardce682bc2004-11-05 17:22:25 +00005604#ifdef LIBXML_CATALOG_ENABLED
5605 int mem_base;
5606 xmlChar * ret_val;
5607 xmlCatalogPtr catal; /* a Catalog */
5608 int n_catal;
5609 xmlChar * pubID; /* the public ID string */
5610 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005611
Daniel Veillardce682bc2004-11-05 17:22:25 +00005612 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5613 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5614 mem_base = xmlMemBlocks();
5615 catal = gen_xmlCatalogPtr(n_catal, 0);
5616 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5617
William M. Brackf13f77f2004-11-12 16:03:48 +00005618 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005619 desret_xmlChar_ptr(ret_val);
5620 call_tests++;
5621 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005622 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005623 xmlResetLastError();
5624 if (mem_base != xmlMemBlocks()) {
5625 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005627 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005628 printf(" %d", n_catal);
5629 printf(" %d", n_pubID);
5630 printf("\n");
5631 }
5632 }
5633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005634 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005635#endif
5636
Daniel Veillard42595322004-11-08 10:52:06 +00005637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005638}
5639
5640
5641static int
5642test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005644
Daniel Veillardce682bc2004-11-05 17:22:25 +00005645#ifdef LIBXML_CATALOG_ENABLED
5646 int mem_base;
5647 xmlChar * ret_val;
5648 xmlCatalogPtr catal; /* a Catalog */
5649 int n_catal;
5650 xmlChar * sysID; /* the system ID string */
5651 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005652
Daniel Veillardce682bc2004-11-05 17:22:25 +00005653 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5654 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5655 mem_base = xmlMemBlocks();
5656 catal = gen_xmlCatalogPtr(n_catal, 0);
5657 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5658
William M. Brackf13f77f2004-11-12 16:03:48 +00005659 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005660 desret_xmlChar_ptr(ret_val);
5661 call_tests++;
5662 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005663 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005664 xmlResetLastError();
5665 if (mem_base != xmlMemBlocks()) {
5666 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005668 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005669 printf(" %d", n_catal);
5670 printf(" %d", n_sysID);
5671 printf("\n");
5672 }
5673 }
5674 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005675 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005676#endif
5677
Daniel Veillard42595322004-11-08 10:52:06 +00005678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005679}
5680
5681
5682static int
5683test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005685
Daniel Veillardce682bc2004-11-05 17:22:25 +00005686#ifdef LIBXML_CATALOG_ENABLED
5687 int mem_base;
5688 xmlChar * ret_val;
5689 xmlCatalogPtr catal; /* a Catalog */
5690 int n_catal;
5691 xmlChar * URI; /* the URI */
5692 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005693
Daniel Veillardce682bc2004-11-05 17:22:25 +00005694 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5695 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5696 mem_base = xmlMemBlocks();
5697 catal = gen_xmlCatalogPtr(n_catal, 0);
5698 URI = gen_const_xmlChar_ptr(n_URI, 1);
5699
William M. Brackf13f77f2004-11-12 16:03:48 +00005700 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005701 desret_xmlChar_ptr(ret_val);
5702 call_tests++;
5703 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005704 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005705 xmlResetLastError();
5706 if (mem_base != xmlMemBlocks()) {
5707 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005709 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005710 printf(" %d", n_catal);
5711 printf(" %d", n_URI);
5712 printf("\n");
5713 }
5714 }
5715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005716 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005717#endif
5718
Daniel Veillard42595322004-11-08 10:52:06 +00005719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005720}
5721
5722
5723static int
5724test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005726
5727#ifdef LIBXML_CATALOG_ENABLED
5728 int mem_base;
5729 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005730 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005731 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005732 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005733 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005734 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005735 int n_replace;
5736
5737 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5738 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5739 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005741 type = gen_const_xmlChar_ptr(n_type, 0);
5742 orig = gen_const_xmlChar_ptr(n_orig, 1);
5743 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005744
William M. Brackf13f77f2004-11-12 16:03:48 +00005745 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005746 desret_int(ret_val);
5747 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005748 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5749 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5750 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005751 xmlResetLastError();
5752 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005753 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005755 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005756 printf(" %d", n_type);
5757 printf(" %d", n_orig);
5758 printf(" %d", n_replace);
5759 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005760 }
5761 }
5762 }
5763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005764 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005765#endif
5766
Daniel Veillard42595322004-11-08 10:52:06 +00005767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005768}
5769
5770
5771static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005772test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005774
5775#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00005776
Daniel Veillardd93f6252004-11-02 15:53:51 +00005777
5778 xmlCatalogCleanup();
5779 call_tests++;
5780 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005781 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005782#endif
5783
Daniel Veillard42595322004-11-08 10:52:06 +00005784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005785}
5786
5787
5788static int
5789test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005791
5792#ifdef LIBXML_CATALOG_ENABLED
5793 int ret_val;
5794
5795
5796 ret_val = xmlCatalogConvert();
5797 desret_int(ret_val);
5798 call_tests++;
5799 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005800 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005801#endif
5802
Daniel Veillard42595322004-11-08 10:52:06 +00005803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005804}
5805
5806
5807static int
5808test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005810
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005811#ifdef LIBXML_CATALOG_ENABLED
5812#ifdef LIBXML_OUTPUT_ENABLED
5813 int mem_base;
5814 FILE * out; /* the file. */
5815 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005816
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005817 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5818 mem_base = xmlMemBlocks();
5819 out = gen_FILE_ptr(n_out, 0);
5820
5821 xmlCatalogDump(out);
5822 call_tests++;
5823 des_FILE_ptr(n_out, out, 0);
5824 xmlResetLastError();
5825 if (mem_base != xmlMemBlocks()) {
5826 printf("Leak of %d blocks found in xmlCatalogDump",
5827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005828 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005829 printf(" %d", n_out);
5830 printf("\n");
5831 }
5832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005833 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005834#endif
5835#endif
5836
Daniel Veillard42595322004-11-08 10:52:06 +00005837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005838}
5839
5840
5841static int
5842test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005844
Daniel Veillard57b25162004-11-06 14:50:18 +00005845#ifdef LIBXML_CATALOG_ENABLED
5846 int mem_base;
5847 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005848
Daniel Veillard57b25162004-11-06 14:50:18 +00005849 mem_base = xmlMemBlocks();
5850
5851 ret_val = xmlCatalogGetDefaults();
5852 desret_xmlCatalogAllow(ret_val);
5853 call_tests++;
5854 xmlResetLastError();
5855 if (mem_base != xmlMemBlocks()) {
5856 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005858 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005859 printf("\n");
5860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005861 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005862#endif
5863
Daniel Veillard42595322004-11-08 10:52:06 +00005864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005865}
5866
5867
5868static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005869test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005871
Daniel Veillardce682bc2004-11-05 17:22:25 +00005872#ifdef LIBXML_CATALOG_ENABLED
5873 int mem_base;
5874 int ret_val;
5875 xmlCatalogPtr catal; /* should this create an SGML catalog */
5876 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005877
Daniel Veillardce682bc2004-11-05 17:22:25 +00005878 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5879 mem_base = xmlMemBlocks();
5880 catal = gen_xmlCatalogPtr(n_catal, 0);
5881
5882 ret_val = xmlCatalogIsEmpty(catal);
5883 desret_int(ret_val);
5884 call_tests++;
5885 des_xmlCatalogPtr(n_catal, catal, 0);
5886 xmlResetLastError();
5887 if (mem_base != xmlMemBlocks()) {
5888 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005890 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005891 printf(" %d", n_catal);
5892 printf("\n");
5893 }
5894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005895 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005896#endif
5897
Daniel Veillard42595322004-11-08 10:52:06 +00005898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005899}
5900
5901
5902static int
5903test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005905
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005906#ifdef LIBXML_CATALOG_ENABLED
5907 int mem_base;
5908 xmlChar * ret_val;
5909 void * catalogs; /* a document's list of catalogs */
5910 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005911 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005912 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005913 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005914 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005915
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005916 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5917 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5918 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5919 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005920 catalogs = gen_void_ptr(n_catalogs, 0);
5921 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5922 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005923
William M. Brackf13f77f2004-11-12 16:03:48 +00005924 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005925 desret_xmlChar_ptr(ret_val);
5926 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005927 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005928 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5929 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005930 xmlResetLastError();
5931 if (mem_base != xmlMemBlocks()) {
5932 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005934 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005935 printf(" %d", n_catalogs);
5936 printf(" %d", n_pubID);
5937 printf(" %d", n_sysID);
5938 printf("\n");
5939 }
5940 }
5941 }
5942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005943 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005944#endif
5945
Daniel Veillard42595322004-11-08 10:52:06 +00005946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005947}
5948
5949
5950static int
5951test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005953
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005954#ifdef LIBXML_CATALOG_ENABLED
5955 int mem_base;
5956 xmlChar * ret_val;
5957 void * catalogs; /* a document's list of catalogs */
5958 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005959 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005960 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005961
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005962 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5963 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5964 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005965 catalogs = gen_void_ptr(n_catalogs, 0);
5966 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005967
William M. Brackf13f77f2004-11-12 16:03:48 +00005968 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005969 desret_xmlChar_ptr(ret_val);
5970 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005971 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005972 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005973 xmlResetLastError();
5974 if (mem_base != xmlMemBlocks()) {
5975 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005977 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005978 printf(" %d", n_catalogs);
5979 printf(" %d", n_URI);
5980 printf("\n");
5981 }
5982 }
5983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005984 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005985#endif
5986
Daniel Veillard42595322004-11-08 10:52:06 +00005987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005988}
5989
5990
5991static int
5992test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005994
5995#ifdef LIBXML_CATALOG_ENABLED
5996 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005997 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005998 int n_value;
5999
6000 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006001 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006002
William M. Brackf13f77f2004-11-12 16:03:48 +00006003 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006004 desret_int(ret_val);
6005 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006006 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006007 xmlResetLastError();
6008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006009 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006010#endif
6011
Daniel Veillard42595322004-11-08 10:52:06 +00006012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006013}
6014
6015
6016static int
6017test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006019
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006020#ifdef LIBXML_CATALOG_ENABLED
6021 int mem_base;
6022 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006023 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006024 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006025 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006026 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006027
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006028 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6029 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006031 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6032 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006033
William M. Brackf13f77f2004-11-12 16:03:48 +00006034 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006035 desret_xmlChar_ptr(ret_val);
6036 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006037 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6038 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006039 xmlResetLastError();
6040 if (mem_base != xmlMemBlocks()) {
6041 printf("Leak of %d blocks found in xmlCatalogResolve",
6042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006043 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006044 printf(" %d", n_pubID);
6045 printf(" %d", n_sysID);
6046 printf("\n");
6047 }
6048 }
6049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006050 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006051#endif
6052
Daniel Veillard42595322004-11-08 10:52:06 +00006053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006054}
6055
6056
6057static int
6058test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006060
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006061#ifdef LIBXML_CATALOG_ENABLED
6062 int mem_base;
6063 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006064 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006065 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006066
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006067 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6068 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006069 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006070
William M. Brackf13f77f2004-11-12 16:03:48 +00006071 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006072 desret_xmlChar_ptr(ret_val);
6073 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006074 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006075 xmlResetLastError();
6076 if (mem_base != xmlMemBlocks()) {
6077 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006079 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006080 printf(" %d", n_pubID);
6081 printf("\n");
6082 }
6083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006084 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006085#endif
6086
Daniel Veillard42595322004-11-08 10:52:06 +00006087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006088}
6089
6090
6091static int
6092test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006094
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006095#ifdef LIBXML_CATALOG_ENABLED
6096 int mem_base;
6097 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006098 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006099 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006100
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006101 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6102 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006103 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006104
William M. Brackf13f77f2004-11-12 16:03:48 +00006105 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006106 desret_xmlChar_ptr(ret_val);
6107 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006108 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006109 xmlResetLastError();
6110 if (mem_base != xmlMemBlocks()) {
6111 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006113 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006114 printf(" %d", n_sysID);
6115 printf("\n");
6116 }
6117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006118 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006119#endif
6120
Daniel Veillard42595322004-11-08 10:52:06 +00006121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006122}
6123
6124
6125static int
6126test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006128
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006129#ifdef LIBXML_CATALOG_ENABLED
6130 int mem_base;
6131 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006132 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006133 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006134
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006135 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6136 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006137 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006138
William M. Brackf13f77f2004-11-12 16:03:48 +00006139 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006140 desret_xmlChar_ptr(ret_val);
6141 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006142 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006143 xmlResetLastError();
6144 if (mem_base != xmlMemBlocks()) {
6145 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006147 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006148 printf(" %d", n_URI);
6149 printf("\n");
6150 }
6151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006152 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006153#endif
6154
Daniel Veillard42595322004-11-08 10:52:06 +00006155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006156}
6157
6158
6159static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006160test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006162
Daniel Veillard57b25162004-11-06 14:50:18 +00006163#ifdef LIBXML_CATALOG_ENABLED
6164 int mem_base;
6165 xmlCatalogPrefer ret_val;
6166 xmlCatalogPrefer prefer; /* the default preference for delegation */
6167 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006168
Daniel Veillard57b25162004-11-06 14:50:18 +00006169 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6170 mem_base = xmlMemBlocks();
6171 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6172
6173 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6174 desret_xmlCatalogPrefer(ret_val);
6175 call_tests++;
6176 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6177 xmlResetLastError();
6178 if (mem_base != xmlMemBlocks()) {
6179 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006181 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006182 printf(" %d", n_prefer);
6183 printf("\n");
6184 }
6185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006186 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006187#endif
6188
Daniel Veillard42595322004-11-08 10:52:06 +00006189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006190}
6191
6192
6193static int
6194test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006196
Daniel Veillard57b25162004-11-06 14:50:18 +00006197#ifdef LIBXML_CATALOG_ENABLED
6198 int mem_base;
6199 xmlCatalogAllow allow; /* what catalogs should be accepted */
6200 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006201
Daniel Veillard57b25162004-11-06 14:50:18 +00006202 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6203 mem_base = xmlMemBlocks();
6204 allow = gen_xmlCatalogAllow(n_allow, 0);
6205
6206 xmlCatalogSetDefaults(allow);
6207 call_tests++;
6208 des_xmlCatalogAllow(n_allow, allow, 0);
6209 xmlResetLastError();
6210 if (mem_base != xmlMemBlocks()) {
6211 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006213 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006214 printf(" %d", n_allow);
6215 printf("\n");
6216 }
6217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006218 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006219#endif
6220
Daniel Veillard42595322004-11-08 10:52:06 +00006221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006222}
6223
6224
6225static int
6226test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006228
Daniel Veillardce682bc2004-11-05 17:22:25 +00006229#ifdef LIBXML_CATALOG_ENABLED
6230 int mem_base;
6231 int ret_val;
6232 xmlCatalogPtr catal; /* the catalog */
6233 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006234
Daniel Veillardce682bc2004-11-05 17:22:25 +00006235 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6236 mem_base = xmlMemBlocks();
6237 catal = gen_xmlCatalogPtr(n_catal, 0);
6238
6239 ret_val = xmlConvertSGMLCatalog(catal);
6240 desret_int(ret_val);
6241 call_tests++;
6242 des_xmlCatalogPtr(n_catal, catal, 0);
6243 xmlResetLastError();
6244 if (mem_base != xmlMemBlocks()) {
6245 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006247 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006248 printf(" %d", n_catal);
6249 printf("\n");
6250 }
6251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006252 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006253#endif
6254
Daniel Veillard42595322004-11-08 10:52:06 +00006255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006256}
6257
6258
6259static int
6260test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006262
6263#ifdef LIBXML_CATALOG_ENABLED
6264 int mem_base;
6265
6266 mem_base = xmlMemBlocks();
6267
6268 xmlInitializeCatalog();
6269 call_tests++;
6270 xmlResetLastError();
6271 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006272 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006274 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006275 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006277 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006278#endif
6279
Daniel Veillard42595322004-11-08 10:52:06 +00006280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006281}
6282
6283
6284static int
6285test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006287
6288
6289 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006291}
6292
6293
6294static int
6295test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006297
6298#ifdef LIBXML_CATALOG_ENABLED
6299 int ret_val;
6300 const char * filename; /* a file path */
6301 int n_filename;
6302
6303 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006304 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006305
6306 ret_val = xmlLoadCatalog(filename);
6307 desret_int(ret_val);
6308 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006309 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006310 xmlResetLastError();
6311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006312 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006313#endif
6314
Daniel Veillard42595322004-11-08 10:52:06 +00006315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006316}
6317
6318
6319static int
6320test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006322
6323#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00006324 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006325 int n_pathss;
6326
6327 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006328 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006329
William M. Brackf13f77f2004-11-12 16:03:48 +00006330 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006331 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006332 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006333 xmlResetLastError();
6334 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006335 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006336#endif
6337
Daniel Veillard42595322004-11-08 10:52:06 +00006338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006339}
6340
6341
6342static int
6343test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006345
6346
6347 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006349}
6350
6351
6352static int
6353test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006355
6356
6357 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006359}
6360
6361
6362static int
6363test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006365
6366#ifdef LIBXML_CATALOG_ENABLED
6367 int mem_base;
6368 xmlDocPtr ret_val;
6369 const char * filename; /* the filename */
6370 int n_filename;
6371
6372 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006374 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006375
6376 ret_val = xmlParseCatalogFile(filename);
6377 desret_xmlDocPtr(ret_val);
6378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006379 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006380 xmlResetLastError();
6381 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006382 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006384 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006385 printf(" %d", n_filename);
6386 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006387 }
6388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006389 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006390#endif
6391
Daniel Veillard42595322004-11-08 10:52:06 +00006392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006393}
6394
6395static int
6396test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006398
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006399 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006400 test_ret += test_xmlACatalogAdd();
6401 test_ret += test_xmlACatalogDump();
6402 test_ret += test_xmlACatalogRemove();
6403 test_ret += test_xmlACatalogResolve();
6404 test_ret += test_xmlACatalogResolvePublic();
6405 test_ret += test_xmlACatalogResolveSystem();
6406 test_ret += test_xmlACatalogResolveURI();
6407 test_ret += test_xmlCatalogAdd();
6408 test_ret += test_xmlCatalogCleanup();
6409 test_ret += test_xmlCatalogConvert();
6410 test_ret += test_xmlCatalogDump();
6411 test_ret += test_xmlCatalogGetDefaults();
6412 test_ret += test_xmlCatalogIsEmpty();
6413 test_ret += test_xmlCatalogLocalResolve();
6414 test_ret += test_xmlCatalogLocalResolveURI();
6415 test_ret += test_xmlCatalogRemove();
6416 test_ret += test_xmlCatalogResolve();
6417 test_ret += test_xmlCatalogResolvePublic();
6418 test_ret += test_xmlCatalogResolveSystem();
6419 test_ret += test_xmlCatalogResolveURI();
6420 test_ret += test_xmlCatalogSetDefaultPrefer();
6421 test_ret += test_xmlCatalogSetDefaults();
6422 test_ret += test_xmlConvertSGMLCatalog();
6423 test_ret += test_xmlInitializeCatalog();
6424 test_ret += test_xmlLoadACatalog();
6425 test_ret += test_xmlLoadCatalog();
6426 test_ret += test_xmlLoadCatalogs();
6427 test_ret += test_xmlLoadSGMLSuperCatalog();
6428 test_ret += test_xmlNewCatalog();
6429 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006430
Daniel Veillard42595322004-11-08 10:52:06 +00006431 if (test_ret != 0)
6432 printf("Module catalog: %d errors\n", test_ret);
6433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006434}
6435
Daniel Veillardce682bc2004-11-05 17:22:25 +00006436#define gen_nb_const_xmlChRangeGroupPtr 1
6437static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6438 return(NULL);
6439}
6440static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6441}
6442
Daniel Veillardd93f6252004-11-02 15:53:51 +00006443static int
6444test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006446
Daniel Veillardce682bc2004-11-05 17:22:25 +00006447 int mem_base;
6448 int ret_val;
6449 unsigned int val; /* character to be validated */
6450 int n_val;
6451 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6452 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006453
Daniel Veillardce682bc2004-11-05 17:22:25 +00006454 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6455 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6456 mem_base = xmlMemBlocks();
6457 val = gen_unsigned_int(n_val, 0);
6458 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6459
William M. Brackf13f77f2004-11-12 16:03:48 +00006460 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006461 desret_int(ret_val);
6462 call_tests++;
6463 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006464 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006465 xmlResetLastError();
6466 if (mem_base != xmlMemBlocks()) {
6467 printf("Leak of %d blocks found in xmlCharInRange",
6468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006469 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006470 printf(" %d", n_val);
6471 printf(" %d", n_rptr);
6472 printf("\n");
6473 }
6474 }
6475 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006476 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006477
Daniel Veillard42595322004-11-08 10:52:06 +00006478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006479}
6480
6481
6482static int
6483test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006485
Daniel Veillard3d97e662004-11-04 10:49:00 +00006486 int mem_base;
6487 int ret_val;
6488 unsigned int ch; /* character to validate */
6489 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006490
Daniel Veillard3d97e662004-11-04 10:49:00 +00006491 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6492 mem_base = xmlMemBlocks();
6493 ch = gen_unsigned_int(n_ch, 0);
6494
6495 ret_val = xmlIsBaseChar(ch);
6496 desret_int(ret_val);
6497 call_tests++;
6498 des_unsigned_int(n_ch, ch, 0);
6499 xmlResetLastError();
6500 if (mem_base != xmlMemBlocks()) {
6501 printf("Leak of %d blocks found in xmlIsBaseChar",
6502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006503 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006504 printf(" %d", n_ch);
6505 printf("\n");
6506 }
6507 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006508 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006509
Daniel Veillard42595322004-11-08 10:52:06 +00006510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006511}
6512
6513
6514static int
6515test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006517
Daniel Veillard3d97e662004-11-04 10:49:00 +00006518 int mem_base;
6519 int ret_val;
6520 unsigned int ch; /* character to validate */
6521 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006522
Daniel Veillard3d97e662004-11-04 10:49:00 +00006523 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6524 mem_base = xmlMemBlocks();
6525 ch = gen_unsigned_int(n_ch, 0);
6526
6527 ret_val = xmlIsBlank(ch);
6528 desret_int(ret_val);
6529 call_tests++;
6530 des_unsigned_int(n_ch, ch, 0);
6531 xmlResetLastError();
6532 if (mem_base != xmlMemBlocks()) {
6533 printf("Leak of %d blocks found in xmlIsBlank",
6534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006535 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006536 printf(" %d", n_ch);
6537 printf("\n");
6538 }
6539 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006541
Daniel Veillard42595322004-11-08 10:52:06 +00006542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006543}
6544
6545
6546static int
6547test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006549
Daniel Veillard3d97e662004-11-04 10:49:00 +00006550 int mem_base;
6551 int ret_val;
6552 unsigned int ch; /* character to validate */
6553 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006554
Daniel Veillard3d97e662004-11-04 10:49:00 +00006555 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6556 mem_base = xmlMemBlocks();
6557 ch = gen_unsigned_int(n_ch, 0);
6558
6559 ret_val = xmlIsChar(ch);
6560 desret_int(ret_val);
6561 call_tests++;
6562 des_unsigned_int(n_ch, ch, 0);
6563 xmlResetLastError();
6564 if (mem_base != xmlMemBlocks()) {
6565 printf("Leak of %d blocks found in xmlIsChar",
6566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006567 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006568 printf(" %d", n_ch);
6569 printf("\n");
6570 }
6571 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006573
Daniel Veillard42595322004-11-08 10:52:06 +00006574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006575}
6576
6577
6578static int
6579test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006581
Daniel Veillard3d97e662004-11-04 10:49:00 +00006582 int mem_base;
6583 int ret_val;
6584 unsigned int ch; /* character to validate */
6585 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006586
Daniel Veillard3d97e662004-11-04 10:49:00 +00006587 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6588 mem_base = xmlMemBlocks();
6589 ch = gen_unsigned_int(n_ch, 0);
6590
6591 ret_val = xmlIsCombining(ch);
6592 desret_int(ret_val);
6593 call_tests++;
6594 des_unsigned_int(n_ch, ch, 0);
6595 xmlResetLastError();
6596 if (mem_base != xmlMemBlocks()) {
6597 printf("Leak of %d blocks found in xmlIsCombining",
6598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006599 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006600 printf(" %d", n_ch);
6601 printf("\n");
6602 }
6603 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006604 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006605
Daniel Veillard42595322004-11-08 10:52:06 +00006606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006607}
6608
6609
6610static int
6611test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006613
Daniel Veillard3d97e662004-11-04 10:49:00 +00006614 int mem_base;
6615 int ret_val;
6616 unsigned int ch; /* character to validate */
6617 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006618
Daniel Veillard3d97e662004-11-04 10:49:00 +00006619 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6620 mem_base = xmlMemBlocks();
6621 ch = gen_unsigned_int(n_ch, 0);
6622
6623 ret_val = xmlIsDigit(ch);
6624 desret_int(ret_val);
6625 call_tests++;
6626 des_unsigned_int(n_ch, ch, 0);
6627 xmlResetLastError();
6628 if (mem_base != xmlMemBlocks()) {
6629 printf("Leak of %d blocks found in xmlIsDigit",
6630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006631 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006632 printf(" %d", n_ch);
6633 printf("\n");
6634 }
6635 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006637
Daniel Veillard42595322004-11-08 10:52:06 +00006638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006639}
6640
6641
6642static int
6643test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006645
Daniel Veillard3d97e662004-11-04 10:49:00 +00006646 int mem_base;
6647 int ret_val;
6648 unsigned int ch; /* character to validate */
6649 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006650
Daniel Veillard3d97e662004-11-04 10:49:00 +00006651 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6652 mem_base = xmlMemBlocks();
6653 ch = gen_unsigned_int(n_ch, 0);
6654
6655 ret_val = xmlIsExtender(ch);
6656 desret_int(ret_val);
6657 call_tests++;
6658 des_unsigned_int(n_ch, ch, 0);
6659 xmlResetLastError();
6660 if (mem_base != xmlMemBlocks()) {
6661 printf("Leak of %d blocks found in xmlIsExtender",
6662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006663 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006664 printf(" %d", n_ch);
6665 printf("\n");
6666 }
6667 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006668 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006669
Daniel Veillard42595322004-11-08 10:52:06 +00006670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006671}
6672
6673
6674static int
6675test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006677
Daniel Veillard3d97e662004-11-04 10:49:00 +00006678 int mem_base;
6679 int ret_val;
6680 unsigned int ch; /* character to validate */
6681 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006682
Daniel Veillard3d97e662004-11-04 10:49:00 +00006683 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6684 mem_base = xmlMemBlocks();
6685 ch = gen_unsigned_int(n_ch, 0);
6686
6687 ret_val = xmlIsIdeographic(ch);
6688 desret_int(ret_val);
6689 call_tests++;
6690 des_unsigned_int(n_ch, ch, 0);
6691 xmlResetLastError();
6692 if (mem_base != xmlMemBlocks()) {
6693 printf("Leak of %d blocks found in xmlIsIdeographic",
6694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006695 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006696 printf(" %d", n_ch);
6697 printf("\n");
6698 }
6699 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006701
Daniel Veillard42595322004-11-08 10:52:06 +00006702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006703}
6704
6705
6706static int
6707test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006709
Daniel Veillard3d97e662004-11-04 10:49:00 +00006710 int mem_base;
6711 int ret_val;
6712 unsigned int ch; /* character to validate */
6713 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006714
Daniel Veillard3d97e662004-11-04 10:49:00 +00006715 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6716 mem_base = xmlMemBlocks();
6717 ch = gen_unsigned_int(n_ch, 0);
6718
6719 ret_val = xmlIsPubidChar(ch);
6720 desret_int(ret_val);
6721 call_tests++;
6722 des_unsigned_int(n_ch, ch, 0);
6723 xmlResetLastError();
6724 if (mem_base != xmlMemBlocks()) {
6725 printf("Leak of %d blocks found in xmlIsPubidChar",
6726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006727 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006728 printf(" %d", n_ch);
6729 printf("\n");
6730 }
6731 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006733
Daniel Veillard42595322004-11-08 10:52:06 +00006734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006735}
6736
6737static int
6738test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006740
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006741 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006742 test_ret += test_xmlCharInRange();
6743 test_ret += test_xmlIsBaseChar();
6744 test_ret += test_xmlIsBlank();
6745 test_ret += test_xmlIsChar();
6746 test_ret += test_xmlIsCombining();
6747 test_ret += test_xmlIsDigit();
6748 test_ret += test_xmlIsExtender();
6749 test_ret += test_xmlIsIdeographic();
6750 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006751
Daniel Veillard42595322004-11-08 10:52:06 +00006752 if (test_ret != 0)
6753 printf("Module chvalid: %d errors\n", test_ret);
6754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006755}
6756
6757static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006758test_xmlBoolToText(void) {
6759 int test_ret = 0;
6760
6761#ifdef LIBXML_DEBUG_ENABLED
6762 int mem_base;
6763 const char * ret_val;
6764 int boolval; /* a bool to turn into text */
6765 int n_boolval;
6766
6767 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6768 mem_base = xmlMemBlocks();
6769 boolval = gen_int(n_boolval, 0);
6770
6771 ret_val = xmlBoolToText(boolval);
6772 desret_const_char_ptr(ret_val);
6773 call_tests++;
6774 des_int(n_boolval, boolval, 0);
6775 xmlResetLastError();
6776 if (mem_base != xmlMemBlocks()) {
6777 printf("Leak of %d blocks found in xmlBoolToText",
6778 xmlMemBlocks() - mem_base);
6779 test_ret++;
6780 printf(" %d", n_boolval);
6781 printf("\n");
6782 }
6783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006784 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006785#endif
6786
Daniel Veillarda82b1822004-11-08 16:24:57 +00006787 return(test_ret);
6788}
6789
6790
6791static int
6792test_xmlDebugCheckDocument(void) {
6793 int test_ret = 0;
6794
6795#ifdef LIBXML_DEBUG_ENABLED
6796 int mem_base;
6797 int ret_val;
6798 FILE * output; /* the FILE * for the output */
6799 int n_output;
6800 xmlDocPtr doc; /* the document */
6801 int n_doc;
6802
6803 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6804 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6805 mem_base = xmlMemBlocks();
6806 output = gen_debug_FILE_ptr(n_output, 0);
6807 doc = gen_xmlDocPtr(n_doc, 1);
6808
6809 ret_val = xmlDebugCheckDocument(output, doc);
6810 desret_int(ret_val);
6811 call_tests++;
6812 des_debug_FILE_ptr(n_output, output, 0);
6813 des_xmlDocPtr(n_doc, doc, 1);
6814 xmlResetLastError();
6815 if (mem_base != xmlMemBlocks()) {
6816 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6817 xmlMemBlocks() - mem_base);
6818 test_ret++;
6819 printf(" %d", n_output);
6820 printf(" %d", n_doc);
6821 printf("\n");
6822 }
6823 }
6824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006825 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006826#endif
6827
Daniel Veillarda82b1822004-11-08 16:24:57 +00006828 return(test_ret);
6829}
6830
6831
6832static int
6833test_xmlDebugDumpAttr(void) {
6834 int test_ret = 0;
6835
6836#ifdef LIBXML_DEBUG_ENABLED
6837 int mem_base;
6838 FILE * output; /* the FILE * for the output */
6839 int n_output;
6840 xmlAttrPtr attr; /* the attribute */
6841 int n_attr;
6842 int depth; /* the indentation level. */
6843 int n_depth;
6844
6845 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6846 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6847 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6848 mem_base = xmlMemBlocks();
6849 output = gen_debug_FILE_ptr(n_output, 0);
6850 attr = gen_xmlAttrPtr(n_attr, 1);
6851 depth = gen_int(n_depth, 2);
6852
6853 xmlDebugDumpAttr(output, attr, depth);
6854 call_tests++;
6855 des_debug_FILE_ptr(n_output, output, 0);
6856 des_xmlAttrPtr(n_attr, attr, 1);
6857 des_int(n_depth, depth, 2);
6858 xmlResetLastError();
6859 if (mem_base != xmlMemBlocks()) {
6860 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6861 xmlMemBlocks() - mem_base);
6862 test_ret++;
6863 printf(" %d", n_output);
6864 printf(" %d", n_attr);
6865 printf(" %d", n_depth);
6866 printf("\n");
6867 }
6868 }
6869 }
6870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006871 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006872#endif
6873
Daniel Veillarda82b1822004-11-08 16:24:57 +00006874 return(test_ret);
6875}
6876
6877
6878static int
6879test_xmlDebugDumpAttrList(void) {
6880 int test_ret = 0;
6881
6882#ifdef LIBXML_DEBUG_ENABLED
6883 int mem_base;
6884 FILE * output; /* the FILE * for the output */
6885 int n_output;
6886 xmlAttrPtr attr; /* the attribute list */
6887 int n_attr;
6888 int depth; /* the indentation level. */
6889 int n_depth;
6890
6891 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6892 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6893 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6894 mem_base = xmlMemBlocks();
6895 output = gen_debug_FILE_ptr(n_output, 0);
6896 attr = gen_xmlAttrPtr(n_attr, 1);
6897 depth = gen_int(n_depth, 2);
6898
6899 xmlDebugDumpAttrList(output, attr, depth);
6900 call_tests++;
6901 des_debug_FILE_ptr(n_output, output, 0);
6902 des_xmlAttrPtr(n_attr, attr, 1);
6903 des_int(n_depth, depth, 2);
6904 xmlResetLastError();
6905 if (mem_base != xmlMemBlocks()) {
6906 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6907 xmlMemBlocks() - mem_base);
6908 test_ret++;
6909 printf(" %d", n_output);
6910 printf(" %d", n_attr);
6911 printf(" %d", n_depth);
6912 printf("\n");
6913 }
6914 }
6915 }
6916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006917 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006918#endif
6919
Daniel Veillarda82b1822004-11-08 16:24:57 +00006920 return(test_ret);
6921}
6922
6923
6924static int
6925test_xmlDebugDumpDTD(void) {
6926 int test_ret = 0;
6927
6928#ifdef LIBXML_DEBUG_ENABLED
6929 int mem_base;
6930 FILE * output; /* the FILE * for the output */
6931 int n_output;
6932 xmlDtdPtr dtd; /* the DTD */
6933 int n_dtd;
6934
6935 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6936 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6937 mem_base = xmlMemBlocks();
6938 output = gen_debug_FILE_ptr(n_output, 0);
6939 dtd = gen_xmlDtdPtr(n_dtd, 1);
6940
6941 xmlDebugDumpDTD(output, dtd);
6942 call_tests++;
6943 des_debug_FILE_ptr(n_output, output, 0);
6944 des_xmlDtdPtr(n_dtd, dtd, 1);
6945 xmlResetLastError();
6946 if (mem_base != xmlMemBlocks()) {
6947 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6948 xmlMemBlocks() - mem_base);
6949 test_ret++;
6950 printf(" %d", n_output);
6951 printf(" %d", n_dtd);
6952 printf("\n");
6953 }
6954 }
6955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006956 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006957#endif
6958
Daniel Veillarda82b1822004-11-08 16:24:57 +00006959 return(test_ret);
6960}
6961
6962
6963static int
6964test_xmlDebugDumpDocument(void) {
6965 int test_ret = 0;
6966
6967#ifdef LIBXML_DEBUG_ENABLED
6968 int mem_base;
6969 FILE * output; /* the FILE * for the output */
6970 int n_output;
6971 xmlDocPtr doc; /* the document */
6972 int n_doc;
6973
6974 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6975 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6976 mem_base = xmlMemBlocks();
6977 output = gen_debug_FILE_ptr(n_output, 0);
6978 doc = gen_xmlDocPtr(n_doc, 1);
6979
6980 xmlDebugDumpDocument(output, doc);
6981 call_tests++;
6982 des_debug_FILE_ptr(n_output, output, 0);
6983 des_xmlDocPtr(n_doc, doc, 1);
6984 xmlResetLastError();
6985 if (mem_base != xmlMemBlocks()) {
6986 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6987 xmlMemBlocks() - mem_base);
6988 test_ret++;
6989 printf(" %d", n_output);
6990 printf(" %d", n_doc);
6991 printf("\n");
6992 }
6993 }
6994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006995 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006996#endif
6997
Daniel Veillarda82b1822004-11-08 16:24:57 +00006998 return(test_ret);
6999}
7000
7001
7002static int
7003test_xmlDebugDumpDocumentHead(void) {
7004 int test_ret = 0;
7005
7006#ifdef LIBXML_DEBUG_ENABLED
7007 int mem_base;
7008 FILE * output; /* the FILE * for the output */
7009 int n_output;
7010 xmlDocPtr doc; /* the document */
7011 int n_doc;
7012
7013 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7014 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7015 mem_base = xmlMemBlocks();
7016 output = gen_debug_FILE_ptr(n_output, 0);
7017 doc = gen_xmlDocPtr(n_doc, 1);
7018
7019 xmlDebugDumpDocumentHead(output, doc);
7020 call_tests++;
7021 des_debug_FILE_ptr(n_output, output, 0);
7022 des_xmlDocPtr(n_doc, doc, 1);
7023 xmlResetLastError();
7024 if (mem_base != xmlMemBlocks()) {
7025 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7026 xmlMemBlocks() - mem_base);
7027 test_ret++;
7028 printf(" %d", n_output);
7029 printf(" %d", n_doc);
7030 printf("\n");
7031 }
7032 }
7033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007034 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007035#endif
7036
Daniel Veillarda82b1822004-11-08 16:24:57 +00007037 return(test_ret);
7038}
7039
7040
7041static int
7042test_xmlDebugDumpEntities(void) {
7043 int test_ret = 0;
7044
7045#ifdef LIBXML_DEBUG_ENABLED
7046 int mem_base;
7047 FILE * output; /* the FILE * for the output */
7048 int n_output;
7049 xmlDocPtr doc; /* the document */
7050 int n_doc;
7051
7052 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7053 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7054 mem_base = xmlMemBlocks();
7055 output = gen_debug_FILE_ptr(n_output, 0);
7056 doc = gen_xmlDocPtr(n_doc, 1);
7057
7058 xmlDebugDumpEntities(output, doc);
7059 call_tests++;
7060 des_debug_FILE_ptr(n_output, output, 0);
7061 des_xmlDocPtr(n_doc, doc, 1);
7062 xmlResetLastError();
7063 if (mem_base != xmlMemBlocks()) {
7064 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7065 xmlMemBlocks() - mem_base);
7066 test_ret++;
7067 printf(" %d", n_output);
7068 printf(" %d", n_doc);
7069 printf("\n");
7070 }
7071 }
7072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007073 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007074#endif
7075
Daniel Veillarda82b1822004-11-08 16:24:57 +00007076 return(test_ret);
7077}
7078
7079
7080static int
7081test_xmlDebugDumpNode(void) {
7082 int test_ret = 0;
7083
7084#ifdef LIBXML_DEBUG_ENABLED
7085 int mem_base;
7086 FILE * output; /* the FILE * for the output */
7087 int n_output;
7088 xmlNodePtr node; /* the node */
7089 int n_node;
7090 int depth; /* the indentation level. */
7091 int n_depth;
7092
7093 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7094 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7095 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7096 mem_base = xmlMemBlocks();
7097 output = gen_debug_FILE_ptr(n_output, 0);
7098 node = gen_xmlNodePtr(n_node, 1);
7099 depth = gen_int(n_depth, 2);
7100
7101 xmlDebugDumpNode(output, node, depth);
7102 call_tests++;
7103 des_debug_FILE_ptr(n_output, output, 0);
7104 des_xmlNodePtr(n_node, node, 1);
7105 des_int(n_depth, depth, 2);
7106 xmlResetLastError();
7107 if (mem_base != xmlMemBlocks()) {
7108 printf("Leak of %d blocks found in xmlDebugDumpNode",
7109 xmlMemBlocks() - mem_base);
7110 test_ret++;
7111 printf(" %d", n_output);
7112 printf(" %d", n_node);
7113 printf(" %d", n_depth);
7114 printf("\n");
7115 }
7116 }
7117 }
7118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007119 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007120#endif
7121
Daniel Veillarda82b1822004-11-08 16:24:57 +00007122 return(test_ret);
7123}
7124
7125
7126static int
7127test_xmlDebugDumpNodeList(void) {
7128 int test_ret = 0;
7129
7130#ifdef LIBXML_DEBUG_ENABLED
7131 int mem_base;
7132 FILE * output; /* the FILE * for the output */
7133 int n_output;
7134 xmlNodePtr node; /* the node list */
7135 int n_node;
7136 int depth; /* the indentation level. */
7137 int n_depth;
7138
7139 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7140 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7141 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7142 mem_base = xmlMemBlocks();
7143 output = gen_debug_FILE_ptr(n_output, 0);
7144 node = gen_xmlNodePtr(n_node, 1);
7145 depth = gen_int(n_depth, 2);
7146
7147 xmlDebugDumpNodeList(output, node, depth);
7148 call_tests++;
7149 des_debug_FILE_ptr(n_output, output, 0);
7150 des_xmlNodePtr(n_node, node, 1);
7151 des_int(n_depth, depth, 2);
7152 xmlResetLastError();
7153 if (mem_base != xmlMemBlocks()) {
7154 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7155 xmlMemBlocks() - mem_base);
7156 test_ret++;
7157 printf(" %d", n_output);
7158 printf(" %d", n_node);
7159 printf(" %d", n_depth);
7160 printf("\n");
7161 }
7162 }
7163 }
7164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007165 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007166#endif
7167
Daniel Veillarda82b1822004-11-08 16:24:57 +00007168 return(test_ret);
7169}
7170
7171
7172static int
7173test_xmlDebugDumpOneNode(void) {
7174 int test_ret = 0;
7175
7176#ifdef LIBXML_DEBUG_ENABLED
7177 int mem_base;
7178 FILE * output; /* the FILE * for the output */
7179 int n_output;
7180 xmlNodePtr node; /* the node */
7181 int n_node;
7182 int depth; /* the indentation level. */
7183 int n_depth;
7184
7185 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7186 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7187 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7188 mem_base = xmlMemBlocks();
7189 output = gen_debug_FILE_ptr(n_output, 0);
7190 node = gen_xmlNodePtr(n_node, 1);
7191 depth = gen_int(n_depth, 2);
7192
7193 xmlDebugDumpOneNode(output, node, depth);
7194 call_tests++;
7195 des_debug_FILE_ptr(n_output, output, 0);
7196 des_xmlNodePtr(n_node, node, 1);
7197 des_int(n_depth, depth, 2);
7198 xmlResetLastError();
7199 if (mem_base != xmlMemBlocks()) {
7200 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7201 xmlMemBlocks() - mem_base);
7202 test_ret++;
7203 printf(" %d", n_output);
7204 printf(" %d", n_node);
7205 printf(" %d", n_depth);
7206 printf("\n");
7207 }
7208 }
7209 }
7210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007211 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007212#endif
7213
Daniel Veillarda82b1822004-11-08 16:24:57 +00007214 return(test_ret);
7215}
7216
7217
7218static int
7219test_xmlDebugDumpString(void) {
7220 int test_ret = 0;
7221
7222#ifdef LIBXML_DEBUG_ENABLED
7223 int mem_base;
7224 FILE * output; /* the FILE * for the output */
7225 int n_output;
7226 xmlChar * str; /* the string */
7227 int n_str;
7228
7229 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7230 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7231 mem_base = xmlMemBlocks();
7232 output = gen_debug_FILE_ptr(n_output, 0);
7233 str = gen_const_xmlChar_ptr(n_str, 1);
7234
William M. Brackf13f77f2004-11-12 16:03:48 +00007235 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007236 call_tests++;
7237 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007238 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007239 xmlResetLastError();
7240 if (mem_base != xmlMemBlocks()) {
7241 printf("Leak of %d blocks found in xmlDebugDumpString",
7242 xmlMemBlocks() - mem_base);
7243 test_ret++;
7244 printf(" %d", n_output);
7245 printf(" %d", n_str);
7246 printf("\n");
7247 }
7248 }
7249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007250 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007251#endif
7252
Daniel Veillarda82b1822004-11-08 16:24:57 +00007253 return(test_ret);
7254}
7255
7256
7257static int
7258test_xmlLsCountNode(void) {
7259 int test_ret = 0;
7260
7261#ifdef LIBXML_DEBUG_ENABLED
7262 int mem_base;
7263 int ret_val;
7264 xmlNodePtr node; /* the node to count */
7265 int n_node;
7266
7267 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7268 mem_base = xmlMemBlocks();
7269 node = gen_xmlNodePtr(n_node, 0);
7270
7271 ret_val = xmlLsCountNode(node);
7272 desret_int(ret_val);
7273 call_tests++;
7274 des_xmlNodePtr(n_node, node, 0);
7275 xmlResetLastError();
7276 if (mem_base != xmlMemBlocks()) {
7277 printf("Leak of %d blocks found in xmlLsCountNode",
7278 xmlMemBlocks() - mem_base);
7279 test_ret++;
7280 printf(" %d", n_node);
7281 printf("\n");
7282 }
7283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007284 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007285#endif
7286
Daniel Veillarda82b1822004-11-08 16:24:57 +00007287 return(test_ret);
7288}
7289
7290
7291static int
7292test_xmlLsOneNode(void) {
7293 int test_ret = 0;
7294
7295#ifdef LIBXML_DEBUG_ENABLED
7296 int mem_base;
7297 FILE * output; /* the FILE * for the output */
7298 int n_output;
7299 xmlNodePtr node; /* the node to dump */
7300 int n_node;
7301
7302 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7303 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7304 mem_base = xmlMemBlocks();
7305 output = gen_debug_FILE_ptr(n_output, 0);
7306 node = gen_xmlNodePtr(n_node, 1);
7307
7308 xmlLsOneNode(output, node);
7309 call_tests++;
7310 des_debug_FILE_ptr(n_output, output, 0);
7311 des_xmlNodePtr(n_node, node, 1);
7312 xmlResetLastError();
7313 if (mem_base != xmlMemBlocks()) {
7314 printf("Leak of %d blocks found in xmlLsOneNode",
7315 xmlMemBlocks() - mem_base);
7316 test_ret++;
7317 printf(" %d", n_output);
7318 printf(" %d", n_node);
7319 printf("\n");
7320 }
7321 }
7322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007323 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007324#endif
7325
Daniel Veillarda82b1822004-11-08 16:24:57 +00007326 return(test_ret);
7327}
7328
7329
7330#define gen_nb_char_ptr 1
7331static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7332 return(NULL);
7333}
7334static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7335}
7336
7337static int
7338test_xmlShell(void) {
7339 int test_ret = 0;
7340
7341
7342 /* missing type support */
7343 return(test_ret);
7344}
7345
7346
Daniel Veillarda82b1822004-11-08 16:24:57 +00007347static int
7348test_xmlShellBase(void) {
7349 int test_ret = 0;
7350
7351#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007352#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007353 int mem_base;
7354 int ret_val;
7355 xmlShellCtxtPtr ctxt; /* the shell context */
7356 int n_ctxt;
7357 char * arg; /* unused */
7358 int n_arg;
7359 xmlNodePtr node; /* a node */
7360 int n_node;
7361 xmlNodePtr node2; /* unused */
7362 int n_node2;
7363
7364 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7365 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7366 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7367 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7368 mem_base = xmlMemBlocks();
7369 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7370 arg = gen_char_ptr(n_arg, 1);
7371 node = gen_xmlNodePtr(n_node, 2);
7372 node2 = gen_xmlNodePtr(n_node2, 3);
7373
7374 ret_val = xmlShellBase(ctxt, arg, node, node2);
7375 desret_int(ret_val);
7376 call_tests++;
7377 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7378 des_char_ptr(n_arg, arg, 1);
7379 des_xmlNodePtr(n_node, node, 2);
7380 des_xmlNodePtr(n_node2, node2, 3);
7381 xmlResetLastError();
7382 if (mem_base != xmlMemBlocks()) {
7383 printf("Leak of %d blocks found in xmlShellBase",
7384 xmlMemBlocks() - mem_base);
7385 test_ret++;
7386 printf(" %d", n_ctxt);
7387 printf(" %d", n_arg);
7388 printf(" %d", n_node);
7389 printf(" %d", n_node2);
7390 printf("\n");
7391 }
7392 }
7393 }
7394 }
7395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007396 function_tests++;
7397#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007398#endif
7399
Daniel Veillarda82b1822004-11-08 16:24:57 +00007400 return(test_ret);
7401}
7402
7403
7404static int
7405test_xmlShellCat(void) {
7406 int test_ret = 0;
7407
7408#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007409#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007410 int mem_base;
7411 int ret_val;
7412 xmlShellCtxtPtr ctxt; /* the shell context */
7413 int n_ctxt;
7414 char * arg; /* unused */
7415 int n_arg;
7416 xmlNodePtr node; /* a node */
7417 int n_node;
7418 xmlNodePtr node2; /* unused */
7419 int n_node2;
7420
7421 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7422 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7423 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7424 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7425 mem_base = xmlMemBlocks();
7426 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7427 arg = gen_char_ptr(n_arg, 1);
7428 node = gen_xmlNodePtr(n_node, 2);
7429 node2 = gen_xmlNodePtr(n_node2, 3);
7430
7431 ret_val = xmlShellCat(ctxt, arg, node, node2);
7432 desret_int(ret_val);
7433 call_tests++;
7434 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7435 des_char_ptr(n_arg, arg, 1);
7436 des_xmlNodePtr(n_node, node, 2);
7437 des_xmlNodePtr(n_node2, node2, 3);
7438 xmlResetLastError();
7439 if (mem_base != xmlMemBlocks()) {
7440 printf("Leak of %d blocks found in xmlShellCat",
7441 xmlMemBlocks() - mem_base);
7442 test_ret++;
7443 printf(" %d", n_ctxt);
7444 printf(" %d", n_arg);
7445 printf(" %d", n_node);
7446 printf(" %d", n_node2);
7447 printf("\n");
7448 }
7449 }
7450 }
7451 }
7452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007453 function_tests++;
7454#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007455#endif
7456
Daniel Veillarda82b1822004-11-08 16:24:57 +00007457 return(test_ret);
7458}
7459
7460
7461static int
7462test_xmlShellDir(void) {
7463 int test_ret = 0;
7464
7465#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007466#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007467 int mem_base;
7468 int ret_val;
7469 xmlShellCtxtPtr ctxt; /* the shell context */
7470 int n_ctxt;
7471 char * arg; /* unused */
7472 int n_arg;
7473 xmlNodePtr node; /* a node */
7474 int n_node;
7475 xmlNodePtr node2; /* unused */
7476 int n_node2;
7477
7478 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7479 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7480 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7481 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7482 mem_base = xmlMemBlocks();
7483 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7484 arg = gen_char_ptr(n_arg, 1);
7485 node = gen_xmlNodePtr(n_node, 2);
7486 node2 = gen_xmlNodePtr(n_node2, 3);
7487
7488 ret_val = xmlShellDir(ctxt, arg, node, node2);
7489 desret_int(ret_val);
7490 call_tests++;
7491 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7492 des_char_ptr(n_arg, arg, 1);
7493 des_xmlNodePtr(n_node, node, 2);
7494 des_xmlNodePtr(n_node2, node2, 3);
7495 xmlResetLastError();
7496 if (mem_base != xmlMemBlocks()) {
7497 printf("Leak of %d blocks found in xmlShellDir",
7498 xmlMemBlocks() - mem_base);
7499 test_ret++;
7500 printf(" %d", n_ctxt);
7501 printf(" %d", n_arg);
7502 printf(" %d", n_node);
7503 printf(" %d", n_node2);
7504 printf("\n");
7505 }
7506 }
7507 }
7508 }
7509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007510 function_tests++;
7511#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007512#endif
7513
Daniel Veillarda82b1822004-11-08 16:24:57 +00007514 return(test_ret);
7515}
7516
7517
7518static int
7519test_xmlShellDu(void) {
7520 int test_ret = 0;
7521
7522#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007523#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007524 int mem_base;
7525 int ret_val;
7526 xmlShellCtxtPtr ctxt; /* the shell context */
7527 int n_ctxt;
7528 char * arg; /* unused */
7529 int n_arg;
7530 xmlNodePtr tree; /* a node defining a subtree */
7531 int n_tree;
7532 xmlNodePtr node2; /* unused */
7533 int n_node2;
7534
7535 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7536 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7537 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7538 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7539 mem_base = xmlMemBlocks();
7540 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7541 arg = gen_char_ptr(n_arg, 1);
7542 tree = gen_xmlNodePtr(n_tree, 2);
7543 node2 = gen_xmlNodePtr(n_node2, 3);
7544
7545 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7546 desret_int(ret_val);
7547 call_tests++;
7548 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7549 des_char_ptr(n_arg, arg, 1);
7550 des_xmlNodePtr(n_tree, tree, 2);
7551 des_xmlNodePtr(n_node2, node2, 3);
7552 xmlResetLastError();
7553 if (mem_base != xmlMemBlocks()) {
7554 printf("Leak of %d blocks found in xmlShellDu",
7555 xmlMemBlocks() - mem_base);
7556 test_ret++;
7557 printf(" %d", n_ctxt);
7558 printf(" %d", n_arg);
7559 printf(" %d", n_tree);
7560 printf(" %d", n_node2);
7561 printf("\n");
7562 }
7563 }
7564 }
7565 }
7566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007567 function_tests++;
7568#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007569#endif
7570
Daniel Veillarda82b1822004-11-08 16:24:57 +00007571 return(test_ret);
7572}
7573
7574
7575static int
7576test_xmlShellList(void) {
7577 int test_ret = 0;
7578
7579#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007580#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007581 int mem_base;
7582 int ret_val;
7583 xmlShellCtxtPtr ctxt; /* the shell context */
7584 int n_ctxt;
7585 char * arg; /* unused */
7586 int n_arg;
7587 xmlNodePtr node; /* a node */
7588 int n_node;
7589 xmlNodePtr node2; /* unused */
7590 int n_node2;
7591
7592 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7593 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7594 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7595 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7596 mem_base = xmlMemBlocks();
7597 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7598 arg = gen_char_ptr(n_arg, 1);
7599 node = gen_xmlNodePtr(n_node, 2);
7600 node2 = gen_xmlNodePtr(n_node2, 3);
7601
7602 ret_val = xmlShellList(ctxt, arg, node, node2);
7603 desret_int(ret_val);
7604 call_tests++;
7605 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7606 des_char_ptr(n_arg, arg, 1);
7607 des_xmlNodePtr(n_node, node, 2);
7608 des_xmlNodePtr(n_node2, node2, 3);
7609 xmlResetLastError();
7610 if (mem_base != xmlMemBlocks()) {
7611 printf("Leak of %d blocks found in xmlShellList",
7612 xmlMemBlocks() - mem_base);
7613 test_ret++;
7614 printf(" %d", n_ctxt);
7615 printf(" %d", n_arg);
7616 printf(" %d", n_node);
7617 printf(" %d", n_node2);
7618 printf("\n");
7619 }
7620 }
7621 }
7622 }
7623 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007624 function_tests++;
7625#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007626#endif
7627
Daniel Veillarda82b1822004-11-08 16:24:57 +00007628 return(test_ret);
7629}
7630
7631
7632static int
7633test_xmlShellLoad(void) {
7634 int test_ret = 0;
7635
7636#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007637#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007638 int mem_base;
7639 int ret_val;
7640 xmlShellCtxtPtr ctxt; /* the shell context */
7641 int n_ctxt;
7642 char * filename; /* the file name */
7643 int n_filename;
7644 xmlNodePtr node; /* unused */
7645 int n_node;
7646 xmlNodePtr node2; /* unused */
7647 int n_node2;
7648
7649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7650 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7651 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7652 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7653 mem_base = xmlMemBlocks();
7654 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7655 filename = gen_char_ptr(n_filename, 1);
7656 node = gen_xmlNodePtr(n_node, 2);
7657 node2 = gen_xmlNodePtr(n_node2, 3);
7658
7659 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7660 desret_int(ret_val);
7661 call_tests++;
7662 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7663 des_char_ptr(n_filename, filename, 1);
7664 des_xmlNodePtr(n_node, node, 2);
7665 des_xmlNodePtr(n_node2, node2, 3);
7666 xmlResetLastError();
7667 if (mem_base != xmlMemBlocks()) {
7668 printf("Leak of %d blocks found in xmlShellLoad",
7669 xmlMemBlocks() - mem_base);
7670 test_ret++;
7671 printf(" %d", n_ctxt);
7672 printf(" %d", n_filename);
7673 printf(" %d", n_node);
7674 printf(" %d", n_node2);
7675 printf("\n");
7676 }
7677 }
7678 }
7679 }
7680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007681 function_tests++;
7682#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007683#endif
7684
Daniel Veillarda82b1822004-11-08 16:24:57 +00007685 return(test_ret);
7686}
7687
7688
7689static int
7690test_xmlShellPrintXPathResult(void) {
7691 int test_ret = 0;
7692
7693#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007694#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007695 int mem_base;
7696 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7697 int n_list;
7698
7699 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7700 mem_base = xmlMemBlocks();
7701 list = gen_xmlXPathObjectPtr(n_list, 0);
7702
7703 xmlShellPrintXPathResult(list);
7704 call_tests++;
7705 des_xmlXPathObjectPtr(n_list, list, 0);
7706 xmlResetLastError();
7707 if (mem_base != xmlMemBlocks()) {
7708 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7709 xmlMemBlocks() - mem_base);
7710 test_ret++;
7711 printf(" %d", n_list);
7712 printf("\n");
7713 }
7714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007715 function_tests++;
7716#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007717#endif
7718
Daniel Veillarda82b1822004-11-08 16:24:57 +00007719 return(test_ret);
7720}
7721
7722
7723static int
7724test_xmlShellPwd(void) {
7725 int test_ret = 0;
7726
7727#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007728#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007729 int mem_base;
7730 int ret_val;
7731 xmlShellCtxtPtr ctxt; /* the shell context */
7732 int n_ctxt;
7733 char * buffer; /* the output buffer */
7734 int n_buffer;
7735 xmlNodePtr node; /* a node */
7736 int n_node;
7737 xmlNodePtr node2; /* unused */
7738 int n_node2;
7739
7740 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7741 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7742 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7743 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7744 mem_base = xmlMemBlocks();
7745 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7746 buffer = gen_char_ptr(n_buffer, 1);
7747 node = gen_xmlNodePtr(n_node, 2);
7748 node2 = gen_xmlNodePtr(n_node2, 3);
7749
7750 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7751 desret_int(ret_val);
7752 call_tests++;
7753 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7754 des_char_ptr(n_buffer, buffer, 1);
7755 des_xmlNodePtr(n_node, node, 2);
7756 des_xmlNodePtr(n_node2, node2, 3);
7757 xmlResetLastError();
7758 if (mem_base != xmlMemBlocks()) {
7759 printf("Leak of %d blocks found in xmlShellPwd",
7760 xmlMemBlocks() - mem_base);
7761 test_ret++;
7762 printf(" %d", n_ctxt);
7763 printf(" %d", n_buffer);
7764 printf(" %d", n_node);
7765 printf(" %d", n_node2);
7766 printf("\n");
7767 }
7768 }
7769 }
7770 }
7771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007772 function_tests++;
7773#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007774#endif
7775
Daniel Veillarda82b1822004-11-08 16:24:57 +00007776 return(test_ret);
7777}
7778
7779
7780static int
7781test_xmlShellSave(void) {
7782 int test_ret = 0;
7783
7784#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007785#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007786#ifdef LIBXML_OUTPUT_ENABLED
7787 int mem_base;
7788 int ret_val;
7789 xmlShellCtxtPtr ctxt; /* the shell context */
7790 int n_ctxt;
7791 char * filename; /* the file name (optional) */
7792 int n_filename;
7793 xmlNodePtr node; /* unused */
7794 int n_node;
7795 xmlNodePtr node2; /* unused */
7796 int n_node2;
7797
7798 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7799 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7800 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7801 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7802 mem_base = xmlMemBlocks();
7803 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7804 filename = gen_char_ptr(n_filename, 1);
7805 node = gen_xmlNodePtr(n_node, 2);
7806 node2 = gen_xmlNodePtr(n_node2, 3);
7807
7808 ret_val = xmlShellSave(ctxt, filename, node, node2);
7809 desret_int(ret_val);
7810 call_tests++;
7811 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7812 des_char_ptr(n_filename, filename, 1);
7813 des_xmlNodePtr(n_node, node, 2);
7814 des_xmlNodePtr(n_node2, node2, 3);
7815 xmlResetLastError();
7816 if (mem_base != xmlMemBlocks()) {
7817 printf("Leak of %d blocks found in xmlShellSave",
7818 xmlMemBlocks() - mem_base);
7819 test_ret++;
7820 printf(" %d", n_ctxt);
7821 printf(" %d", n_filename);
7822 printf(" %d", n_node);
7823 printf(" %d", n_node2);
7824 printf("\n");
7825 }
7826 }
7827 }
7828 }
7829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007830 function_tests++;
7831#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007832#endif
7833#endif
7834
Daniel Veillarda82b1822004-11-08 16:24:57 +00007835 return(test_ret);
7836}
7837
7838
7839static int
7840test_xmlShellValidate(void) {
7841 int test_ret = 0;
7842
7843#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007844#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007845 int mem_base;
7846 int ret_val;
7847 xmlShellCtxtPtr ctxt; /* the shell context */
7848 int n_ctxt;
7849 char * dtd; /* the DTD URI (optional) */
7850 int n_dtd;
7851 xmlNodePtr node; /* unused */
7852 int n_node;
7853 xmlNodePtr node2; /* unused */
7854 int n_node2;
7855
7856 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7857 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7858 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7859 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7860 mem_base = xmlMemBlocks();
7861 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7862 dtd = gen_char_ptr(n_dtd, 1);
7863 node = gen_xmlNodePtr(n_node, 2);
7864 node2 = gen_xmlNodePtr(n_node2, 3);
7865
7866 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7867 desret_int(ret_val);
7868 call_tests++;
7869 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7870 des_char_ptr(n_dtd, dtd, 1);
7871 des_xmlNodePtr(n_node, node, 2);
7872 des_xmlNodePtr(n_node2, node2, 3);
7873 xmlResetLastError();
7874 if (mem_base != xmlMemBlocks()) {
7875 printf("Leak of %d blocks found in xmlShellValidate",
7876 xmlMemBlocks() - mem_base);
7877 test_ret++;
7878 printf(" %d", n_ctxt);
7879 printf(" %d", n_dtd);
7880 printf(" %d", n_node);
7881 printf(" %d", n_node2);
7882 printf("\n");
7883 }
7884 }
7885 }
7886 }
7887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007888 function_tests++;
7889#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007890#endif
7891
Daniel Veillarda82b1822004-11-08 16:24:57 +00007892 return(test_ret);
7893}
7894
7895
7896static int
7897test_xmlShellWrite(void) {
7898 int test_ret = 0;
7899
7900#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007901#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007902#ifdef LIBXML_OUTPUT_ENABLED
7903 int mem_base;
7904 int ret_val;
7905 xmlShellCtxtPtr ctxt; /* the shell context */
7906 int n_ctxt;
7907 char * filename; /* the file name */
7908 int n_filename;
7909 xmlNodePtr node; /* a node in the tree */
7910 int n_node;
7911 xmlNodePtr node2; /* unused */
7912 int n_node2;
7913
7914 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7915 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7916 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7917 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7918 mem_base = xmlMemBlocks();
7919 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7920 filename = gen_char_ptr(n_filename, 1);
7921 node = gen_xmlNodePtr(n_node, 2);
7922 node2 = gen_xmlNodePtr(n_node2, 3);
7923
7924 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7925 desret_int(ret_val);
7926 call_tests++;
7927 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7928 des_char_ptr(n_filename, filename, 1);
7929 des_xmlNodePtr(n_node, node, 2);
7930 des_xmlNodePtr(n_node2, node2, 3);
7931 xmlResetLastError();
7932 if (mem_base != xmlMemBlocks()) {
7933 printf("Leak of %d blocks found in xmlShellWrite",
7934 xmlMemBlocks() - mem_base);
7935 test_ret++;
7936 printf(" %d", n_ctxt);
7937 printf(" %d", n_filename);
7938 printf(" %d", n_node);
7939 printf(" %d", n_node2);
7940 printf("\n");
7941 }
7942 }
7943 }
7944 }
7945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007946 function_tests++;
7947#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007948#endif
7949#endif
7950
Daniel Veillarda82b1822004-11-08 16:24:57 +00007951 return(test_ret);
7952}
7953
7954static int
7955test_debugXML(void) {
7956 int test_ret = 0;
7957
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007958 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007959 test_ret += test_xmlBoolToText();
7960 test_ret += test_xmlDebugCheckDocument();
7961 test_ret += test_xmlDebugDumpAttr();
7962 test_ret += test_xmlDebugDumpAttrList();
7963 test_ret += test_xmlDebugDumpDTD();
7964 test_ret += test_xmlDebugDumpDocument();
7965 test_ret += test_xmlDebugDumpDocumentHead();
7966 test_ret += test_xmlDebugDumpEntities();
7967 test_ret += test_xmlDebugDumpNode();
7968 test_ret += test_xmlDebugDumpNodeList();
7969 test_ret += test_xmlDebugDumpOneNode();
7970 test_ret += test_xmlDebugDumpString();
7971 test_ret += test_xmlLsCountNode();
7972 test_ret += test_xmlLsOneNode();
7973 test_ret += test_xmlShell();
7974 test_ret += test_xmlShellBase();
7975 test_ret += test_xmlShellCat();
7976 test_ret += test_xmlShellDir();
7977 test_ret += test_xmlShellDu();
7978 test_ret += test_xmlShellList();
7979 test_ret += test_xmlShellLoad();
7980 test_ret += test_xmlShellPrintXPathResult();
7981 test_ret += test_xmlShellPwd();
7982 test_ret += test_xmlShellSave();
7983 test_ret += test_xmlShellValidate();
7984 test_ret += test_xmlShellWrite();
7985
7986 if (test_ret != 0)
7987 printf("Module debugXML: %d errors\n", test_ret);
7988 return(test_ret);
7989}
7990
7991static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00007992test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007994
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007995 int mem_base;
7996 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007997
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007998 mem_base = xmlMemBlocks();
7999
8000 ret_val = xmlDictCreate();
8001 desret_xmlDictPtr(ret_val);
8002 call_tests++;
8003 xmlResetLastError();
8004 if (mem_base != xmlMemBlocks()) {
8005 printf("Leak of %d blocks found in xmlDictCreate",
8006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008007 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008008 printf("\n");
8009 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008011
Daniel Veillard42595322004-11-08 10:52:06 +00008012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008013}
8014
8015
8016static int
8017test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008019
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008020 int mem_base;
8021 xmlDictPtr ret_val;
8022 xmlDictPtr sub; /* an existing dictionnary */
8023 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008024
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008025 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8026 mem_base = xmlMemBlocks();
8027 sub = gen_xmlDictPtr(n_sub, 0);
8028
8029 ret_val = xmlDictCreateSub(sub);
8030 desret_xmlDictPtr(ret_val);
8031 call_tests++;
8032 des_xmlDictPtr(n_sub, sub, 0);
8033 xmlResetLastError();
8034 if (mem_base != xmlMemBlocks()) {
8035 printf("Leak of %d blocks found in xmlDictCreateSub",
8036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008037 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008038 printf(" %d", n_sub);
8039 printf("\n");
8040 }
8041 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008042 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008043
Daniel Veillard42595322004-11-08 10:52:06 +00008044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008045}
8046
8047
8048static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008049test_xmlDictExists(void) {
8050 int test_ret = 0;
8051
8052 int mem_base;
8053 const xmlChar * ret_val;
8054 xmlDictPtr dict; /* the dictionnary */
8055 int n_dict;
8056 xmlChar * name; /* the name of the userdata */
8057 int n_name;
8058 int len; /* the length of the name, if -1 it is recomputed */
8059 int n_len;
8060
8061 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8062 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8063 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8064 mem_base = xmlMemBlocks();
8065 dict = gen_xmlDictPtr(n_dict, 0);
8066 name = gen_const_xmlChar_ptr(n_name, 1);
8067 len = gen_int(n_len, 2);
8068
8069 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8070 desret_const_xmlChar_ptr(ret_val);
8071 call_tests++;
8072 des_xmlDictPtr(n_dict, dict, 0);
8073 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8074 des_int(n_len, len, 2);
8075 xmlResetLastError();
8076 if (mem_base != xmlMemBlocks()) {
8077 printf("Leak of %d blocks found in xmlDictExists",
8078 xmlMemBlocks() - mem_base);
8079 test_ret++;
8080 printf(" %d", n_dict);
8081 printf(" %d", n_name);
8082 printf(" %d", n_len);
8083 printf("\n");
8084 }
8085 }
8086 }
8087 }
8088 function_tests++;
8089
8090 return(test_ret);
8091}
8092
8093
8094static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008095test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008097
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008098 int mem_base;
8099 const xmlChar * ret_val;
8100 xmlDictPtr dict; /* the dictionnary */
8101 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008102 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008103 int n_name;
8104 int len; /* the length of the name, if -1 it is recomputed */
8105 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008106
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008107 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8108 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8109 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8110 mem_base = xmlMemBlocks();
8111 dict = gen_xmlDictPtr(n_dict, 0);
8112 name = gen_const_xmlChar_ptr(n_name, 1);
8113 len = gen_int(n_len, 2);
8114
William M. Brackf13f77f2004-11-12 16:03:48 +00008115 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008116 desret_const_xmlChar_ptr(ret_val);
8117 call_tests++;
8118 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008119 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008120 des_int(n_len, len, 2);
8121 xmlResetLastError();
8122 if (mem_base != xmlMemBlocks()) {
8123 printf("Leak of %d blocks found in xmlDictLookup",
8124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008125 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008126 printf(" %d", n_dict);
8127 printf(" %d", n_name);
8128 printf(" %d", n_len);
8129 printf("\n");
8130 }
8131 }
8132 }
8133 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008134 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008135
Daniel Veillard42595322004-11-08 10:52:06 +00008136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008137}
8138
8139
8140static int
8141test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008143
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008144 int mem_base;
8145 int ret_val;
8146 xmlDictPtr dict; /* the dictionnary */
8147 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008148 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008149 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008150
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008151 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8152 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8153 mem_base = xmlMemBlocks();
8154 dict = gen_xmlDictPtr(n_dict, 0);
8155 str = gen_const_xmlChar_ptr(n_str, 1);
8156
William M. Brackf13f77f2004-11-12 16:03:48 +00008157 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008158 desret_int(ret_val);
8159 call_tests++;
8160 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008161 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008162 xmlResetLastError();
8163 if (mem_base != xmlMemBlocks()) {
8164 printf("Leak of %d blocks found in xmlDictOwns",
8165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008166 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008167 printf(" %d", n_dict);
8168 printf(" %d", n_str);
8169 printf("\n");
8170 }
8171 }
8172 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008173 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008174
Daniel Veillard42595322004-11-08 10:52:06 +00008175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008176}
8177
8178
8179static int
8180test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008182
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008183 int mem_base;
8184 const xmlChar * ret_val;
8185 xmlDictPtr dict; /* the dictionnary */
8186 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008187 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008188 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008189 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008190 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008191
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008192 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8193 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8194 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8195 mem_base = xmlMemBlocks();
8196 dict = gen_xmlDictPtr(n_dict, 0);
8197 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8198 name = gen_const_xmlChar_ptr(n_name, 2);
8199
William M. Brackf13f77f2004-11-12 16:03:48 +00008200 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008201 desret_const_xmlChar_ptr(ret_val);
8202 call_tests++;
8203 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008204 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8205 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008206 xmlResetLastError();
8207 if (mem_base != xmlMemBlocks()) {
8208 printf("Leak of %d blocks found in xmlDictQLookup",
8209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008210 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008211 printf(" %d", n_dict);
8212 printf(" %d", n_prefix);
8213 printf(" %d", n_name);
8214 printf("\n");
8215 }
8216 }
8217 }
8218 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008219 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008220
Daniel Veillard42595322004-11-08 10:52:06 +00008221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008222}
8223
8224
8225static int
8226test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008228
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008229 int mem_base;
8230 int ret_val;
8231 xmlDictPtr dict; /* the dictionnary */
8232 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008233
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008234 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8235 mem_base = xmlMemBlocks();
8236 dict = gen_xmlDictPtr(n_dict, 0);
8237
8238 ret_val = xmlDictReference(dict);
8239 xmlDictFree(dict);
8240 desret_int(ret_val);
8241 call_tests++;
8242 des_xmlDictPtr(n_dict, dict, 0);
8243 xmlResetLastError();
8244 if (mem_base != xmlMemBlocks()) {
8245 printf("Leak of %d blocks found in xmlDictReference",
8246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008247 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008248 printf(" %d", n_dict);
8249 printf("\n");
8250 }
8251 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008252 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008253
Daniel Veillard42595322004-11-08 10:52:06 +00008254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008255}
8256
8257
8258static int
8259test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008261
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008262 int mem_base;
8263 int ret_val;
8264 xmlDictPtr dict; /* the dictionnary */
8265 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008266
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008267 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8268 mem_base = xmlMemBlocks();
8269 dict = gen_xmlDictPtr(n_dict, 0);
8270
8271 ret_val = xmlDictSize(dict);
8272 desret_int(ret_val);
8273 call_tests++;
8274 des_xmlDictPtr(n_dict, dict, 0);
8275 xmlResetLastError();
8276 if (mem_base != xmlMemBlocks()) {
8277 printf("Leak of %d blocks found in xmlDictSize",
8278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008279 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008280 printf(" %d", n_dict);
8281 printf("\n");
8282 }
8283 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008284 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008285
Daniel Veillard42595322004-11-08 10:52:06 +00008286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008287}
8288
8289static int
8290test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008292
Daniel Veillard91b955c2004-12-10 10:26:42 +00008293 if (quiet == 0) printf("Testing dict : 8 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008294 test_ret += test_xmlDictCreate();
8295 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008296 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008297 test_ret += test_xmlDictLookup();
8298 test_ret += test_xmlDictOwns();
8299 test_ret += test_xmlDictQLookup();
8300 test_ret += test_xmlDictReference();
8301 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008302
Daniel Veillard42595322004-11-08 10:52:06 +00008303 if (test_ret != 0)
8304 printf("Module dict: %d errors\n", test_ret);
8305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008306}
8307
8308static int
8309test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008311
Daniel Veillarda521d282004-11-09 14:59:59 +00008312#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008313 int mem_base;
8314 int ret_val;
8315 unsigned char * out; /* a pointer to an array of bytes to store the result */
8316 int n_out;
8317 int * outlen; /* the length of @out */
8318 int n_outlen;
8319 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8320 int n_in;
8321 int * inlen; /* the length of @in */
8322 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008323
Daniel Veillardce682bc2004-11-05 17:22:25 +00008324 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8325 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8326 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8327 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8328 mem_base = xmlMemBlocks();
8329 out = gen_unsigned_char_ptr(n_out, 0);
8330 outlen = gen_int_ptr(n_outlen, 1);
8331 in = gen_const_unsigned_char_ptr(n_in, 2);
8332 inlen = gen_int_ptr(n_inlen, 3);
8333
William M. Brackf13f77f2004-11-12 16:03:48 +00008334 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008335 desret_int(ret_val);
8336 call_tests++;
8337 des_unsigned_char_ptr(n_out, out, 0);
8338 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008339 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008340 des_int_ptr(n_inlen, inlen, 3);
8341 xmlResetLastError();
8342 if (mem_base != xmlMemBlocks()) {
8343 printf("Leak of %d blocks found in UTF8Toisolat1",
8344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008345 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008346 printf(" %d", n_out);
8347 printf(" %d", n_outlen);
8348 printf(" %d", n_in);
8349 printf(" %d", n_inlen);
8350 printf("\n");
8351 }
8352 }
8353 }
8354 }
8355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008356 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008357#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008358
Daniel Veillard42595322004-11-08 10:52:06 +00008359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008360}
8361
8362
8363static int
8364test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008366
Daniel Veillardce682bc2004-11-05 17:22:25 +00008367 int mem_base;
8368 int ret_val;
8369 unsigned char * out; /* a pointer to an array of bytes to store the result */
8370 int n_out;
8371 int * outlen; /* the length of @out */
8372 int n_outlen;
8373 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8374 int n_in;
8375 int * inlen; /* the length of @in */
8376 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008377
Daniel Veillardce682bc2004-11-05 17:22:25 +00008378 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8379 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8380 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8381 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8382 mem_base = xmlMemBlocks();
8383 out = gen_unsigned_char_ptr(n_out, 0);
8384 outlen = gen_int_ptr(n_outlen, 1);
8385 in = gen_const_unsigned_char_ptr(n_in, 2);
8386 inlen = gen_int_ptr(n_inlen, 3);
8387
William M. Brackf13f77f2004-11-12 16:03:48 +00008388 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008389 desret_int(ret_val);
8390 call_tests++;
8391 des_unsigned_char_ptr(n_out, out, 0);
8392 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008393 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008394 des_int_ptr(n_inlen, inlen, 3);
8395 xmlResetLastError();
8396 if (mem_base != xmlMemBlocks()) {
8397 printf("Leak of %d blocks found in isolat1ToUTF8",
8398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008399 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008400 printf(" %d", n_out);
8401 printf(" %d", n_outlen);
8402 printf(" %d", n_in);
8403 printf(" %d", n_inlen);
8404 printf("\n");
8405 }
8406 }
8407 }
8408 }
8409 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008410 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008411
Daniel Veillard42595322004-11-08 10:52:06 +00008412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008413}
8414
8415
8416static int
8417test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008419
8420 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008421 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008422 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008423 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008424 int n_alias;
8425
8426 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8427 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008428 name = gen_const_char_ptr(n_name, 0);
8429 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008430
William M. Brackf13f77f2004-11-12 16:03:48 +00008431 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008432 desret_int(ret_val);
8433 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008434 des_const_char_ptr(n_name, (const char *)name, 0);
8435 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008436 xmlResetLastError();
8437 }
8438 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008439 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008440
Daniel Veillard42595322004-11-08 10:52:06 +00008441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008442}
8443
8444
Daniel Veillardce682bc2004-11-05 17:22:25 +00008445#define gen_nb_xmlCharEncodingHandler_ptr 1
8446static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8447 return(NULL);
8448}
8449static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8450}
8451
Daniel Veillardd93f6252004-11-02 15:53:51 +00008452static int
8453test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008455
Daniel Veillardce682bc2004-11-05 17:22:25 +00008456 int mem_base;
8457 int ret_val;
8458 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8459 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008460
Daniel Veillardce682bc2004-11-05 17:22:25 +00008461 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8462 mem_base = xmlMemBlocks();
8463 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8464
8465 ret_val = xmlCharEncCloseFunc(handler);
8466 desret_int(ret_val);
8467 call_tests++;
8468 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8469 xmlResetLastError();
8470 if (mem_base != xmlMemBlocks()) {
8471 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008473 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008474 printf(" %d", n_handler);
8475 printf("\n");
8476 }
8477 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008478 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008479
Daniel Veillard42595322004-11-08 10:52:06 +00008480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008481}
8482
8483
8484static int
8485test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008487
Daniel Veillardce682bc2004-11-05 17:22:25 +00008488 int mem_base;
8489 int ret_val;
8490 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8491 int n_handler;
8492 xmlBufferPtr out; /* an xmlBuffer for the output. */
8493 int n_out;
8494 xmlBufferPtr in; /* an xmlBuffer for the input */
8495 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008496
Daniel Veillardce682bc2004-11-05 17:22:25 +00008497 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8498 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8499 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8500 mem_base = xmlMemBlocks();
8501 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8502 out = gen_xmlBufferPtr(n_out, 1);
8503 in = gen_xmlBufferPtr(n_in, 2);
8504
8505 ret_val = xmlCharEncFirstLine(handler, out, in);
8506 desret_int(ret_val);
8507 call_tests++;
8508 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8509 des_xmlBufferPtr(n_out, out, 1);
8510 des_xmlBufferPtr(n_in, in, 2);
8511 xmlResetLastError();
8512 if (mem_base != xmlMemBlocks()) {
8513 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008516 printf(" %d", n_handler);
8517 printf(" %d", n_out);
8518 printf(" %d", n_in);
8519 printf("\n");
8520 }
8521 }
8522 }
8523 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008525
Daniel Veillard42595322004-11-08 10:52:06 +00008526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008527}
8528
8529
8530static int
8531test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008533
Daniel Veillardce682bc2004-11-05 17:22:25 +00008534 int mem_base;
8535 int ret_val;
8536 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8537 int n_handler;
8538 xmlBufferPtr out; /* an xmlBuffer for the output. */
8539 int n_out;
8540 xmlBufferPtr in; /* an xmlBuffer for the input */
8541 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008542
Daniel Veillardce682bc2004-11-05 17:22:25 +00008543 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8544 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8545 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8546 mem_base = xmlMemBlocks();
8547 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8548 out = gen_xmlBufferPtr(n_out, 1);
8549 in = gen_xmlBufferPtr(n_in, 2);
8550
8551 ret_val = xmlCharEncInFunc(handler, out, in);
8552 desret_int(ret_val);
8553 call_tests++;
8554 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8555 des_xmlBufferPtr(n_out, out, 1);
8556 des_xmlBufferPtr(n_in, in, 2);
8557 xmlResetLastError();
8558 if (mem_base != xmlMemBlocks()) {
8559 printf("Leak of %d blocks found in xmlCharEncInFunc",
8560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008561 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008562 printf(" %d", n_handler);
8563 printf(" %d", n_out);
8564 printf(" %d", n_in);
8565 printf("\n");
8566 }
8567 }
8568 }
8569 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008570 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008571
Daniel Veillard42595322004-11-08 10:52:06 +00008572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008573}
8574
8575
8576static int
8577test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008579
Daniel Veillardce682bc2004-11-05 17:22:25 +00008580 int mem_base;
8581 int ret_val;
8582 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8583 int n_handler;
8584 xmlBufferPtr out; /* an xmlBuffer for the output. */
8585 int n_out;
8586 xmlBufferPtr in; /* an xmlBuffer for the input */
8587 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008588
Daniel Veillardce682bc2004-11-05 17:22:25 +00008589 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8590 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8591 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8592 mem_base = xmlMemBlocks();
8593 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8594 out = gen_xmlBufferPtr(n_out, 1);
8595 in = gen_xmlBufferPtr(n_in, 2);
8596
8597 ret_val = xmlCharEncOutFunc(handler, out, in);
8598 desret_int(ret_val);
8599 call_tests++;
8600 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8601 des_xmlBufferPtr(n_out, out, 1);
8602 des_xmlBufferPtr(n_in, in, 2);
8603 xmlResetLastError();
8604 if (mem_base != xmlMemBlocks()) {
8605 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008607 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008608 printf(" %d", n_handler);
8609 printf(" %d", n_out);
8610 printf(" %d", n_in);
8611 printf("\n");
8612 }
8613 }
8614 }
8615 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008616 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008617
Daniel Veillard42595322004-11-08 10:52:06 +00008618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008619}
8620
8621
8622static int
8623test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008625
8626
8627
8628 xmlCleanupCharEncodingHandlers();
8629 call_tests++;
8630 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008631 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008632
Daniel Veillard42595322004-11-08 10:52:06 +00008633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008634}
8635
8636
8637static int
8638test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008640
8641 int mem_base;
8642
8643 mem_base = xmlMemBlocks();
8644
8645 xmlCleanupEncodingAliases();
8646 call_tests++;
8647 xmlResetLastError();
8648 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008649 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008651 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008652 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008653 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008655
Daniel Veillard42595322004-11-08 10:52:06 +00008656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008657}
8658
8659
8660static int
8661test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008663
8664 int mem_base;
8665 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008666 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008667 int n_alias;
8668
8669 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008671 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008672
William M. Brackf13f77f2004-11-12 16:03:48 +00008673 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008674 desret_int(ret_val);
8675 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008676 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008677 xmlResetLastError();
8678 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008679 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008681 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008682 printf(" %d", n_alias);
8683 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008684 }
8685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008687
Daniel Veillard42595322004-11-08 10:52:06 +00008688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008689}
8690
8691
8692static int
8693test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695
Daniel Veillardce682bc2004-11-05 17:22:25 +00008696 int mem_base;
8697 xmlCharEncoding ret_val;
8698 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). */
8699 int n_in;
8700 int len; /* pointer to the length of the buffer */
8701 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008702
Daniel Veillardce682bc2004-11-05 17:22:25 +00008703 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8704 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8705 mem_base = xmlMemBlocks();
8706 in = gen_const_unsigned_char_ptr(n_in, 0);
8707 len = gen_int(n_len, 1);
8708
William M. Brackf13f77f2004-11-12 16:03:48 +00008709 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008710 desret_xmlCharEncoding(ret_val);
8711 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008712 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008713 des_int(n_len, len, 1);
8714 xmlResetLastError();
8715 if (mem_base != xmlMemBlocks()) {
8716 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008718 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008719 printf(" %d", n_in);
8720 printf(" %d", n_len);
8721 printf("\n");
8722 }
8723 }
8724 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008725 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008726
Daniel Veillard42595322004-11-08 10:52:06 +00008727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008728}
8729
8730
8731static int
8732test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008734
8735
8736 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008738}
8739
8740
8741static int
8742test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008744
8745
8746 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008748}
8749
8750
8751static int
8752test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008754
Daniel Veillard3d97e662004-11-04 10:49:00 +00008755 int mem_base;
8756 const char * ret_val;
8757 xmlCharEncoding enc; /* the encoding */
8758 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008759
Daniel Veillard3d97e662004-11-04 10:49:00 +00008760 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8761 mem_base = xmlMemBlocks();
8762 enc = gen_xmlCharEncoding(n_enc, 0);
8763
8764 ret_val = xmlGetCharEncodingName(enc);
8765 desret_const_char_ptr(ret_val);
8766 call_tests++;
8767 des_xmlCharEncoding(n_enc, enc, 0);
8768 xmlResetLastError();
8769 if (mem_base != xmlMemBlocks()) {
8770 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008772 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008773 printf(" %d", n_enc);
8774 printf("\n");
8775 }
8776 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008778
Daniel Veillard42595322004-11-08 10:52:06 +00008779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008780}
8781
8782
8783static int
8784test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008786
8787 int mem_base;
8788 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008789 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008790 int n_alias;
8791
8792 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008794 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008795
William M. Brackf13f77f2004-11-12 16:03:48 +00008796 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008797 desret_const_char_ptr(ret_val);
8798 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008799 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008800 xmlResetLastError();
8801 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008802 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008804 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008805 printf(" %d", n_alias);
8806 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008807 }
8808 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008809 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008810
Daniel Veillard42595322004-11-08 10:52:06 +00008811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008812}
8813
8814
8815static int
8816test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818
8819
8820
8821 xmlInitCharEncodingHandlers();
8822 call_tests++;
8823 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008824 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008825
Daniel Veillard42595322004-11-08 10:52:06 +00008826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008827}
8828
8829
8830static int
8831test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008833
8834
8835 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008837}
8838
8839
8840static int
8841test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008843
Daniel Veillard3d97e662004-11-04 10:49:00 +00008844 int mem_base;
8845 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008846 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008847 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008848
Daniel Veillard3d97e662004-11-04 10:49:00 +00008849 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8850 mem_base = xmlMemBlocks();
8851 name = gen_const_char_ptr(n_name, 0);
8852
William M. Brackf13f77f2004-11-12 16:03:48 +00008853 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008854 desret_xmlCharEncoding(ret_val);
8855 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008856 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008857 xmlResetLastError();
8858 if (mem_base != xmlMemBlocks()) {
8859 printf("Leak of %d blocks found in xmlParseCharEncoding",
8860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008861 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008862 printf(" %d", n_name);
8863 printf("\n");
8864 }
8865 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008867
Daniel Veillard42595322004-11-08 10:52:06 +00008868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008869}
8870
8871
Daniel Veillardce682bc2004-11-05 17:22:25 +00008872#define gen_nb_xmlCharEncodingHandlerPtr 1
8873static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8874 return(NULL);
8875}
8876static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8877}
8878
Daniel Veillardd93f6252004-11-02 15:53:51 +00008879static int
8880test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008882
Daniel Veillardce682bc2004-11-05 17:22:25 +00008883 int mem_base;
8884 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8885 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008886
Daniel Veillardce682bc2004-11-05 17:22:25 +00008887 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8888 mem_base = xmlMemBlocks();
8889 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8890
8891 xmlRegisterCharEncodingHandler(handler);
8892 call_tests++;
8893 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8894 xmlResetLastError();
8895 if (mem_base != xmlMemBlocks()) {
8896 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008898 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008899 printf(" %d", n_handler);
8900 printf("\n");
8901 }
8902 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008903 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008904
Daniel Veillard42595322004-11-08 10:52:06 +00008905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008906}
8907
8908static int
8909test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008911
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008912 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008913 test_ret += test_UTF8Toisolat1();
8914 test_ret += test_isolat1ToUTF8();
8915 test_ret += test_xmlAddEncodingAlias();
8916 test_ret += test_xmlCharEncCloseFunc();
8917 test_ret += test_xmlCharEncFirstLine();
8918 test_ret += test_xmlCharEncInFunc();
8919 test_ret += test_xmlCharEncOutFunc();
8920 test_ret += test_xmlCleanupCharEncodingHandlers();
8921 test_ret += test_xmlCleanupEncodingAliases();
8922 test_ret += test_xmlDelEncodingAlias();
8923 test_ret += test_xmlDetectCharEncoding();
8924 test_ret += test_xmlFindCharEncodingHandler();
8925 test_ret += test_xmlGetCharEncodingHandler();
8926 test_ret += test_xmlGetCharEncodingName();
8927 test_ret += test_xmlGetEncodingAlias();
8928 test_ret += test_xmlInitCharEncodingHandlers();
8929 test_ret += test_xmlNewCharEncodingHandler();
8930 test_ret += test_xmlParseCharEncoding();
8931 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008932
Daniel Veillard42595322004-11-08 10:52:06 +00008933 if (test_ret != 0)
8934 printf("Module encoding: %d errors\n", test_ret);
8935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008936}
8937
8938static int
8939test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008941
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008942 int mem_base;
8943 xmlEntityPtr ret_val;
8944 xmlDocPtr doc; /* the document */
8945 int n_doc;
8946 xmlChar * name; /* the entity name */
8947 int n_name;
8948 int type; /* the entity type XML_xxx_yyy_ENTITY */
8949 int n_type;
8950 xmlChar * ExternalID; /* the entity external ID if available */
8951 int n_ExternalID;
8952 xmlChar * SystemID; /* the entity system ID if available */
8953 int n_SystemID;
8954 xmlChar * content; /* the entity content */
8955 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008956
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008957 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8958 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8959 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8960 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8961 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8962 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8963 mem_base = xmlMemBlocks();
8964 doc = gen_xmlDocPtr(n_doc, 0);
8965 name = gen_const_xmlChar_ptr(n_name, 1);
8966 type = gen_int(n_type, 2);
8967 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8968 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8969 content = gen_const_xmlChar_ptr(n_content, 5);
8970
William M. Brackf13f77f2004-11-12 16:03:48 +00008971 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008972 desret_xmlEntityPtr(ret_val);
8973 call_tests++;
8974 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008975 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008976 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008977 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8978 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8979 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008980 xmlResetLastError();
8981 if (mem_base != xmlMemBlocks()) {
8982 printf("Leak of %d blocks found in xmlAddDocEntity",
8983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008984 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008985 printf(" %d", n_doc);
8986 printf(" %d", n_name);
8987 printf(" %d", n_type);
8988 printf(" %d", n_ExternalID);
8989 printf(" %d", n_SystemID);
8990 printf(" %d", n_content);
8991 printf("\n");
8992 }
8993 }
8994 }
8995 }
8996 }
8997 }
8998 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +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_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009008
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009009 int mem_base;
9010 xmlEntityPtr ret_val;
9011 xmlDocPtr doc; /* the document */
9012 int n_doc;
9013 xmlChar * name; /* the entity name */
9014 int n_name;
9015 int type; /* the entity type XML_xxx_yyy_ENTITY */
9016 int n_type;
9017 xmlChar * ExternalID; /* the entity external ID if available */
9018 int n_ExternalID;
9019 xmlChar * SystemID; /* the entity system ID if available */
9020 int n_SystemID;
9021 xmlChar * content; /* the entity content */
9022 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009023
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009024 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9025 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9026 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9027 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9028 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9029 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9030 mem_base = xmlMemBlocks();
9031 doc = gen_xmlDocPtr(n_doc, 0);
9032 name = gen_const_xmlChar_ptr(n_name, 1);
9033 type = gen_int(n_type, 2);
9034 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9035 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9036 content = gen_const_xmlChar_ptr(n_content, 5);
9037
William M. Brackf13f77f2004-11-12 16:03:48 +00009038 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009039 desret_xmlEntityPtr(ret_val);
9040 call_tests++;
9041 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009042 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009043 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009044 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9045 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9046 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009047 xmlResetLastError();
9048 if (mem_base != xmlMemBlocks()) {
9049 printf("Leak of %d blocks found in xmlAddDtdEntity",
9050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009051 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009052 printf(" %d", n_doc);
9053 printf(" %d", n_name);
9054 printf(" %d", n_type);
9055 printf(" %d", n_ExternalID);
9056 printf(" %d", n_SystemID);
9057 printf(" %d", n_content);
9058 printf("\n");
9059 }
9060 }
9061 }
9062 }
9063 }
9064 }
9065 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009066 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009067
Daniel Veillard42595322004-11-08 10:52:06 +00009068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009069}
9070
9071
9072static int
9073test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009075
Daniel Veillarda521d282004-11-09 14:59:59 +00009076#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009077 int mem_base;
9078
9079 mem_base = xmlMemBlocks();
9080
9081 xmlCleanupPredefinedEntities();
9082 call_tests++;
9083 xmlResetLastError();
9084 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009085 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009087 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009088 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009090 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009091#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009092
Daniel Veillard42595322004-11-08 10:52:06 +00009093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009094}
9095
9096
Daniel Veillardce682bc2004-11-05 17:22:25 +00009097#define gen_nb_xmlEntitiesTablePtr 1
9098static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9099 return(NULL);
9100}
9101static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9102}
9103
Daniel Veillardd93f6252004-11-02 15:53:51 +00009104static int
9105test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009107
9108
9109 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009111}
9112
9113
9114static int
9115test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009117
9118
9119 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009121}
9122
9123
9124static int
9125test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009127
Daniel Veillardce682bc2004-11-05 17:22:25 +00009128#ifdef LIBXML_OUTPUT_ENABLED
9129 int mem_base;
9130 xmlBufferPtr buf; /* An XML buffer. */
9131 int n_buf;
9132 xmlEntitiesTablePtr table; /* An entity table */
9133 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009134
Daniel Veillardce682bc2004-11-05 17:22:25 +00009135 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9136 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9137 mem_base = xmlMemBlocks();
9138 buf = gen_xmlBufferPtr(n_buf, 0);
9139 table = gen_xmlEntitiesTablePtr(n_table, 1);
9140
9141 xmlDumpEntitiesTable(buf, table);
9142 call_tests++;
9143 des_xmlBufferPtr(n_buf, buf, 0);
9144 des_xmlEntitiesTablePtr(n_table, table, 1);
9145 xmlResetLastError();
9146 if (mem_base != xmlMemBlocks()) {
9147 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009149 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009150 printf(" %d", n_buf);
9151 printf(" %d", n_table);
9152 printf("\n");
9153 }
9154 }
9155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009156 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009157#endif
9158
Daniel Veillard42595322004-11-08 10:52:06 +00009159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009160}
9161
9162
Daniel Veillardce682bc2004-11-05 17:22:25 +00009163#define gen_nb_xmlEntityPtr 1
9164static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9165 return(NULL);
9166}
9167static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9168}
9169
Daniel Veillardd93f6252004-11-02 15:53:51 +00009170static int
9171test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009173
Daniel Veillardce682bc2004-11-05 17:22:25 +00009174#ifdef LIBXML_OUTPUT_ENABLED
9175 int mem_base;
9176 xmlBufferPtr buf; /* An XML buffer. */
9177 int n_buf;
9178 xmlEntityPtr ent; /* An entity table */
9179 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009180
Daniel Veillardce682bc2004-11-05 17:22:25 +00009181 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9182 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9183 mem_base = xmlMemBlocks();
9184 buf = gen_xmlBufferPtr(n_buf, 0);
9185 ent = gen_xmlEntityPtr(n_ent, 1);
9186
9187 xmlDumpEntityDecl(buf, ent);
9188 call_tests++;
9189 des_xmlBufferPtr(n_buf, buf, 0);
9190 des_xmlEntityPtr(n_ent, ent, 1);
9191 xmlResetLastError();
9192 if (mem_base != xmlMemBlocks()) {
9193 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009195 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009196 printf(" %d", n_buf);
9197 printf(" %d", n_ent);
9198 printf("\n");
9199 }
9200 }
9201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009202 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009203#endif
9204
Daniel Veillard42595322004-11-08 10:52:06 +00009205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009206}
9207
9208
9209static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009210test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009212
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009213 int mem_base;
9214 xmlChar * ret_val;
9215 xmlDocPtr doc; /* the document containing the string */
9216 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009217 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009218 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009219
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009220 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9221 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9222 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009223 doc = gen_xmlDocPtr(n_doc, 0);
9224 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009225
William M. Brackf13f77f2004-11-12 16:03:48 +00009226 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009227 desret_xmlChar_ptr(ret_val);
9228 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009229 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009230 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009231 xmlResetLastError();
9232 if (mem_base != xmlMemBlocks()) {
9233 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009235 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009236 printf(" %d", n_doc);
9237 printf(" %d", n_input);
9238 printf("\n");
9239 }
9240 }
9241 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009243
Daniel Veillard42595322004-11-08 10:52:06 +00009244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009245}
9246
9247
9248static int
9249test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009251
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009252 int mem_base;
9253 xmlChar * ret_val;
9254 xmlDocPtr doc; /* the document containing the string */
9255 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009256 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009257 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009258
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009259 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9260 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9261 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009262 doc = gen_xmlDocPtr(n_doc, 0);
9263 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009264
William M. Brackf13f77f2004-11-12 16:03:48 +00009265 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009266 desret_xmlChar_ptr(ret_val);
9267 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009268 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009269 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009270 xmlResetLastError();
9271 if (mem_base != xmlMemBlocks()) {
9272 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009274 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009275 printf(" %d", n_doc);
9276 printf(" %d", n_input);
9277 printf("\n");
9278 }
9279 }
9280 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009281 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009282
Daniel Veillard42595322004-11-08 10:52:06 +00009283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009284}
9285
9286
9287static int
9288test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009290
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009291 int mem_base;
9292 xmlEntityPtr ret_val;
9293 xmlDocPtr doc; /* the document referencing the entity */
9294 int n_doc;
9295 xmlChar * name; /* the entity name */
9296 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009297
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009298 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9299 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9300 mem_base = xmlMemBlocks();
9301 doc = gen_xmlDocPtr(n_doc, 0);
9302 name = gen_const_xmlChar_ptr(n_name, 1);
9303
William M. Brackf13f77f2004-11-12 16:03:48 +00009304 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009305 desret_xmlEntityPtr(ret_val);
9306 call_tests++;
9307 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009308 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009309 xmlResetLastError();
9310 if (mem_base != xmlMemBlocks()) {
9311 printf("Leak of %d blocks found in xmlGetDocEntity",
9312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009313 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009314 printf(" %d", n_doc);
9315 printf(" %d", n_name);
9316 printf("\n");
9317 }
9318 }
9319 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009320 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009321
Daniel Veillard42595322004-11-08 10:52:06 +00009322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009323}
9324
9325
9326static int
9327test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009329
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009330 int mem_base;
9331 xmlEntityPtr ret_val;
9332 xmlDocPtr doc; /* the document referencing the entity */
9333 int n_doc;
9334 xmlChar * name; /* the entity name */
9335 int n_name;
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 mem_base = xmlMemBlocks();
9340 doc = gen_xmlDocPtr(n_doc, 0);
9341 name = gen_const_xmlChar_ptr(n_name, 1);
9342
William M. Brackf13f77f2004-11-12 16:03:48 +00009343 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009344 desret_xmlEntityPtr(ret_val);
9345 call_tests++;
9346 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009347 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009348 xmlResetLastError();
9349 if (mem_base != xmlMemBlocks()) {
9350 printf("Leak of %d blocks found in xmlGetDtdEntity",
9351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009352 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009353 printf(" %d", n_doc);
9354 printf(" %d", n_name);
9355 printf("\n");
9356 }
9357 }
9358 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009359 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009360
Daniel Veillard42595322004-11-08 10:52:06 +00009361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009362}
9363
9364
9365static int
9366test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009368
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009369 int mem_base;
9370 xmlEntityPtr ret_val;
9371 xmlDocPtr doc; /* the document referencing the entity */
9372 int n_doc;
9373 xmlChar * name; /* the entity name */
9374 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009375
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009376 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9377 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9378 mem_base = xmlMemBlocks();
9379 doc = gen_xmlDocPtr(n_doc, 0);
9380 name = gen_const_xmlChar_ptr(n_name, 1);
9381
William M. Brackf13f77f2004-11-12 16:03:48 +00009382 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009383 desret_xmlEntityPtr(ret_val);
9384 call_tests++;
9385 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009386 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009387 xmlResetLastError();
9388 if (mem_base != xmlMemBlocks()) {
9389 printf("Leak of %d blocks found in xmlGetParameterEntity",
9390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009391 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009392 printf(" %d", n_doc);
9393 printf(" %d", n_name);
9394 printf("\n");
9395 }
9396 }
9397 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009398 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009399
Daniel Veillard42595322004-11-08 10:52:06 +00009400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009401}
9402
9403
9404static int
9405test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009407
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009408 int mem_base;
9409 xmlEntityPtr ret_val;
9410 xmlChar * name; /* the entity name */
9411 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009412
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009413 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9414 mem_base = xmlMemBlocks();
9415 name = gen_const_xmlChar_ptr(n_name, 0);
9416
William M. Brackf13f77f2004-11-12 16:03:48 +00009417 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009418 desret_xmlEntityPtr(ret_val);
9419 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009420 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009421 xmlResetLastError();
9422 if (mem_base != xmlMemBlocks()) {
9423 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009425 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009426 printf(" %d", n_name);
9427 printf("\n");
9428 }
9429 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009431
Daniel Veillard42595322004-11-08 10:52:06 +00009432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009433}
9434
9435
9436static int
9437test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009439
Daniel Veillarda521d282004-11-09 14:59:59 +00009440#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009441 int mem_base;
9442
9443 mem_base = xmlMemBlocks();
9444
9445 xmlInitializePredefinedEntities();
9446 call_tests++;
9447 xmlResetLastError();
9448 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009449 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009451 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009452 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009454 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009455#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009456
Daniel Veillard42595322004-11-08 10:52:06 +00009457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009458}
9459
9460static int
9461test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009463
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009464 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009465 test_ret += test_xmlAddDocEntity();
9466 test_ret += test_xmlAddDtdEntity();
9467 test_ret += test_xmlCleanupPredefinedEntities();
9468 test_ret += test_xmlCopyEntitiesTable();
9469 test_ret += test_xmlCreateEntitiesTable();
9470 test_ret += test_xmlDumpEntitiesTable();
9471 test_ret += test_xmlDumpEntityDecl();
9472 test_ret += test_xmlEncodeEntitiesReentrant();
9473 test_ret += test_xmlEncodeSpecialChars();
9474 test_ret += test_xmlGetDocEntity();
9475 test_ret += test_xmlGetDtdEntity();
9476 test_ret += test_xmlGetParameterEntity();
9477 test_ret += test_xmlGetPredefinedEntity();
9478 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009479
Daniel Veillard42595322004-11-08 10:52:06 +00009480 if (test_ret != 0)
9481 printf("Module entities: %d errors\n", test_ret);
9482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009483}
9484
9485static int
9486test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009488
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009489 int mem_base;
9490 int ret_val;
9491 xmlHashTablePtr table; /* the hash table */
9492 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009493 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009494 int n_name;
9495 void * userdata; /* a pointer to the userdata */
9496 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009497
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009498 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9499 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9500 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9501 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009502 table = gen_xmlHashTablePtr(n_table, 0);
9503 name = gen_const_xmlChar_ptr(n_name, 1);
9504 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009505
William M. Brackf13f77f2004-11-12 16:03:48 +00009506 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009507 desret_int(ret_val);
9508 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009509 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009510 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009511 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009512 xmlResetLastError();
9513 if (mem_base != xmlMemBlocks()) {
9514 printf("Leak of %d blocks found in xmlHashAddEntry",
9515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009516 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009517 printf(" %d", n_table);
9518 printf(" %d", n_name);
9519 printf(" %d", n_userdata);
9520 printf("\n");
9521 }
9522 }
9523 }
9524 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009525 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009526
Daniel Veillard42595322004-11-08 10:52:06 +00009527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009528}
9529
9530
9531static int
9532test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009534
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009535 int mem_base;
9536 int ret_val;
9537 xmlHashTablePtr table; /* the hash table */
9538 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009539 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009540 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009541 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009542 int n_name2;
9543 void * userdata; /* a pointer to the userdata */
9544 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009545
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009546 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9548 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9549 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9550 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009551 table = gen_xmlHashTablePtr(n_table, 0);
9552 name = gen_const_xmlChar_ptr(n_name, 1);
9553 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9554 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009555
William M. Brackf13f77f2004-11-12 16:03:48 +00009556 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009557 desret_int(ret_val);
9558 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009559 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009560 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9561 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009562 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009563 xmlResetLastError();
9564 if (mem_base != xmlMemBlocks()) {
9565 printf("Leak of %d blocks found in xmlHashAddEntry2",
9566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009567 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009568 printf(" %d", n_table);
9569 printf(" %d", n_name);
9570 printf(" %d", n_name2);
9571 printf(" %d", n_userdata);
9572 printf("\n");
9573 }
9574 }
9575 }
9576 }
9577 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009578 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009579
Daniel Veillard42595322004-11-08 10:52:06 +00009580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009581}
9582
9583
9584static int
9585test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009587
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009588 int mem_base;
9589 int ret_val;
9590 xmlHashTablePtr table; /* the hash table */
9591 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009592 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009593 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009594 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009595 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009596 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009597 int n_name3;
9598 void * userdata; /* a pointer to the userdata */
9599 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009600
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009601 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9602 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9603 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9604 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9605 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9606 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009607 table = gen_xmlHashTablePtr(n_table, 0);
9608 name = gen_const_xmlChar_ptr(n_name, 1);
9609 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9610 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9611 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009612
William M. Brackf13f77f2004-11-12 16:03:48 +00009613 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009614 desret_int(ret_val);
9615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009616 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009617 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9618 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9619 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009620 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009621 xmlResetLastError();
9622 if (mem_base != xmlMemBlocks()) {
9623 printf("Leak of %d blocks found in xmlHashAddEntry3",
9624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009625 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009626 printf(" %d", n_table);
9627 printf(" %d", n_name);
9628 printf(" %d", n_name2);
9629 printf(" %d", n_name3);
9630 printf(" %d", n_userdata);
9631 printf("\n");
9632 }
9633 }
9634 }
9635 }
9636 }
9637 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009638 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009639
Daniel Veillard42595322004-11-08 10:52:06 +00009640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009641}
9642
9643
9644static int
9645test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009647
9648
9649 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009651}
9652
9653
9654static int
9655test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009657
9658
9659 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009661}
9662
9663
9664static int
9665test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009667
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009668 int mem_base;
9669 void * ret_val;
9670 xmlHashTablePtr table; /* the hash table */
9671 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009672 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009673 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009674
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009675 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9676 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9677 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009678 table = gen_xmlHashTablePtr(n_table, 0);
9679 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009680
William M. Brackf13f77f2004-11-12 16:03:48 +00009681 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009682 desret_void_ptr(ret_val);
9683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009684 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009685 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009686 xmlResetLastError();
9687 if (mem_base != xmlMemBlocks()) {
9688 printf("Leak of %d blocks found in xmlHashLookup",
9689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009690 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009691 printf(" %d", n_table);
9692 printf(" %d", n_name);
9693 printf("\n");
9694 }
9695 }
9696 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009698
Daniel Veillard42595322004-11-08 10:52:06 +00009699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009700}
9701
9702
9703static int
9704test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009706
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009707 int mem_base;
9708 void * ret_val;
9709 xmlHashTablePtr table; /* the hash table */
9710 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009711 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009712 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009713 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009714 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009715
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009716 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9717 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9718 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009720 table = gen_xmlHashTablePtr(n_table, 0);
9721 name = gen_const_xmlChar_ptr(n_name, 1);
9722 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009723
William M. Brackf13f77f2004-11-12 16:03:48 +00009724 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009725 desret_void_ptr(ret_val);
9726 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009727 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009728 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9729 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009730 xmlResetLastError();
9731 if (mem_base != xmlMemBlocks()) {
9732 printf("Leak of %d blocks found in xmlHashLookup2",
9733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009734 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009735 printf(" %d", n_table);
9736 printf(" %d", n_name);
9737 printf(" %d", n_name2);
9738 printf("\n");
9739 }
9740 }
9741 }
9742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +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_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009752
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009753 int mem_base;
9754 void * ret_val;
9755 xmlHashTablePtr table; /* the hash table */
9756 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009757 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009758 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009759 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009760 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009761 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009762 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009763
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009764 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9765 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9766 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9767 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009769 table = gen_xmlHashTablePtr(n_table, 0);
9770 name = gen_const_xmlChar_ptr(n_name, 1);
9771 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9772 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009773
William M. Brackf13f77f2004-11-12 16:03:48 +00009774 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009775 desret_void_ptr(ret_val);
9776 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009777 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009778 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9779 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9780 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009781 xmlResetLastError();
9782 if (mem_base != xmlMemBlocks()) {
9783 printf("Leak of %d blocks found in xmlHashLookup3",
9784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009785 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009786 printf(" %d", n_table);
9787 printf(" %d", n_name);
9788 printf(" %d", n_name2);
9789 printf(" %d", n_name3);
9790 printf("\n");
9791 }
9792 }
9793 }
9794 }
9795 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009796 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009797
Daniel Veillard42595322004-11-08 10:52:06 +00009798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009799}
9800
9801
9802static int
9803test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009805
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009806 int mem_base;
9807 void * ret_val;
9808 xmlHashTablePtr table; /* the hash table */
9809 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009810 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009811 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009812 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009813 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009814
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009815 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9816 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9817 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9818 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009819 table = gen_xmlHashTablePtr(n_table, 0);
9820 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9821 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009822
William M. Brackf13f77f2004-11-12 16:03:48 +00009823 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009824 desret_void_ptr(ret_val);
9825 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009826 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009827 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9828 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009829 xmlResetLastError();
9830 if (mem_base != xmlMemBlocks()) {
9831 printf("Leak of %d blocks found in xmlHashQLookup",
9832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009833 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009834 printf(" %d", n_table);
9835 printf(" %d", n_prefix);
9836 printf(" %d", n_name);
9837 printf("\n");
9838 }
9839 }
9840 }
9841 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009842 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009843
Daniel Veillard42595322004-11-08 10:52:06 +00009844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009845}
9846
9847
9848static int
9849test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009851
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009852 int mem_base;
9853 void * ret_val;
9854 xmlHashTablePtr table; /* the hash table */
9855 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009856 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009857 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009858 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009859 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009860 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009861 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009862 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009863 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009864
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009865 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9866 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9867 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9868 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9869 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9870 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009871 table = gen_xmlHashTablePtr(n_table, 0);
9872 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9873 name = gen_const_xmlChar_ptr(n_name, 2);
9874 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9875 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009876
William M. Brackf13f77f2004-11-12 16:03:48 +00009877 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009878 desret_void_ptr(ret_val);
9879 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009880 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009881 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9882 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9883 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9884 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009885 xmlResetLastError();
9886 if (mem_base != xmlMemBlocks()) {
9887 printf("Leak of %d blocks found in xmlHashQLookup2",
9888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009889 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009890 printf(" %d", n_table);
9891 printf(" %d", n_prefix);
9892 printf(" %d", n_name);
9893 printf(" %d", n_prefix2);
9894 printf(" %d", n_name2);
9895 printf("\n");
9896 }
9897 }
9898 }
9899 }
9900 }
9901 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009902 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009903
Daniel Veillard42595322004-11-08 10:52:06 +00009904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009905}
9906
9907
9908static int
9909test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009911
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009912 int mem_base;
9913 void * ret_val;
9914 xmlHashTablePtr table; /* the hash table */
9915 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009916 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009917 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009918 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009919 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009920 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009921 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009922 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009923 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009924 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009925 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009926 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009927 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009928
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009929 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9930 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9931 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9932 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9933 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9934 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9935 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009937 table = gen_xmlHashTablePtr(n_table, 0);
9938 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9939 name = gen_const_xmlChar_ptr(n_name, 2);
9940 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9941 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9942 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9943 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009944
William M. Brackf13f77f2004-11-12 16:03:48 +00009945 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 +00009946 desret_void_ptr(ret_val);
9947 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009948 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009949 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9950 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9951 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9952 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9953 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9954 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009955 xmlResetLastError();
9956 if (mem_base != xmlMemBlocks()) {
9957 printf("Leak of %d blocks found in xmlHashQLookup3",
9958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009959 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009960 printf(" %d", n_table);
9961 printf(" %d", n_prefix);
9962 printf(" %d", n_name);
9963 printf(" %d", n_prefix2);
9964 printf(" %d", n_name2);
9965 printf(" %d", n_prefix3);
9966 printf(" %d", n_name3);
9967 printf("\n");
9968 }
9969 }
9970 }
9971 }
9972 }
9973 }
9974 }
9975 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009976 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009977
Daniel Veillard42595322004-11-08 10:52:06 +00009978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009979}
9980
9981
9982static int
9983test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009985
Daniel Veillard42595322004-11-08 10:52:06 +00009986 int mem_base;
9987 int ret_val;
9988 xmlHashTablePtr table; /* the hash table */
9989 int n_table;
9990 xmlChar * name; /* the name of the userdata */
9991 int n_name;
9992 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9993 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009994
Daniel Veillard42595322004-11-08 10:52:06 +00009995 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9996 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9997 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9998 mem_base = xmlMemBlocks();
9999 table = gen_xmlHashTablePtr(n_table, 0);
10000 name = gen_const_xmlChar_ptr(n_name, 1);
10001 f = gen_xmlHashDeallocator(n_f, 2);
10002
William M. Brackf13f77f2004-11-12 16:03:48 +000010003 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010004 desret_int(ret_val);
10005 call_tests++;
10006 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010007 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010008 des_xmlHashDeallocator(n_f, f, 2);
10009 xmlResetLastError();
10010 if (mem_base != xmlMemBlocks()) {
10011 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10012 xmlMemBlocks() - mem_base);
10013 test_ret++;
10014 printf(" %d", n_table);
10015 printf(" %d", n_name);
10016 printf(" %d", n_f);
10017 printf("\n");
10018 }
10019 }
10020 }
10021 }
Daniel Veillard42595322004-11-08 10:52:06 +000010022 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010023
Daniel Veillard42595322004-11-08 10:52:06 +000010024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010025}
10026
10027
10028static int
10029test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010031
Daniel Veillard42595322004-11-08 10:52:06 +000010032 int mem_base;
10033 int ret_val;
10034 xmlHashTablePtr table; /* the hash table */
10035 int n_table;
10036 xmlChar * name; /* the name of the userdata */
10037 int n_name;
10038 xmlChar * name2; /* a second name of the userdata */
10039 int n_name2;
10040 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10041 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010042
Daniel Veillard42595322004-11-08 10:52:06 +000010043 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10044 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10045 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10046 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10047 mem_base = xmlMemBlocks();
10048 table = gen_xmlHashTablePtr(n_table, 0);
10049 name = gen_const_xmlChar_ptr(n_name, 1);
10050 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10051 f = gen_xmlHashDeallocator(n_f, 3);
10052
William M. Brackf13f77f2004-11-12 16:03:48 +000010053 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010054 desret_int(ret_val);
10055 call_tests++;
10056 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010057 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10058 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010059 des_xmlHashDeallocator(n_f, f, 3);
10060 xmlResetLastError();
10061 if (mem_base != xmlMemBlocks()) {
10062 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10063 xmlMemBlocks() - mem_base);
10064 test_ret++;
10065 printf(" %d", n_table);
10066 printf(" %d", n_name);
10067 printf(" %d", n_name2);
10068 printf(" %d", n_f);
10069 printf("\n");
10070 }
10071 }
10072 }
10073 }
10074 }
Daniel Veillard42595322004-11-08 10:52:06 +000010075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010076
Daniel Veillard42595322004-11-08 10:52:06 +000010077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010078}
10079
10080
10081static int
10082test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010084
Daniel Veillard42595322004-11-08 10:52:06 +000010085 int mem_base;
10086 int ret_val;
10087 xmlHashTablePtr table; /* the hash table */
10088 int n_table;
10089 xmlChar * name; /* the name of the userdata */
10090 int n_name;
10091 xmlChar * name2; /* a second name of the userdata */
10092 int n_name2;
10093 xmlChar * name3; /* a third name of the userdata */
10094 int n_name3;
10095 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10096 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010097
Daniel Veillard42595322004-11-08 10:52:06 +000010098 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10099 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10100 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10101 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10102 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10103 mem_base = xmlMemBlocks();
10104 table = gen_xmlHashTablePtr(n_table, 0);
10105 name = gen_const_xmlChar_ptr(n_name, 1);
10106 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10107 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10108 f = gen_xmlHashDeallocator(n_f, 4);
10109
William M. Brackf13f77f2004-11-12 16:03:48 +000010110 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010111 desret_int(ret_val);
10112 call_tests++;
10113 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010114 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10115 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10116 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010117 des_xmlHashDeallocator(n_f, f, 4);
10118 xmlResetLastError();
10119 if (mem_base != xmlMemBlocks()) {
10120 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10121 xmlMemBlocks() - mem_base);
10122 test_ret++;
10123 printf(" %d", n_table);
10124 printf(" %d", n_name);
10125 printf(" %d", n_name2);
10126 printf(" %d", n_name3);
10127 printf(" %d", n_f);
10128 printf("\n");
10129 }
10130 }
10131 }
10132 }
10133 }
10134 }
Daniel Veillard42595322004-11-08 10:52:06 +000010135 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010136
Daniel Veillard42595322004-11-08 10:52:06 +000010137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010138}
10139
10140
10141static int
10142test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010144
10145
10146 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010148}
10149
10150
10151static int
10152test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010154
10155
10156 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010158}
10159
10160
10161static int
10162test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010164
10165
10166 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010168}
10169
10170
10171static int
10172test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010174
10175
10176 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010178}
10179
10180
10181static int
10182test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010184
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010185 int mem_base;
10186 int ret_val;
10187 xmlHashTablePtr table; /* the hash table */
10188 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010189
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010190 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10191 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010192 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010193
10194 ret_val = xmlHashSize(table);
10195 desret_int(ret_val);
10196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010197 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010198 xmlResetLastError();
10199 if (mem_base != xmlMemBlocks()) {
10200 printf("Leak of %d blocks found in xmlHashSize",
10201 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010202 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010203 printf(" %d", n_table);
10204 printf("\n");
10205 }
10206 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010208
Daniel Veillard42595322004-11-08 10:52:06 +000010209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010210}
10211
10212
10213static int
10214test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010216
Daniel Veillard42595322004-11-08 10:52:06 +000010217 int mem_base;
10218 int ret_val;
10219 xmlHashTablePtr table; /* the hash table */
10220 int n_table;
10221 xmlChar * name; /* the name of the userdata */
10222 int n_name;
10223 void * userdata; /* a pointer to the userdata */
10224 int n_userdata;
10225 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10226 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010227
Daniel Veillard42595322004-11-08 10:52:06 +000010228 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10229 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10230 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10231 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10232 mem_base = xmlMemBlocks();
10233 table = gen_xmlHashTablePtr(n_table, 0);
10234 name = gen_const_xmlChar_ptr(n_name, 1);
10235 userdata = gen_userdata(n_userdata, 2);
10236 f = gen_xmlHashDeallocator(n_f, 3);
10237
William M. Brackf13f77f2004-11-12 16:03:48 +000010238 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010239 desret_int(ret_val);
10240 call_tests++;
10241 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010242 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010243 des_userdata(n_userdata, userdata, 2);
10244 des_xmlHashDeallocator(n_f, f, 3);
10245 xmlResetLastError();
10246 if (mem_base != xmlMemBlocks()) {
10247 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10248 xmlMemBlocks() - mem_base);
10249 test_ret++;
10250 printf(" %d", n_table);
10251 printf(" %d", n_name);
10252 printf(" %d", n_userdata);
10253 printf(" %d", n_f);
10254 printf("\n");
10255 }
10256 }
10257 }
10258 }
10259 }
Daniel Veillard42595322004-11-08 10:52:06 +000010260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010261
Daniel Veillard42595322004-11-08 10:52:06 +000010262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010263}
10264
10265
10266static int
10267test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010269
Daniel Veillard42595322004-11-08 10:52:06 +000010270 int mem_base;
10271 int ret_val;
10272 xmlHashTablePtr table; /* the hash table */
10273 int n_table;
10274 xmlChar * name; /* the name of the userdata */
10275 int n_name;
10276 xmlChar * name2; /* a second name of the userdata */
10277 int n_name2;
10278 void * userdata; /* a pointer to the userdata */
10279 int n_userdata;
10280 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10281 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010282
Daniel Veillard42595322004-11-08 10:52:06 +000010283 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10284 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10285 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10286 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10287 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10288 mem_base = xmlMemBlocks();
10289 table = gen_xmlHashTablePtr(n_table, 0);
10290 name = gen_const_xmlChar_ptr(n_name, 1);
10291 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10292 userdata = gen_userdata(n_userdata, 3);
10293 f = gen_xmlHashDeallocator(n_f, 4);
10294
William M. Brackf13f77f2004-11-12 16:03:48 +000010295 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010296 desret_int(ret_val);
10297 call_tests++;
10298 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010299 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10300 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010301 des_userdata(n_userdata, userdata, 3);
10302 des_xmlHashDeallocator(n_f, f, 4);
10303 xmlResetLastError();
10304 if (mem_base != xmlMemBlocks()) {
10305 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10306 xmlMemBlocks() - mem_base);
10307 test_ret++;
10308 printf(" %d", n_table);
10309 printf(" %d", n_name);
10310 printf(" %d", n_name2);
10311 printf(" %d", n_userdata);
10312 printf(" %d", n_f);
10313 printf("\n");
10314 }
10315 }
10316 }
10317 }
10318 }
10319 }
Daniel Veillard42595322004-11-08 10:52:06 +000010320 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010321
Daniel Veillard42595322004-11-08 10:52:06 +000010322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010323}
10324
10325
10326static int
10327test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010329
Daniel Veillard42595322004-11-08 10:52:06 +000010330 int mem_base;
10331 int ret_val;
10332 xmlHashTablePtr table; /* the hash table */
10333 int n_table;
10334 xmlChar * name; /* the name of the userdata */
10335 int n_name;
10336 xmlChar * name2; /* a second name of the userdata */
10337 int n_name2;
10338 xmlChar * name3; /* a third name of the userdata */
10339 int n_name3;
10340 void * userdata; /* a pointer to the userdata */
10341 int n_userdata;
10342 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10343 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010344
Daniel Veillard42595322004-11-08 10:52:06 +000010345 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10346 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10347 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10348 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10349 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10350 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10351 mem_base = xmlMemBlocks();
10352 table = gen_xmlHashTablePtr(n_table, 0);
10353 name = gen_const_xmlChar_ptr(n_name, 1);
10354 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10355 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10356 userdata = gen_userdata(n_userdata, 4);
10357 f = gen_xmlHashDeallocator(n_f, 5);
10358
William M. Brackf13f77f2004-11-12 16:03:48 +000010359 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010360 desret_int(ret_val);
10361 call_tests++;
10362 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010363 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10364 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10365 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010366 des_userdata(n_userdata, userdata, 4);
10367 des_xmlHashDeallocator(n_f, f, 5);
10368 xmlResetLastError();
10369 if (mem_base != xmlMemBlocks()) {
10370 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10371 xmlMemBlocks() - mem_base);
10372 test_ret++;
10373 printf(" %d", n_table);
10374 printf(" %d", n_name);
10375 printf(" %d", n_name2);
10376 printf(" %d", n_name3);
10377 printf(" %d", n_userdata);
10378 printf(" %d", n_f);
10379 printf("\n");
10380 }
10381 }
10382 }
10383 }
10384 }
10385 }
10386 }
Daniel Veillard42595322004-11-08 10:52:06 +000010387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010388
Daniel Veillard42595322004-11-08 10:52:06 +000010389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010390}
10391
10392static int
10393test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010395
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010396 if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010397 test_ret += test_xmlHashAddEntry();
10398 test_ret += test_xmlHashAddEntry2();
10399 test_ret += test_xmlHashAddEntry3();
10400 test_ret += test_xmlHashCopy();
10401 test_ret += test_xmlHashCreate();
10402 test_ret += test_xmlHashLookup();
10403 test_ret += test_xmlHashLookup2();
10404 test_ret += test_xmlHashLookup3();
10405 test_ret += test_xmlHashQLookup();
10406 test_ret += test_xmlHashQLookup2();
10407 test_ret += test_xmlHashQLookup3();
10408 test_ret += test_xmlHashRemoveEntry();
10409 test_ret += test_xmlHashRemoveEntry2();
10410 test_ret += test_xmlHashRemoveEntry3();
10411 test_ret += test_xmlHashScan();
10412 test_ret += test_xmlHashScan3();
10413 test_ret += test_xmlHashScanFull();
10414 test_ret += test_xmlHashScanFull3();
10415 test_ret += test_xmlHashSize();
10416 test_ret += test_xmlHashUpdateEntry();
10417 test_ret += test_xmlHashUpdateEntry2();
10418 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010419
Daniel Veillard42595322004-11-08 10:52:06 +000010420 if (test_ret != 0)
10421 printf("Module hash: %d errors\n", test_ret);
10422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010423}
10424
Daniel Veillardce682bc2004-11-05 17:22:25 +000010425#define gen_nb_xmlLinkPtr 1
10426static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10427 return(NULL);
10428}
10429static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10430}
10431
Daniel Veillardd93f6252004-11-02 15:53:51 +000010432static int
10433test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010435
Daniel Veillardce682bc2004-11-05 17:22:25 +000010436 int mem_base;
10437 void * ret_val;
10438 xmlLinkPtr lk; /* a link */
10439 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010440
Daniel Veillardce682bc2004-11-05 17:22:25 +000010441 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10442 mem_base = xmlMemBlocks();
10443 lk = gen_xmlLinkPtr(n_lk, 0);
10444
10445 ret_val = xmlLinkGetData(lk);
10446 desret_void_ptr(ret_val);
10447 call_tests++;
10448 des_xmlLinkPtr(n_lk, lk, 0);
10449 xmlResetLastError();
10450 if (mem_base != xmlMemBlocks()) {
10451 printf("Leak of %d blocks found in xmlLinkGetData",
10452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010453 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010454 printf(" %d", n_lk);
10455 printf("\n");
10456 }
10457 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010458 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010459
Daniel Veillard42595322004-11-08 10:52:06 +000010460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461}
10462
10463
10464static int
10465test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010467
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010468 int mem_base;
10469 int ret_val;
10470 xmlListPtr l; /* a list */
10471 int n_l;
10472 void * data; /* the data */
10473 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010474
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010475 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10476 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010478 l = gen_xmlListPtr(n_l, 0);
10479 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010480
10481 ret_val = xmlListAppend(l, data);
10482 desret_int(ret_val);
10483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010484 des_xmlListPtr(n_l, l, 0);
10485 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010486 xmlResetLastError();
10487 if (mem_base != xmlMemBlocks()) {
10488 printf("Leak of %d blocks found in xmlListAppend",
10489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010490 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010491 printf(" %d", n_l);
10492 printf(" %d", n_data);
10493 printf("\n");
10494 }
10495 }
10496 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010497 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010498
Daniel Veillard42595322004-11-08 10:52:06 +000010499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010500}
10501
10502
10503static int
10504test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010506
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010507 int mem_base;
10508 xmlListPtr l; /* a list */
10509 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010510
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010511 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10512 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010513 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010514
10515 xmlListClear(l);
10516 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010517 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010518 xmlResetLastError();
10519 if (mem_base != xmlMemBlocks()) {
10520 printf("Leak of %d blocks found in xmlListClear",
10521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010522 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010523 printf(" %d", n_l);
10524 printf("\n");
10525 }
10526 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010527 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010528
Daniel Veillard42595322004-11-08 10:52:06 +000010529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010530}
10531
10532
Daniel Veillardce682bc2004-11-05 17:22:25 +000010533#define gen_nb_const_xmlListPtr 1
10534static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10535 return(NULL);
10536}
10537static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10538}
10539
Daniel Veillardd93f6252004-11-02 15:53:51 +000010540static int
10541test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010543
Daniel Veillardce682bc2004-11-05 17:22:25 +000010544 int mem_base;
10545 int ret_val;
10546 xmlListPtr cur; /* the new list */
10547 int n_cur;
10548 xmlListPtr old; /* the old list */
10549 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010550
Daniel Veillardce682bc2004-11-05 17:22:25 +000010551 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10552 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10553 mem_base = xmlMemBlocks();
10554 cur = gen_xmlListPtr(n_cur, 0);
10555 old = gen_const_xmlListPtr(n_old, 1);
10556
William M. Brackf13f77f2004-11-12 16:03:48 +000010557 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010558 desret_int(ret_val);
10559 call_tests++;
10560 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010561 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010562 xmlResetLastError();
10563 if (mem_base != xmlMemBlocks()) {
10564 printf("Leak of %d blocks found in xmlListCopy",
10565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010566 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010567 printf(" %d", n_cur);
10568 printf(" %d", n_old);
10569 printf("\n");
10570 }
10571 }
10572 }
Daniel Veillardce682bc2004-11-05 17:22:25 +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_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010582
10583
10584 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010586}
10587
10588
10589static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010590test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010592
10593
10594 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010596}
10597
10598
10599static int
10600test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010602
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010603 int mem_base;
10604 int ret_val;
10605 xmlListPtr l; /* a list */
10606 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010607
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010608 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10609 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010610 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010611
10612 ret_val = xmlListEmpty(l);
10613 desret_int(ret_val);
10614 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010615 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010616 xmlResetLastError();
10617 if (mem_base != xmlMemBlocks()) {
10618 printf("Leak of %d blocks found in xmlListEmpty",
10619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010620 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010621 printf(" %d", n_l);
10622 printf("\n");
10623 }
10624 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010625 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010626
Daniel Veillard42595322004-11-08 10:52:06 +000010627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010628}
10629
10630
10631static int
10632test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010634
10635
10636 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010638}
10639
10640
10641static int
10642test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010644
10645
10646 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010648}
10649
10650
10651static int
10652test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010654
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010655 int mem_base;
10656 int ret_val;
10657 xmlListPtr l; /* a list */
10658 int n_l;
10659 void * data; /* the data */
10660 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010661
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010662 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10663 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10664 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010665 l = gen_xmlListPtr(n_l, 0);
10666 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010667
10668 ret_val = xmlListInsert(l, data);
10669 desret_int(ret_val);
10670 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010671 des_xmlListPtr(n_l, l, 0);
10672 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010673 xmlResetLastError();
10674 if (mem_base != xmlMemBlocks()) {
10675 printf("Leak of %d blocks found in xmlListInsert",
10676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010677 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010678 printf(" %d", n_l);
10679 printf(" %d", n_data);
10680 printf("\n");
10681 }
10682 }
10683 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010684 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010685
Daniel Veillard42595322004-11-08 10:52:06 +000010686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010687}
10688
10689
10690static int
10691test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010693
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010694 int mem_base;
10695 xmlListPtr l1; /* the original list */
10696 int n_l1;
10697 xmlListPtr l2; /* the new list */
10698 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010699
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010700 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10701 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010703 l1 = gen_xmlListPtr(n_l1, 0);
10704 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010705
10706 xmlListMerge(l1, l2);
10707 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010708 des_xmlListPtr(n_l1, l1, 0);
10709 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010710 xmlResetLastError();
10711 if (mem_base != xmlMemBlocks()) {
10712 printf("Leak of %d blocks found in xmlListMerge",
10713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010714 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010715 printf(" %d", n_l1);
10716 printf(" %d", n_l2);
10717 printf("\n");
10718 }
10719 }
10720 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010722
Daniel Veillard42595322004-11-08 10:52:06 +000010723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010724}
10725
10726
10727static int
10728test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010730
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010731 int mem_base;
10732 xmlListPtr l; /* a list */
10733 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010734
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010735 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010737 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010738
10739 xmlListPopBack(l);
10740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010741 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010742 xmlResetLastError();
10743 if (mem_base != xmlMemBlocks()) {
10744 printf("Leak of %d blocks found in xmlListPopBack",
10745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010746 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010747 printf(" %d", n_l);
10748 printf("\n");
10749 }
10750 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010752
Daniel Veillard42595322004-11-08 10:52:06 +000010753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010754}
10755
10756
10757static int
10758test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010760
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010761 int mem_base;
10762 xmlListPtr l; /* a list */
10763 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010764
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010765 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10766 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010767 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010768
10769 xmlListPopFront(l);
10770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010771 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010772 xmlResetLastError();
10773 if (mem_base != xmlMemBlocks()) {
10774 printf("Leak of %d blocks found in xmlListPopFront",
10775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010776 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010777 printf(" %d", n_l);
10778 printf("\n");
10779 }
10780 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010781 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010782
Daniel Veillard42595322004-11-08 10:52:06 +000010783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010784}
10785
10786
10787static int
10788test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010790
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010791 int mem_base;
10792 int ret_val;
10793 xmlListPtr l; /* a list */
10794 int n_l;
10795 void * data; /* new data */
10796 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010797
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010798 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10799 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10800 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010801 l = gen_xmlListPtr(n_l, 0);
10802 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010803
10804 ret_val = xmlListPushBack(l, data);
10805 desret_int(ret_val);
10806 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010807 des_xmlListPtr(n_l, l, 0);
10808 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010809 xmlResetLastError();
10810 if (mem_base != xmlMemBlocks()) {
10811 printf("Leak of %d blocks found in xmlListPushBack",
10812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010813 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010814 printf(" %d", n_l);
10815 printf(" %d", n_data);
10816 printf("\n");
10817 }
10818 }
10819 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010820 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010821
Daniel Veillard42595322004-11-08 10:52:06 +000010822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823}
10824
10825
10826static int
10827test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010829
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010830 int mem_base;
10831 int ret_val;
10832 xmlListPtr l; /* a list */
10833 int n_l;
10834 void * data; /* new data */
10835 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010836
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010837 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10838 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10839 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010840 l = gen_xmlListPtr(n_l, 0);
10841 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010842
10843 ret_val = xmlListPushFront(l, data);
10844 desret_int(ret_val);
10845 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010846 des_xmlListPtr(n_l, l, 0);
10847 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010848 xmlResetLastError();
10849 if (mem_base != xmlMemBlocks()) {
10850 printf("Leak of %d blocks found in xmlListPushFront",
10851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010852 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010853 printf(" %d", n_l);
10854 printf(" %d", n_data);
10855 printf("\n");
10856 }
10857 }
10858 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010859 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010860
Daniel Veillard42595322004-11-08 10:52:06 +000010861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010862}
10863
10864
10865static int
10866test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010868
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010869 int mem_base;
10870 int ret_val;
10871 xmlListPtr l; /* a list */
10872 int n_l;
10873 void * data; /* list data */
10874 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010875
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010876 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10877 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10878 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010879 l = gen_xmlListPtr(n_l, 0);
10880 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010881
10882 ret_val = xmlListRemoveAll(l, data);
10883 desret_int(ret_val);
10884 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010885 des_xmlListPtr(n_l, l, 0);
10886 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010887 xmlResetLastError();
10888 if (mem_base != xmlMemBlocks()) {
10889 printf("Leak of %d blocks found in xmlListRemoveAll",
10890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010891 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010892 printf(" %d", n_l);
10893 printf(" %d", n_data);
10894 printf("\n");
10895 }
10896 }
10897 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010898 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010899
Daniel Veillard42595322004-11-08 10:52:06 +000010900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010901}
10902
10903
10904static int
10905test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010907
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010908 int mem_base;
10909 int ret_val;
10910 xmlListPtr l; /* a list */
10911 int n_l;
10912 void * data; /* list data */
10913 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010914
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010915 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10916 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10917 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010918 l = gen_xmlListPtr(n_l, 0);
10919 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010920
10921 ret_val = xmlListRemoveFirst(l, data);
10922 desret_int(ret_val);
10923 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010924 des_xmlListPtr(n_l, l, 0);
10925 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010926 xmlResetLastError();
10927 if (mem_base != xmlMemBlocks()) {
10928 printf("Leak of %d blocks found in xmlListRemoveFirst",
10929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010930 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010931 printf(" %d", n_l);
10932 printf(" %d", n_data);
10933 printf("\n");
10934 }
10935 }
10936 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010937 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010938
Daniel Veillard42595322004-11-08 10:52:06 +000010939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010940}
10941
10942
10943static int
10944test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010946
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010947 int mem_base;
10948 int ret_val;
10949 xmlListPtr l; /* a list */
10950 int n_l;
10951 void * data; /* list data */
10952 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010953
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010954 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10955 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010957 l = gen_xmlListPtr(n_l, 0);
10958 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010959
10960 ret_val = xmlListRemoveLast(l, data);
10961 desret_int(ret_val);
10962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010963 des_xmlListPtr(n_l, l, 0);
10964 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010965 xmlResetLastError();
10966 if (mem_base != xmlMemBlocks()) {
10967 printf("Leak of %d blocks found in xmlListRemoveLast",
10968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010969 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010970 printf(" %d", n_l);
10971 printf(" %d", n_data);
10972 printf("\n");
10973 }
10974 }
10975 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010976 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010977
Daniel Veillard42595322004-11-08 10:52:06 +000010978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010979}
10980
10981
10982static int
10983test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010985
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010986 int mem_base;
10987 xmlListPtr l; /* a list */
10988 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010989
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010990 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010992 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010993
10994 xmlListReverse(l);
10995 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010996 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010997 xmlResetLastError();
10998 if (mem_base != xmlMemBlocks()) {
10999 printf("Leak of %d blocks found in xmlListReverse",
11000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011001 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011002 printf(" %d", n_l);
11003 printf("\n");
11004 }
11005 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011006 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011007
Daniel Veillard42595322004-11-08 10:52:06 +000011008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011009}
11010
11011
11012static int
11013test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011015
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011016 int mem_base;
11017 void * ret_val;
11018 xmlListPtr l; /* a list */
11019 int n_l;
11020 void * data; /* a search value */
11021 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011022
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011023 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11024 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11025 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011026 l = gen_xmlListPtr(n_l, 0);
11027 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011028
11029 ret_val = xmlListReverseSearch(l, data);
11030 desret_void_ptr(ret_val);
11031 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011032 des_xmlListPtr(n_l, l, 0);
11033 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011034 xmlResetLastError();
11035 if (mem_base != xmlMemBlocks()) {
11036 printf("Leak of %d blocks found in xmlListReverseSearch",
11037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011038 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011039 printf(" %d", n_l);
11040 printf(" %d", n_data);
11041 printf("\n");
11042 }
11043 }
11044 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011045 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011046
Daniel Veillard42595322004-11-08 10:52:06 +000011047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011048}
11049
11050
11051static int
11052test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011054
11055
11056 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011058}
11059
11060
11061static int
11062test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011064
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011065 int mem_base;
11066 void * ret_val;
11067 xmlListPtr l; /* a list */
11068 int n_l;
11069 void * data; /* a search value */
11070 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011071
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011072 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11073 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11074 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011075 l = gen_xmlListPtr(n_l, 0);
11076 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011077
11078 ret_val = xmlListSearch(l, data);
11079 desret_void_ptr(ret_val);
11080 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011081 des_xmlListPtr(n_l, l, 0);
11082 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011083 xmlResetLastError();
11084 if (mem_base != xmlMemBlocks()) {
11085 printf("Leak of %d blocks found in xmlListSearch",
11086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011087 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011088 printf(" %d", n_l);
11089 printf(" %d", n_data);
11090 printf("\n");
11091 }
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_xmlListSize(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;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011108
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011109 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11110 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011111 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011112
11113 ret_val = xmlListSize(l);
11114 desret_int(ret_val);
11115 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011116 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011117 xmlResetLastError();
11118 if (mem_base != xmlMemBlocks()) {
11119 printf("Leak of %d blocks found in xmlListSize",
11120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011121 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011122 printf(" %d", n_l);
11123 printf("\n");
11124 }
11125 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011126 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011127
Daniel Veillard42595322004-11-08 10:52:06 +000011128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129}
11130
11131
11132static int
11133test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011135
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011136 int mem_base;
11137 xmlListPtr l; /* a list */
11138 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011139
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011140 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011142 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011143
11144 xmlListSort(l);
11145 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011146 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011147 xmlResetLastError();
11148 if (mem_base != xmlMemBlocks()) {
11149 printf("Leak of %d blocks found in xmlListSort",
11150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011151 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011152 printf(" %d", n_l);
11153 printf("\n");
11154 }
11155 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011156 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011157
Daniel Veillard42595322004-11-08 10:52:06 +000011158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011159}
11160
11161
11162static int
11163test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011165
11166
11167 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011169}
11170
11171static int
11172test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011174
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011175 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011176 test_ret += test_xmlLinkGetData();
11177 test_ret += test_xmlListAppend();
11178 test_ret += test_xmlListClear();
11179 test_ret += test_xmlListCopy();
11180 test_ret += test_xmlListCreate();
11181 test_ret += test_xmlListDup();
11182 test_ret += test_xmlListEmpty();
11183 test_ret += test_xmlListEnd();
11184 test_ret += test_xmlListFront();
11185 test_ret += test_xmlListInsert();
11186 test_ret += test_xmlListMerge();
11187 test_ret += test_xmlListPopBack();
11188 test_ret += test_xmlListPopFront();
11189 test_ret += test_xmlListPushBack();
11190 test_ret += test_xmlListPushFront();
11191 test_ret += test_xmlListRemoveAll();
11192 test_ret += test_xmlListRemoveFirst();
11193 test_ret += test_xmlListRemoveLast();
11194 test_ret += test_xmlListReverse();
11195 test_ret += test_xmlListReverseSearch();
11196 test_ret += test_xmlListReverseWalk();
11197 test_ret += test_xmlListSearch();
11198 test_ret += test_xmlListSize();
11199 test_ret += test_xmlListSort();
11200 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011201
Daniel Veillard42595322004-11-08 10:52:06 +000011202 if (test_ret != 0)
11203 printf("Module list: %d errors\n", test_ret);
11204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011205}
11206
11207static int
11208test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011210
Daniel Veillard27f20102004-11-05 11:50:11 +000011211#ifdef LIBXML_FTP_ENABLED
11212 int mem_base;
11213 int ret_val;
11214 void * ctx; /* an FTP context */
11215 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011216
Daniel Veillard27f20102004-11-05 11:50:11 +000011217 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11218 mem_base = xmlMemBlocks();
11219 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11220
11221 ret_val = xmlNanoFTPCheckResponse(ctx);
11222 desret_int(ret_val);
11223 call_tests++;
11224 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11225 xmlResetLastError();
11226 if (mem_base != xmlMemBlocks()) {
11227 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011229 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011230 printf(" %d", n_ctx);
11231 printf("\n");
11232 }
11233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011234 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011235#endif
11236
Daniel Veillard42595322004-11-08 10:52:06 +000011237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011238}
11239
11240
11241static int
11242test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011244
11245#ifdef LIBXML_FTP_ENABLED
11246 int mem_base;
11247
11248 mem_base = xmlMemBlocks();
11249
11250 xmlNanoFTPCleanup();
11251 call_tests++;
11252 xmlResetLastError();
11253 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011254 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011256 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011257 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011259 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011260#endif
11261
Daniel Veillard42595322004-11-08 10:52:06 +000011262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011263}
11264
11265
11266static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011267test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011269
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011270#ifdef LIBXML_FTP_ENABLED
11271 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011272 int ret_val;
11273 void * ctx; /* an FTP context */
11274 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011275
Daniel Veillard27f20102004-11-05 11:50:11 +000011276 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011277 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011278 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011279
Daniel Veillard27f20102004-11-05 11:50:11 +000011280 ret_val = xmlNanoFTPCloseConnection(ctx);
11281 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011282 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011283 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011284 xmlResetLastError();
11285 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011286 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011288 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011289 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011290 printf("\n");
11291 }
11292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011293 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011294#endif
11295
Daniel Veillard42595322004-11-08 10:52:06 +000011296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011297}
11298
11299
11300static int
11301test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011303
Daniel Veillard27f20102004-11-05 11:50:11 +000011304#ifdef LIBXML_FTP_ENABLED
11305 int mem_base;
11306 int ret_val;
11307 void * ctx; /* an FTP context */
11308 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011309 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011310 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011311
Daniel Veillard27f20102004-11-05 11:50:11 +000011312 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11313 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11314 mem_base = xmlMemBlocks();
11315 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11316 directory = gen_const_char_ptr(n_directory, 1);
11317
William M. Brackf13f77f2004-11-12 16:03:48 +000011318 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011319 desret_int(ret_val);
11320 call_tests++;
11321 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011322 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011323 xmlResetLastError();
11324 if (mem_base != xmlMemBlocks()) {
11325 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011327 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011328 printf(" %d", n_ctx);
11329 printf(" %d", n_directory);
11330 printf("\n");
11331 }
11332 }
11333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011334 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011335#endif
11336
Daniel Veillard42595322004-11-08 10:52:06 +000011337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011338}
11339
11340
11341static int
11342test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011344
Daniel Veillard27f20102004-11-05 11:50:11 +000011345#ifdef LIBXML_FTP_ENABLED
11346 int mem_base;
11347 int ret_val;
11348 void * ctx; /* an FTP context */
11349 int n_ctx;
11350 const char * file; /* a file or directory on the server */
11351 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011352
Daniel Veillard27f20102004-11-05 11:50:11 +000011353 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11354 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11355 mem_base = xmlMemBlocks();
11356 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11357 file = gen_filepath(n_file, 1);
11358
11359 ret_val = xmlNanoFTPDele(ctx, file);
11360 desret_int(ret_val);
11361 call_tests++;
11362 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11363 des_filepath(n_file, file, 1);
11364 xmlResetLastError();
11365 if (mem_base != xmlMemBlocks()) {
11366 printf("Leak of %d blocks found in xmlNanoFTPDele",
11367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011368 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011369 printf(" %d", n_ctx);
11370 printf(" %d", n_file);
11371 printf("\n");
11372 }
11373 }
11374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011375 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011376#endif
11377
Daniel Veillard42595322004-11-08 10:52:06 +000011378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011379}
11380
11381
11382static int
11383test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011385
11386
11387 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011389}
11390
11391
11392static int
11393test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011395
Daniel Veillard27f20102004-11-05 11:50:11 +000011396#ifdef LIBXML_FTP_ENABLED
11397 int mem_base;
11398 int ret_val;
11399 void * ctx; /* an FTP context */
11400 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011401
Daniel Veillard27f20102004-11-05 11:50:11 +000011402 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11403 mem_base = xmlMemBlocks();
11404 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11405
11406 ret_val = xmlNanoFTPGetConnection(ctx);
11407 desret_int(ret_val);
11408 call_tests++;
11409 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11410 xmlResetLastError();
11411 if (mem_base != xmlMemBlocks()) {
11412 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011414 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011415 printf(" %d", n_ctx);
11416 printf("\n");
11417 }
11418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011419 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011420#endif
11421
Daniel Veillard42595322004-11-08 10:52:06 +000011422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011423}
11424
11425
11426static int
11427test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011429
Daniel Veillard27f20102004-11-05 11:50:11 +000011430#ifdef LIBXML_FTP_ENABLED
11431 int mem_base;
11432 int ret_val;
11433 void * ctx; /* an FTP context */
11434 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011435
Daniel Veillard27f20102004-11-05 11:50:11 +000011436 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11437 mem_base = xmlMemBlocks();
11438 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11439
11440 ret_val = xmlNanoFTPGetResponse(ctx);
11441 desret_int(ret_val);
11442 call_tests++;
11443 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11444 xmlResetLastError();
11445 if (mem_base != xmlMemBlocks()) {
11446 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011448 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011449 printf(" %d", n_ctx);
11450 printf("\n");
11451 }
11452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011453 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011454#endif
11455
Daniel Veillard42595322004-11-08 10:52:06 +000011456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011457}
11458
11459
11460static int
11461test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011463
Daniel Veillard27f20102004-11-05 11:50:11 +000011464#ifdef LIBXML_FTP_ENABLED
11465 int mem_base;
11466 int ret_val;
11467 void * ctx; /* an FTP context */
11468 int n_ctx;
11469 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11470 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011471
Daniel Veillard27f20102004-11-05 11:50:11 +000011472 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11473 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11474 mem_base = xmlMemBlocks();
11475 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11476 filename = gen_filepath(n_filename, 1);
11477
11478 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11479 desret_int(ret_val);
11480 call_tests++;
11481 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11482 des_filepath(n_filename, filename, 1);
11483 xmlResetLastError();
11484 if (mem_base != xmlMemBlocks()) {
11485 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011487 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011488 printf(" %d", n_ctx);
11489 printf(" %d", n_filename);
11490 printf("\n");
11491 }
11492 }
11493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011494 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011495#endif
11496
Daniel Veillard42595322004-11-08 10:52:06 +000011497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011498}
11499
11500
11501static int
11502test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011504
11505#ifdef LIBXML_FTP_ENABLED
11506 int mem_base;
11507
11508 mem_base = xmlMemBlocks();
11509
11510 xmlNanoFTPInit();
11511 call_tests++;
11512 xmlResetLastError();
11513 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011514 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011517 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011519 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011520#endif
11521
Daniel Veillard42595322004-11-08 10:52:06 +000011522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011523}
11524
11525
11526static int
11527test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011529
11530
11531 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011533}
11534
11535
11536static int
11537test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011539
11540
11541 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011543}
11544
11545
11546static int
11547test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011549
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011550#ifdef LIBXML_FTP_ENABLED
11551 int mem_base;
11552 void * ret_val;
11553 const char * URL; /* the URL to the resource */
11554 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011555
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011556 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11557 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011558 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011559
11560 ret_val = xmlNanoFTPOpen(URL);
11561 desret_void_ptr(ret_val);
11562 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011563 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011564 xmlResetLastError();
11565 if (mem_base != xmlMemBlocks()) {
11566 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11567 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011568 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011569 printf(" %d", n_URL);
11570 printf("\n");
11571 }
11572 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011573 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011574#endif
11575
Daniel Veillard42595322004-11-08 10:52:06 +000011576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011577}
11578
11579
11580static int
11581test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011583
11584#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000011585 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011586 int n_host;
11587 int port; /* the proxy port */
11588 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011589 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011590 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011591 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011592 int n_passwd;
11593 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11594 int n_type;
11595
11596 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11597 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11598 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11599 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11600 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011601 host = gen_const_char_ptr(n_host, 0);
11602 port = gen_int(n_port, 1);
11603 user = gen_const_char_ptr(n_user, 2);
11604 passwd = gen_const_char_ptr(n_passwd, 3);
11605 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011606
William M. Brackf13f77f2004-11-12 16:03:48 +000011607 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011608 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011609 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011610 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011611 des_const_char_ptr(n_user, (const char *)user, 2);
11612 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011613 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011614 xmlResetLastError();
11615 }
11616 }
11617 }
11618 }
11619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011620 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011621#endif
11622
Daniel Veillard42595322004-11-08 10:52:06 +000011623 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011624}
11625
11626
11627static int
11628test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011629 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011630
Daniel Veillard27f20102004-11-05 11:50:11 +000011631#ifdef LIBXML_FTP_ENABLED
11632 int mem_base;
11633 int ret_val;
11634 void * ctx; /* an FTP context */
11635 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011636
Daniel Veillard27f20102004-11-05 11:50:11 +000011637 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11638 mem_base = xmlMemBlocks();
11639 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11640
11641 ret_val = xmlNanoFTPQuit(ctx);
11642 desret_int(ret_val);
11643 call_tests++;
11644 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11645 xmlResetLastError();
11646 if (mem_base != xmlMemBlocks()) {
11647 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011649 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011650 printf(" %d", n_ctx);
11651 printf("\n");
11652 }
11653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011654 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011655#endif
11656
Daniel Veillard42595322004-11-08 10:52:06 +000011657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011658}
11659
11660
11661static int
11662test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011664
Daniel Veillard27f20102004-11-05 11:50:11 +000011665#ifdef LIBXML_FTP_ENABLED
11666 int mem_base;
11667 int ret_val;
11668 void * ctx; /* the FTP context */
11669 int n_ctx;
11670 void * dest; /* a buffer */
11671 int n_dest;
11672 int len; /* the buffer length */
11673 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011674
Daniel Veillard27f20102004-11-05 11:50:11 +000011675 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11676 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11677 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11678 mem_base = xmlMemBlocks();
11679 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11680 dest = gen_void_ptr(n_dest, 1);
11681 len = gen_int(n_len, 2);
11682
11683 ret_val = xmlNanoFTPRead(ctx, dest, len);
11684 desret_int(ret_val);
11685 call_tests++;
11686 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11687 des_void_ptr(n_dest, dest, 1);
11688 des_int(n_len, len, 2);
11689 xmlResetLastError();
11690 if (mem_base != xmlMemBlocks()) {
11691 printf("Leak of %d blocks found in xmlNanoFTPRead",
11692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011693 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011694 printf(" %d", n_ctx);
11695 printf(" %d", n_dest);
11696 printf(" %d", n_len);
11697 printf("\n");
11698 }
11699 }
11700 }
11701 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011702 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011703#endif
11704
Daniel Veillard42595322004-11-08 10:52:06 +000011705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011706}
11707
11708
11709static int
11710test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011712
11713#ifdef LIBXML_FTP_ENABLED
11714 const char * URL; /* The proxy URL used to initialize the proxy context */
11715 int n_URL;
11716
11717 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011718 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011719
11720 xmlNanoFTPScanProxy(URL);
11721 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011722 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011723 xmlResetLastError();
11724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011725 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011726#endif
11727
Daniel Veillard42595322004-11-08 10:52:06 +000011728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011729}
11730
11731
11732static int
11733test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011735
Daniel Veillard27f20102004-11-05 11:50:11 +000011736#ifdef LIBXML_FTP_ENABLED
11737 int mem_base;
11738 int ret_val;
11739 void * ctx; /* an FTP context */
11740 int n_ctx;
11741 const char * URL; /* The URL used to update the context */
11742 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011743
Daniel Veillard27f20102004-11-05 11:50:11 +000011744 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11745 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11746 mem_base = xmlMemBlocks();
11747 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11748 URL = gen_filepath(n_URL, 1);
11749
11750 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11751 desret_int(ret_val);
11752 call_tests++;
11753 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11754 des_filepath(n_URL, URL, 1);
11755 xmlResetLastError();
11756 if (mem_base != xmlMemBlocks()) {
11757 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011759 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011760 printf(" %d", n_ctx);
11761 printf(" %d", n_URL);
11762 printf("\n");
11763 }
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
11772static int
11773test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011775
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011776 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011777 test_ret += test_xmlNanoFTPCheckResponse();
11778 test_ret += test_xmlNanoFTPCleanup();
11779 test_ret += test_xmlNanoFTPCloseConnection();
11780 test_ret += test_xmlNanoFTPCwd();
11781 test_ret += test_xmlNanoFTPDele();
11782 test_ret += test_xmlNanoFTPGet();
11783 test_ret += test_xmlNanoFTPGetConnection();
11784 test_ret += test_xmlNanoFTPGetResponse();
11785 test_ret += test_xmlNanoFTPGetSocket();
11786 test_ret += test_xmlNanoFTPInit();
11787 test_ret += test_xmlNanoFTPList();
11788 test_ret += test_xmlNanoFTPNewCtxt();
11789 test_ret += test_xmlNanoFTPOpen();
11790 test_ret += test_xmlNanoFTPProxy();
11791 test_ret += test_xmlNanoFTPQuit();
11792 test_ret += test_xmlNanoFTPRead();
11793 test_ret += test_xmlNanoFTPScanProxy();
11794 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011795
Daniel Veillard42595322004-11-08 10:52:06 +000011796 if (test_ret != 0)
11797 printf("Module nanoftp: %d errors\n", test_ret);
11798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011799}
11800
11801static int
11802test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011804
Daniel Veillard27f20102004-11-05 11:50:11 +000011805#ifdef LIBXML_HTTP_ENABLED
11806 int mem_base;
11807 const char * ret_val;
11808 void * ctx; /* the HTTP context */
11809 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011810
Daniel Veillard27f20102004-11-05 11:50:11 +000011811 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11812 mem_base = xmlMemBlocks();
11813 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11814
11815 ret_val = xmlNanoHTTPAuthHeader(ctx);
11816 desret_const_char_ptr(ret_val);
11817 call_tests++;
11818 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11819 xmlResetLastError();
11820 if (mem_base != xmlMemBlocks()) {
11821 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011823 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011824 printf(" %d", n_ctx);
11825 printf("\n");
11826 }
11827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011828 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011829#endif
11830
Daniel Veillard42595322004-11-08 10:52:06 +000011831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011832}
11833
11834
11835static int
11836test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011838
11839#ifdef LIBXML_HTTP_ENABLED
11840 int mem_base;
11841
11842 mem_base = xmlMemBlocks();
11843
11844 xmlNanoHTTPCleanup();
11845 call_tests++;
11846 xmlResetLastError();
11847 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011848 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011850 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011851 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011853 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011854#endif
11855
Daniel Veillard42595322004-11-08 10:52:06 +000011856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011857}
11858
11859
11860static int
11861test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011863
Daniel Veillard27f20102004-11-05 11:50:11 +000011864#ifdef LIBXML_HTTP_ENABLED
11865 int mem_base;
11866 void * ctx; /* the HTTP context */
11867 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011868
Daniel Veillard27f20102004-11-05 11:50:11 +000011869 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11870 mem_base = xmlMemBlocks();
11871 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11872
11873 xmlNanoHTTPClose(ctx);
11874 call_tests++;
11875 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11876 xmlResetLastError();
11877 if (mem_base != xmlMemBlocks()) {
11878 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011880 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011881 printf(" %d", n_ctx);
11882 printf("\n");
11883 }
11884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011885 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011886#endif
11887
Daniel Veillard42595322004-11-08 10:52:06 +000011888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011889}
11890
11891
11892static int
11893test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011895
Daniel Veillard27f20102004-11-05 11:50:11 +000011896#ifdef LIBXML_HTTP_ENABLED
11897 int mem_base;
11898 int ret_val;
11899 void * ctx; /* the HTTP context */
11900 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011901
Daniel Veillard27f20102004-11-05 11:50:11 +000011902 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11903 mem_base = xmlMemBlocks();
11904 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11905
11906 ret_val = xmlNanoHTTPContentLength(ctx);
11907 desret_int(ret_val);
11908 call_tests++;
11909 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11910 xmlResetLastError();
11911 if (mem_base != xmlMemBlocks()) {
11912 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011914 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011915 printf(" %d", n_ctx);
11916 printf("\n");
11917 }
11918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011919 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011920#endif
11921
Daniel Veillard42595322004-11-08 10:52:06 +000011922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011923}
11924
11925
11926static int
11927test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011929
Daniel Veillard27f20102004-11-05 11:50:11 +000011930#ifdef LIBXML_HTTP_ENABLED
11931 int mem_base;
11932 const char * ret_val;
11933 void * ctx; /* the HTTP context */
11934 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011935
Daniel Veillard27f20102004-11-05 11:50:11 +000011936 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11937 mem_base = xmlMemBlocks();
11938 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11939
11940 ret_val = xmlNanoHTTPEncoding(ctx);
11941 desret_const_char_ptr(ret_val);
11942 call_tests++;
11943 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11944 xmlResetLastError();
11945 if (mem_base != xmlMemBlocks()) {
11946 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011948 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011949 printf(" %d", n_ctx);
11950 printf("\n");
11951 }
11952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011953 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011954#endif
11955
Daniel Veillard42595322004-11-08 10:52:06 +000011956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011957}
11958
11959
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011960#define gen_nb_char_ptr_ptr 1
11961static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11962 return(NULL);
11963}
11964static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11965}
11966
Daniel Veillardd93f6252004-11-02 15:53:51 +000011967static int
11968test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011970
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011971#ifdef LIBXML_HTTP_ENABLED
11972 int mem_base;
11973 int ret_val;
11974 const char * URL; /* The URL to load */
11975 int n_URL;
11976 const char * filename; /* the filename where the content should be saved */
11977 int n_filename;
11978 char ** contentType; /* if available the Content-Type information will be returned at that location */
11979 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011980
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011981 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11982 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11983 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11984 mem_base = xmlMemBlocks();
11985 URL = gen_filepath(n_URL, 0);
11986 filename = gen_filepath(n_filename, 1);
11987 contentType = gen_char_ptr_ptr(n_contentType, 2);
11988
11989 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11990 desret_int(ret_val);
11991 call_tests++;
11992 des_filepath(n_URL, URL, 0);
11993 des_filepath(n_filename, filename, 1);
11994 des_char_ptr_ptr(n_contentType, contentType, 2);
11995 xmlResetLastError();
11996 if (mem_base != xmlMemBlocks()) {
11997 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011999 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012000 printf(" %d", n_URL);
12001 printf(" %d", n_filename);
12002 printf(" %d", n_contentType);
12003 printf("\n");
12004 }
12005 }
12006 }
12007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012008 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012009#endif
12010
Daniel Veillard42595322004-11-08 10:52:06 +000012011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012012}
12013
12014
12015static int
12016test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012018
12019#ifdef LIBXML_HTTP_ENABLED
12020 int mem_base;
12021
12022 mem_base = xmlMemBlocks();
12023
12024 xmlNanoHTTPInit();
12025 call_tests++;
12026 xmlResetLastError();
12027 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012028 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012031 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012032 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012033 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012034#endif
12035
Daniel Veillard42595322004-11-08 10:52:06 +000012036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012037}
12038
12039
12040static int
12041test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012043
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012044#ifdef LIBXML_HTTP_ENABLED
12045 int mem_base;
12046 void * ret_val;
12047 const char * URL; /* The URL to load */
12048 int n_URL;
12049 char * method; /* the HTTP method to use */
12050 int n_method;
12051 char * input; /* the input string if any */
12052 int n_input;
12053 char ** contentType; /* the Content-Type information IN and OUT */
12054 int n_contentType;
12055 char * headers; /* the extra headers */
12056 int n_headers;
12057 int ilen; /* input length */
12058 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012059
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012060 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12061 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12062 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12063 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12064 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12065 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12066 mem_base = xmlMemBlocks();
12067 URL = gen_filepath(n_URL, 0);
12068 method = gen_const_char_ptr(n_method, 1);
12069 input = gen_const_char_ptr(n_input, 2);
12070 contentType = gen_char_ptr_ptr(n_contentType, 3);
12071 headers = gen_const_char_ptr(n_headers, 4);
12072 ilen = gen_int(n_ilen, 5);
12073
William M. Brackf13f77f2004-11-12 16:03:48 +000012074 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012075 desret_void_ptr(ret_val);
12076 call_tests++;
12077 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012078 des_const_char_ptr(n_method, (const char *)method, 1);
12079 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012080 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012081 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012082 des_int(n_ilen, ilen, 5);
12083 xmlResetLastError();
12084 if (mem_base != xmlMemBlocks()) {
12085 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012087 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012088 printf(" %d", n_URL);
12089 printf(" %d", n_method);
12090 printf(" %d", n_input);
12091 printf(" %d", n_contentType);
12092 printf(" %d", n_headers);
12093 printf(" %d", n_ilen);
12094 printf("\n");
12095 }
12096 }
12097 }
12098 }
12099 }
12100 }
12101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012102 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012103#endif
12104
Daniel Veillard42595322004-11-08 10:52:06 +000012105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012106}
12107
12108
12109static int
12110test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012112
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012113#ifdef LIBXML_HTTP_ENABLED
12114 int mem_base;
12115 void * ret_val;
12116 const char * URL; /* The URL to load */
12117 int n_URL;
12118 char * method; /* the HTTP method to use */
12119 int n_method;
12120 char * input; /* the input string if any */
12121 int n_input;
12122 char ** contentType; /* the Content-Type information IN and OUT */
12123 int n_contentType;
12124 char ** redir; /* the redirected URL OUT */
12125 int n_redir;
12126 char * headers; /* the extra headers */
12127 int n_headers;
12128 int ilen; /* input length */
12129 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012130
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012131 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12132 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12133 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12134 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12135 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12136 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12137 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12138 mem_base = xmlMemBlocks();
12139 URL = gen_filepath(n_URL, 0);
12140 method = gen_const_char_ptr(n_method, 1);
12141 input = gen_const_char_ptr(n_input, 2);
12142 contentType = gen_char_ptr_ptr(n_contentType, 3);
12143 redir = gen_char_ptr_ptr(n_redir, 4);
12144 headers = gen_const_char_ptr(n_headers, 5);
12145 ilen = gen_int(n_ilen, 6);
12146
William M. Brackf13f77f2004-11-12 16:03:48 +000012147 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012148 desret_void_ptr(ret_val);
12149 call_tests++;
12150 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012151 des_const_char_ptr(n_method, (const char *)method, 1);
12152 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012153 des_char_ptr_ptr(n_contentType, contentType, 3);
12154 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012155 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012156 des_int(n_ilen, ilen, 6);
12157 xmlResetLastError();
12158 if (mem_base != xmlMemBlocks()) {
12159 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012161 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012162 printf(" %d", n_URL);
12163 printf(" %d", n_method);
12164 printf(" %d", n_input);
12165 printf(" %d", n_contentType);
12166 printf(" %d", n_redir);
12167 printf(" %d", n_headers);
12168 printf(" %d", n_ilen);
12169 printf("\n");
12170 }
12171 }
12172 }
12173 }
12174 }
12175 }
12176 }
12177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012178 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012179#endif
12180
Daniel Veillard42595322004-11-08 10:52:06 +000012181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012182}
12183
12184
12185static int
12186test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012188
Daniel Veillard27f20102004-11-05 11:50:11 +000012189#ifdef LIBXML_HTTP_ENABLED
12190 int mem_base;
12191 const char * ret_val;
12192 void * ctx; /* the HTTP context */
12193 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012194
Daniel Veillard27f20102004-11-05 11:50:11 +000012195 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12196 mem_base = xmlMemBlocks();
12197 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12198
12199 ret_val = xmlNanoHTTPMimeType(ctx);
12200 desret_const_char_ptr(ret_val);
12201 call_tests++;
12202 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12203 xmlResetLastError();
12204 if (mem_base != xmlMemBlocks()) {
12205 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012207 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012208 printf(" %d", n_ctx);
12209 printf("\n");
12210 }
12211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012212 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012213#endif
12214
Daniel Veillard42595322004-11-08 10:52:06 +000012215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012216}
12217
12218
12219static int
12220test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012222
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012223#ifdef LIBXML_HTTP_ENABLED
12224 int mem_base;
12225 void * ret_val;
12226 const char * URL; /* The URL to load */
12227 int n_URL;
12228 char ** contentType; /* if available the Content-Type information will be returned at that location */
12229 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012230
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012231 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12232 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12233 mem_base = xmlMemBlocks();
12234 URL = gen_filepath(n_URL, 0);
12235 contentType = gen_char_ptr_ptr(n_contentType, 1);
12236
12237 ret_val = xmlNanoHTTPOpen(URL, contentType);
12238 desret_void_ptr(ret_val);
12239 call_tests++;
12240 des_filepath(n_URL, URL, 0);
12241 des_char_ptr_ptr(n_contentType, contentType, 1);
12242 xmlResetLastError();
12243 if (mem_base != xmlMemBlocks()) {
12244 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012246 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012247 printf(" %d", n_URL);
12248 printf(" %d", n_contentType);
12249 printf("\n");
12250 }
12251 }
12252 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012253 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012254#endif
12255
Daniel Veillard42595322004-11-08 10:52:06 +000012256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012257}
12258
12259
12260static int
12261test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012263
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012264#ifdef LIBXML_HTTP_ENABLED
12265 int mem_base;
12266 void * ret_val;
12267 const char * URL; /* The URL to load */
12268 int n_URL;
12269 char ** contentType; /* if available the Content-Type information will be returned at that location */
12270 int n_contentType;
12271 char ** redir; /* if available the redirected URL will be returned */
12272 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012273
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012274 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12275 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12276 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12277 mem_base = xmlMemBlocks();
12278 URL = gen_filepath(n_URL, 0);
12279 contentType = gen_char_ptr_ptr(n_contentType, 1);
12280 redir = gen_char_ptr_ptr(n_redir, 2);
12281
12282 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12283 desret_void_ptr(ret_val);
12284 call_tests++;
12285 des_filepath(n_URL, URL, 0);
12286 des_char_ptr_ptr(n_contentType, contentType, 1);
12287 des_char_ptr_ptr(n_redir, redir, 2);
12288 xmlResetLastError();
12289 if (mem_base != xmlMemBlocks()) {
12290 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012292 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012293 printf(" %d", n_URL);
12294 printf(" %d", n_contentType);
12295 printf(" %d", n_redir);
12296 printf("\n");
12297 }
12298 }
12299 }
12300 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012301 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012302#endif
12303
Daniel Veillard42595322004-11-08 10:52:06 +000012304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012305}
12306
12307
12308static int
12309test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012311
Daniel Veillard27f20102004-11-05 11:50:11 +000012312#ifdef LIBXML_HTTP_ENABLED
12313 int mem_base;
12314 int ret_val;
12315 void * ctx; /* the HTTP context */
12316 int n_ctx;
12317 void * dest; /* a buffer */
12318 int n_dest;
12319 int len; /* the buffer length */
12320 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012321
Daniel Veillard27f20102004-11-05 11:50:11 +000012322 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12323 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12324 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12325 mem_base = xmlMemBlocks();
12326 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12327 dest = gen_void_ptr(n_dest, 1);
12328 len = gen_int(n_len, 2);
12329
12330 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12331 desret_int(ret_val);
12332 call_tests++;
12333 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12334 des_void_ptr(n_dest, dest, 1);
12335 des_int(n_len, len, 2);
12336 xmlResetLastError();
12337 if (mem_base != xmlMemBlocks()) {
12338 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012340 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012341 printf(" %d", n_ctx);
12342 printf(" %d", n_dest);
12343 printf(" %d", n_len);
12344 printf("\n");
12345 }
12346 }
12347 }
12348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012349 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012350#endif
12351
Daniel Veillard42595322004-11-08 10:52:06 +000012352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012353}
12354
12355
12356static int
12357test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012359
12360
12361 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012363}
12364
12365
12366static int
12367test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012369
Daniel Veillard27f20102004-11-05 11:50:11 +000012370#ifdef LIBXML_HTTP_ENABLED
12371 int mem_base;
12372 int ret_val;
12373 void * ctx; /* the HTTP context */
12374 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012375
Daniel Veillard27f20102004-11-05 11:50:11 +000012376 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12377 mem_base = xmlMemBlocks();
12378 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12379
12380 ret_val = xmlNanoHTTPReturnCode(ctx);
12381 desret_int(ret_val);
12382 call_tests++;
12383 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12384 xmlResetLastError();
12385 if (mem_base != xmlMemBlocks()) {
12386 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012388 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012389 printf(" %d", n_ctx);
12390 printf("\n");
12391 }
12392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012393 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012394#endif
12395
Daniel Veillard42595322004-11-08 10:52:06 +000012396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012397}
12398
12399
12400static int
12401test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012403
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012404#ifdef LIBXML_HTTP_ENABLED
12405#ifdef LIBXML_OUTPUT_ENABLED
12406 int mem_base;
12407 int ret_val;
12408 void * ctxt; /* the HTTP context */
12409 int n_ctxt;
12410 const char * filename; /* the filename where the content should be saved */
12411 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012412
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012413 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12414 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12415 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012416 ctxt = gen_void_ptr(n_ctxt, 0);
12417 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012418
12419 ret_val = xmlNanoHTTPSave(ctxt, filename);
12420 desret_int(ret_val);
12421 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012422 des_void_ptr(n_ctxt, ctxt, 0);
12423 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012424 xmlResetLastError();
12425 if (mem_base != xmlMemBlocks()) {
12426 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012428 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012429 printf(" %d", n_ctxt);
12430 printf(" %d", n_filename);
12431 printf("\n");
12432 }
12433 }
12434 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012435 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012436#endif
12437#endif
12438
Daniel Veillard42595322004-11-08 10:52:06 +000012439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012440}
12441
12442
12443static int
12444test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012446
12447#ifdef LIBXML_HTTP_ENABLED
12448 const char * URL; /* The proxy URL used to initialize the proxy context */
12449 int n_URL;
12450
12451 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012452 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012453
12454 xmlNanoHTTPScanProxy(URL);
12455 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012456 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012457 xmlResetLastError();
12458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012459 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012460#endif
12461
Daniel Veillard42595322004-11-08 10:52:06 +000012462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012463}
12464
12465static int
12466test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012468
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012469 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012470 test_ret += test_xmlNanoHTTPAuthHeader();
12471 test_ret += test_xmlNanoHTTPCleanup();
12472 test_ret += test_xmlNanoHTTPClose();
12473 test_ret += test_xmlNanoHTTPContentLength();
12474 test_ret += test_xmlNanoHTTPEncoding();
12475 test_ret += test_xmlNanoHTTPFetch();
12476 test_ret += test_xmlNanoHTTPInit();
12477 test_ret += test_xmlNanoHTTPMethod();
12478 test_ret += test_xmlNanoHTTPMethodRedir();
12479 test_ret += test_xmlNanoHTTPMimeType();
12480 test_ret += test_xmlNanoHTTPOpen();
12481 test_ret += test_xmlNanoHTTPOpenRedir();
12482 test_ret += test_xmlNanoHTTPRead();
12483 test_ret += test_xmlNanoHTTPRedir();
12484 test_ret += test_xmlNanoHTTPReturnCode();
12485 test_ret += test_xmlNanoHTTPSave();
12486 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012487
Daniel Veillard42595322004-11-08 10:52:06 +000012488 if (test_ret != 0)
12489 printf("Module nanohttp: %d errors\n", test_ret);
12490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012491}
12492
12493static int
12494test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012496
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012497 int mem_base;
12498 long ret_val;
12499 xmlParserCtxtPtr ctxt; /* an XML parser context */
12500 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012501
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12503 mem_base = xmlMemBlocks();
12504 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12505
12506 ret_val = xmlByteConsumed(ctxt);
12507 desret_long(ret_val);
12508 call_tests++;
12509 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12510 xmlResetLastError();
12511 if (mem_base != xmlMemBlocks()) {
12512 printf("Leak of %d blocks found in xmlByteConsumed",
12513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012514 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012515 printf(" %d", n_ctxt);
12516 printf("\n");
12517 }
12518 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012520
Daniel Veillard42595322004-11-08 10:52:06 +000012521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012522}
12523
12524
12525static int
12526test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012528
Daniel Veillardce682bc2004-11-05 17:22:25 +000012529 int mem_base;
12530 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12531 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012532
Daniel Veillardce682bc2004-11-05 17:22:25 +000012533 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12534 mem_base = xmlMemBlocks();
12535 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12536
12537 xmlClearNodeInfoSeq(seq);
12538 call_tests++;
12539 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12540 xmlResetLastError();
12541 if (mem_base != xmlMemBlocks()) {
12542 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012544 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012545 printf(" %d", n_seq);
12546 printf("\n");
12547 }
12548 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012549 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012550
Daniel Veillard42595322004-11-08 10:52:06 +000012551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012552}
12553
12554
12555static int
12556test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012558
12559 int mem_base;
12560 xmlParserCtxtPtr ctxt; /* an XML parser context */
12561 int n_ctxt;
12562
12563 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12564 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012565 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012566
12567 xmlClearParserCtxt(ctxt);
12568 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012569 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570 xmlResetLastError();
12571 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012572 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012574 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012575 printf(" %d", n_ctxt);
12576 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012577 }
12578 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012580
Daniel Veillard42595322004-11-08 10:52:06 +000012581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012582}
12583
12584
12585static int
12586test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012588
Daniel Veillard34099b42004-11-04 17:34:35 +000012589 int mem_base;
12590 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012591 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012592 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012593
Daniel Veillard34099b42004-11-04 17:34:35 +000012594 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12595 mem_base = xmlMemBlocks();
12596 cur = gen_const_xmlChar_ptr(n_cur, 0);
12597
William M. Brackf13f77f2004-11-12 16:03:48 +000012598 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012599 desret_xmlParserCtxtPtr(ret_val);
12600 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012601 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012602 xmlResetLastError();
12603 if (mem_base != xmlMemBlocks()) {
12604 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012606 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012607 printf(" %d", n_cur);
12608 printf("\n");
12609 }
12610 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012612
Daniel Veillard42595322004-11-08 10:52:06 +000012613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012614}
12615
12616
12617static int
12618test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012620
Daniel Veillard34099b42004-11-04 17:34:35 +000012621#ifdef LIBXML_PUSH_ENABLED
12622 int mem_base;
12623 xmlParserCtxtPtr ret_val;
12624 xmlSAXHandlerPtr sax; /* a SAX handler */
12625 int n_sax;
12626 void * user_data; /* The user data returned on SAX callbacks */
12627 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012628 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012629 int n_chunk;
12630 int size; /* number of chars in the array */
12631 int n_size;
12632 const char * filename; /* an optional file name or URI */
12633 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012634
Daniel Veillard34099b42004-11-04 17:34:35 +000012635 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12636 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12637 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12638 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012639 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012640 mem_base = xmlMemBlocks();
12641 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12642 user_data = gen_userdata(n_user_data, 1);
12643 chunk = gen_const_char_ptr(n_chunk, 2);
12644 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012645 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012646
William M. Brackf13f77f2004-11-12 16:03:48 +000012647 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012648 desret_xmlParserCtxtPtr(ret_val);
12649 call_tests++;
12650 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12651 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012652 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012653 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012654 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012655 xmlResetLastError();
12656 if (mem_base != xmlMemBlocks()) {
12657 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012659 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012660 printf(" %d", n_sax);
12661 printf(" %d", n_user_data);
12662 printf(" %d", n_chunk);
12663 printf(" %d", n_size);
12664 printf(" %d", n_filename);
12665 printf("\n");
12666 }
12667 }
12668 }
12669 }
12670 }
12671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012672 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012673#endif
12674
Daniel Veillard42595322004-11-08 10:52:06 +000012675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012676}
12677
12678
12679static int
12680test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012682
12683 int mem_base;
12684 xmlDocPtr ret_val;
12685 xmlParserCtxtPtr ctxt; /* an XML parser context */
12686 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012687 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012688 int n_cur;
12689 const char * URL; /* the base URL to use for the document */
12690 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012691 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012692 int n_encoding;
12693 int options; /* a combination of xmlParserOption */
12694 int n_options;
12695
12696 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12697 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12698 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12699 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012700 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012702 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12703 cur = gen_const_xmlChar_ptr(n_cur, 1);
12704 URL = gen_filepath(n_URL, 2);
12705 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012706 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012707
William M. Brackf13f77f2004-11-12 16:03:48 +000012708 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012709 desret_xmlDocPtr(ret_val);
12710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012711 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012712 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012713 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012714 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012715 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012716 xmlResetLastError();
12717 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012718 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012720 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012721 printf(" %d", n_ctxt);
12722 printf(" %d", n_cur);
12723 printf(" %d", n_URL);
12724 printf(" %d", n_encoding);
12725 printf(" %d", n_options);
12726 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012727 }
12728 }
12729 }
12730 }
12731 }
12732 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012733 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012734
Daniel Veillard42595322004-11-08 10:52:06 +000012735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012736}
12737
12738
12739static int
12740test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012742
12743 int mem_base;
12744 xmlDocPtr ret_val;
12745 xmlParserCtxtPtr ctxt; /* an XML parser context */
12746 int n_ctxt;
12747 const char * filename; /* a file or URL */
12748 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012749 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012750 int n_encoding;
12751 int options; /* a combination of xmlParserOption */
12752 int n_options;
12753
12754 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12755 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12756 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012757 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012758 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012759 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12760 filename = gen_filepath(n_filename, 1);
12761 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012762 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012763
William M. Brackf13f77f2004-11-12 16:03:48 +000012764 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012765 desret_xmlDocPtr(ret_val);
12766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012767 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12768 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012769 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012770 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012771 xmlResetLastError();
12772 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012773 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012775 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012776 printf(" %d", n_ctxt);
12777 printf(" %d", n_filename);
12778 printf(" %d", n_encoding);
12779 printf(" %d", n_options);
12780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012781 }
12782 }
12783 }
12784 }
12785 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012786 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012787
Daniel Veillard42595322004-11-08 10:52:06 +000012788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012789}
12790
12791
12792static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012793test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012795
12796 int mem_base;
12797 xmlDocPtr ret_val;
12798 xmlParserCtxtPtr ctxt; /* an XML parser context */
12799 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012800 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012801 int n_buffer;
12802 int size; /* the size of the array */
12803 int n_size;
12804 const char * URL; /* the base URL to use for the document */
12805 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012806 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012807 int n_encoding;
12808 int options; /* a combination of xmlParserOption */
12809 int n_options;
12810
12811 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12812 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12813 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12814 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12815 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012816 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012818 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12819 buffer = gen_const_char_ptr(n_buffer, 1);
12820 size = gen_int(n_size, 2);
12821 URL = gen_filepath(n_URL, 3);
12822 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012823 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012824
William M. Brackf13f77f2004-11-12 16:03:48 +000012825 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012826 desret_xmlDocPtr(ret_val);
12827 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012828 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012829 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012830 des_int(n_size, size, 2);
12831 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012832 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012833 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012834 xmlResetLastError();
12835 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012836 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012838 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012839 printf(" %d", n_ctxt);
12840 printf(" %d", n_buffer);
12841 printf(" %d", n_size);
12842 printf(" %d", n_URL);
12843 printf(" %d", n_encoding);
12844 printf(" %d", n_options);
12845 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012846 }
12847 }
12848 }
12849 }
12850 }
12851 }
12852 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012853 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012854
Daniel Veillard42595322004-11-08 10:52:06 +000012855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012856}
12857
12858
12859static int
12860test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012862
12863 int mem_base;
12864 xmlParserCtxtPtr ctxt; /* an XML parser context */
12865 int n_ctxt;
12866
12867 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12868 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012869 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012870
12871 xmlCtxtReset(ctxt);
12872 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012873 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012874 xmlResetLastError();
12875 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012876 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012878 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012879 printf(" %d", n_ctxt);
12880 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012881 }
12882 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012883 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012884
Daniel Veillard42595322004-11-08 10:52:06 +000012885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012886}
12887
12888
12889static int
12890test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012892
12893 int mem_base;
12894 int ret_val;
12895 xmlParserCtxtPtr ctxt; /* an XML parser context */
12896 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012897 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012898 int n_chunk;
12899 int size; /* number of chars in the array */
12900 int n_size;
12901 const char * filename; /* an optional file name or URI */
12902 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012903 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012904 int n_encoding;
12905
12906 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12907 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12908 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12909 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12910 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012912 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12913 chunk = gen_const_char_ptr(n_chunk, 1);
12914 size = gen_int(n_size, 2);
12915 filename = gen_filepath(n_filename, 3);
12916 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012917
William M. Brackf13f77f2004-11-12 16:03:48 +000012918 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012919 desret_int(ret_val);
12920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012921 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012922 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012923 des_int(n_size, size, 2);
12924 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012925 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012926 xmlResetLastError();
12927 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012928 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012930 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012931 printf(" %d", n_ctxt);
12932 printf(" %d", n_chunk);
12933 printf(" %d", n_size);
12934 printf(" %d", n_filename);
12935 printf(" %d", n_encoding);
12936 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012937 }
12938 }
12939 }
12940 }
12941 }
12942 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012943 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012944
Daniel Veillard42595322004-11-08 10:52:06 +000012945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012946}
12947
12948
12949static int
12950test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012952
12953 int mem_base;
12954 int ret_val;
12955 xmlParserCtxtPtr ctxt; /* an XML parser context */
12956 int n_ctxt;
12957 int options; /* a combination of xmlParserOption */
12958 int n_options;
12959
12960 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012961 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012962 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012963 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012964 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012965
12966 ret_val = xmlCtxtUseOptions(ctxt, options);
12967 desret_int(ret_val);
12968 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012969 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012970 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012971 xmlResetLastError();
12972 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012973 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012975 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012976 printf(" %d", n_ctxt);
12977 printf(" %d", n_options);
12978 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012979 }
12980 }
12981 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012982 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012983
Daniel Veillard42595322004-11-08 10:52:06 +000012984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012985}
12986
12987
12988static int
12989test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012991
12992
12993 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012995}
12996
12997
12998static int
12999test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013001
Daniel Veillarda521d282004-11-09 14:59:59 +000013002#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013003 int mem_base;
13004 int ret_val;
13005 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
13006 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013007 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013008 int n_name;
13009 void * result; /* location to store the result */
13010 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013011
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013012 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13013 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13014 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013016 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13017 name = gen_const_char_ptr(n_name, 1);
13018 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013019
William M. Brackf13f77f2004-11-12 16:03:48 +000013020 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013021 desret_int(ret_val);
13022 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013023 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013024 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013025 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013026 xmlResetLastError();
13027 if (mem_base != xmlMemBlocks()) {
13028 printf("Leak of %d blocks found in xmlGetFeature",
13029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013030 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013031 printf(" %d", n_ctxt);
13032 printf(" %d", n_name);
13033 printf(" %d", n_result);
13034 printf("\n");
13035 }
13036 }
13037 }
13038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013039 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013040#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013041
Daniel Veillard42595322004-11-08 10:52:06 +000013042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013043}
13044
13045
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013046#define gen_nb_const_char_ptr_ptr 1
13047static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13048 return(NULL);
13049}
13050static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13051}
13052
Daniel Veillardd93f6252004-11-02 15:53:51 +000013053static int
13054test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013056
Daniel Veillarda521d282004-11-09 14:59:59 +000013057#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013058 int mem_base;
13059 int ret_val;
13060 int * len; /* the length of the features name array (input/output) */
13061 int n_len;
13062 char ** result; /* an array of string to be filled with the features name. */
13063 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013064
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013065 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13066 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13067 mem_base = xmlMemBlocks();
13068 len = gen_int_ptr(n_len, 0);
13069 result = gen_const_char_ptr_ptr(n_result, 1);
13070
William M. Brackf13f77f2004-11-12 16:03:48 +000013071 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013072 desret_int(ret_val);
13073 call_tests++;
13074 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013075 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013076 xmlResetLastError();
13077 if (mem_base != xmlMemBlocks()) {
13078 printf("Leak of %d blocks found in xmlGetFeaturesList",
13079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013080 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013081 printf(" %d", n_len);
13082 printf(" %d", n_result);
13083 printf("\n");
13084 }
13085 }
13086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013087 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013088#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013089
Daniel Veillard42595322004-11-08 10:52:06 +000013090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013091}
13092
13093
13094static int
13095test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013097
Daniel Veillarda521d282004-11-09 14:59:59 +000013098#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013099 int mem_base;
13100 xmlDtdPtr ret_val;
13101 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13102 int n_sax;
13103 xmlParserInputBufferPtr input; /* an Input Buffer */
13104 int n_input;
13105 xmlCharEncoding enc; /* the charset encoding if known */
13106 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013107
Daniel Veillard34099b42004-11-04 17:34:35 +000013108 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13109 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13110 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13111 mem_base = xmlMemBlocks();
13112 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13113 input = gen_xmlParserInputBufferPtr(n_input, 1);
13114 enc = gen_xmlCharEncoding(n_enc, 2);
13115
13116 ret_val = xmlIOParseDTD(sax, input, enc);
13117 input = NULL;
13118 desret_xmlDtdPtr(ret_val);
13119 call_tests++;
13120 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13121 des_xmlParserInputBufferPtr(n_input, input, 1);
13122 des_xmlCharEncoding(n_enc, enc, 2);
13123 xmlResetLastError();
13124 if (mem_base != xmlMemBlocks()) {
13125 printf("Leak of %d blocks found in xmlIOParseDTD",
13126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013127 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013128 printf(" %d", n_sax);
13129 printf(" %d", n_input);
13130 printf(" %d", n_enc);
13131 printf("\n");
13132 }
13133 }
13134 }
13135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013136 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013137#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013138
Daniel Veillard42595322004-11-08 10:52:06 +000013139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013140}
13141
13142
13143static int
13144test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013146
Daniel Veillardce682bc2004-11-05 17:22:25 +000013147 int mem_base;
13148 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13149 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013150
Daniel Veillardce682bc2004-11-05 17:22:25 +000013151 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13152 mem_base = xmlMemBlocks();
13153 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13154
13155 xmlInitNodeInfoSeq(seq);
13156 call_tests++;
13157 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13158 xmlResetLastError();
13159 if (mem_base != xmlMemBlocks()) {
13160 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013162 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013163 printf(" %d", n_seq);
13164 printf("\n");
13165 }
13166 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013167 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013168
Daniel Veillard42595322004-11-08 10:52:06 +000013169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013170}
13171
13172
13173static int
13174test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013176
13177 int mem_base;
13178
13179 mem_base = xmlMemBlocks();
13180
13181 xmlInitParser();
13182 call_tests++;
13183 xmlResetLastError();
13184 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013185 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013187 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013188 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013189 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013190 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013191
Daniel Veillard42595322004-11-08 10:52:06 +000013192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013193}
13194
13195
13196static int
13197test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013199
13200 int mem_base;
13201 int ret_val;
13202 xmlParserCtxtPtr ctxt; /* an XML parser context */
13203 int n_ctxt;
13204
13205 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13206 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013207 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013208
13209 ret_val = xmlInitParserCtxt(ctxt);
13210 desret_int(ret_val);
13211 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013212 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013213 xmlResetLastError();
13214 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013215 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013217 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013218 printf(" %d", n_ctxt);
13219 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013220 }
13221 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013222 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013223
Daniel Veillard42595322004-11-08 10:52:06 +000013224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013225}
13226
13227
13228static int
13229test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013231
13232 int mem_base;
13233 int ret_val;
13234 int val; /* int 0 or 1 */
13235 int n_val;
13236
13237 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13238 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013239 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013240
13241 ret_val = xmlKeepBlanksDefault(val);
13242 desret_int(ret_val);
13243 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013244 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013245 xmlResetLastError();
13246 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013247 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013249 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013250 printf(" %d", n_val);
13251 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013252 }
13253 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013254 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013255
Daniel Veillard42595322004-11-08 10:52:06 +000013256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013257}
13258
13259
13260static int
13261test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013263
13264 int mem_base;
13265 int ret_val;
13266 int val; /* int 0 or 1 */
13267 int n_val;
13268
13269 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13270 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013271 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013272
13273 ret_val = xmlLineNumbersDefault(val);
13274 desret_int(ret_val);
13275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013276 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013277 xmlResetLastError();
13278 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013279 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013281 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013282 printf(" %d", n_val);
13283 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013284 }
13285 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013287
Daniel Veillard42595322004-11-08 10:52:06 +000013288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013289}
13290
13291
13292static int
13293test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013295
Daniel Veillard42595322004-11-08 10:52:06 +000013296 int mem_base;
13297 xmlParserInputPtr ret_val;
13298 const char * URL; /* the URL for the entity to load */
13299 int n_URL;
13300 char * ID; /* the Public ID for the entity to load */
13301 int n_ID;
13302 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13303 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013304
Daniel Veillard42595322004-11-08 10:52:06 +000013305 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13306 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13307 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13308 mem_base = xmlMemBlocks();
13309 URL = gen_filepath(n_URL, 0);
13310 ID = gen_const_char_ptr(n_ID, 1);
13311 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13312
William M. Brackf13f77f2004-11-12 16:03:48 +000013313 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013314 desret_xmlParserInputPtr(ret_val);
13315 call_tests++;
13316 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013317 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013318 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13319 xmlResetLastError();
13320 if (mem_base != xmlMemBlocks()) {
13321 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13322 xmlMemBlocks() - mem_base);
13323 test_ret++;
13324 printf(" %d", n_URL);
13325 printf(" %d", n_ID);
13326 printf(" %d", n_ctxt);
13327 printf("\n");
13328 }
13329 }
13330 }
13331 }
Daniel Veillard42595322004-11-08 10:52:06 +000013332 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013333
Daniel Veillard42595322004-11-08 10:52:06 +000013334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013335}
13336
13337
13338static int
13339test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013341
Daniel Veillard42595322004-11-08 10:52:06 +000013342 int mem_base;
13343 xmlParserInputPtr ret_val;
13344 xmlParserCtxtPtr ctxt; /* an XML parser context */
13345 int n_ctxt;
13346 xmlParserInputBufferPtr input; /* an I/O Input */
13347 int n_input;
13348 xmlCharEncoding enc; /* the charset encoding if known */
13349 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013350
Daniel Veillard42595322004-11-08 10:52:06 +000013351 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13352 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13353 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13354 mem_base = xmlMemBlocks();
13355 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13356 input = gen_xmlParserInputBufferPtr(n_input, 1);
13357 enc = gen_xmlCharEncoding(n_enc, 2);
13358
13359 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13360 if (ret_val != NULL) input = NULL;
13361 desret_xmlParserInputPtr(ret_val);
13362 call_tests++;
13363 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13364 des_xmlParserInputBufferPtr(n_input, input, 1);
13365 des_xmlCharEncoding(n_enc, enc, 2);
13366 xmlResetLastError();
13367 if (mem_base != xmlMemBlocks()) {
13368 printf("Leak of %d blocks found in xmlNewIOInputStream",
13369 xmlMemBlocks() - mem_base);
13370 test_ret++;
13371 printf(" %d", n_ctxt);
13372 printf(" %d", n_input);
13373 printf(" %d", n_enc);
13374 printf("\n");
13375 }
13376 }
13377 }
13378 }
Daniel Veillard42595322004-11-08 10:52:06 +000013379 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013380
Daniel Veillard42595322004-11-08 10:52:06 +000013381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013382}
13383
13384
13385static int
13386test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013388
Daniel Veillard34099b42004-11-04 17:34:35 +000013389 int mem_base;
13390 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013391
Daniel Veillard34099b42004-11-04 17:34:35 +000013392 mem_base = xmlMemBlocks();
13393
13394 ret_val = xmlNewParserCtxt();
13395 desret_xmlParserCtxtPtr(ret_val);
13396 call_tests++;
13397 xmlResetLastError();
13398 if (mem_base != xmlMemBlocks()) {
13399 printf("Leak of %d blocks found in xmlNewParserCtxt",
13400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013401 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013402 printf("\n");
13403 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013404 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013405
Daniel Veillard42595322004-11-08 10:52:06 +000013406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013407}
13408
13409
Daniel Veillardce682bc2004-11-05 17:22:25 +000013410#define gen_nb_xmlNodePtr_ptr 1
13411static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13412 return(NULL);
13413}
13414static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13415}
13416
Daniel Veillardd93f6252004-11-02 15:53:51 +000013417static int
13418test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013420
Daniel Veillarda521d282004-11-09 14:59:59 +000013421#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013422 int mem_base;
13423 int ret_val;
13424 xmlDocPtr doc; /* the document the chunk pertains to */
13425 int n_doc;
13426 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13427 int n_sax;
13428 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13429 int n_user_data;
13430 int depth; /* Used for loop detection, use 0 */
13431 int n_depth;
13432 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13433 int n_string;
13434 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13435 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013436
Daniel Veillardce682bc2004-11-05 17:22:25 +000013437 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13438 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13439 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13440 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13441 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13442 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13443 mem_base = xmlMemBlocks();
13444 doc = gen_xmlDocPtr(n_doc, 0);
13445 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13446 user_data = gen_userdata(n_user_data, 2);
13447 depth = gen_int(n_depth, 3);
13448 string = gen_const_xmlChar_ptr(n_string, 4);
13449 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013450
13451#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013452 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013453#endif
13454
Daniel Veillardce682bc2004-11-05 17:22:25 +000013455
William M. Brackf13f77f2004-11-12 16:03:48 +000013456 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013457 desret_int(ret_val);
13458 call_tests++;
13459 des_xmlDocPtr(n_doc, doc, 0);
13460 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13461 des_userdata(n_user_data, user_data, 2);
13462 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013463 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013464 des_xmlNodePtr_ptr(n_lst, lst, 5);
13465 xmlResetLastError();
13466 if (mem_base != xmlMemBlocks()) {
13467 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013469 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013470 printf(" %d", n_doc);
13471 printf(" %d", n_sax);
13472 printf(" %d", n_user_data);
13473 printf(" %d", n_depth);
13474 printf(" %d", n_string);
13475 printf(" %d", n_lst);
13476 printf("\n");
13477 }
13478 }
13479 }
13480 }
13481 }
13482 }
13483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013484 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013485#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013486
Daniel Veillard42595322004-11-08 10:52:06 +000013487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013488}
13489
13490
13491static int
13492test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013494
Daniel Veillarda521d282004-11-09 14:59:59 +000013495#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013496 int mem_base;
13497 int ret_val;
13498 xmlDocPtr doc; /* the document the chunk pertains to */
13499 int n_doc;
13500 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13501 int n_sax;
13502 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13503 int n_user_data;
13504 int depth; /* Used for loop detection, use 0 */
13505 int n_depth;
13506 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13507 int n_string;
13508 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13509 int n_lst;
13510 int recover; /* return nodes even if the data is broken (use 0) */
13511 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013512
Daniel Veillardce682bc2004-11-05 17:22:25 +000013513 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13514 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13515 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13516 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13517 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13518 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13519 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13520 mem_base = xmlMemBlocks();
13521 doc = gen_xmlDocPtr(n_doc, 0);
13522 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13523 user_data = gen_userdata(n_user_data, 2);
13524 depth = gen_int(n_depth, 3);
13525 string = gen_const_xmlChar_ptr(n_string, 4);
13526 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13527 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013528
13529#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013530 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013531#endif
13532
Daniel Veillardce682bc2004-11-05 17:22:25 +000013533
William M. Brackf13f77f2004-11-12 16:03:48 +000013534 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013535 desret_int(ret_val);
13536 call_tests++;
13537 des_xmlDocPtr(n_doc, doc, 0);
13538 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13539 des_userdata(n_user_data, user_data, 2);
13540 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013541 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013542 des_xmlNodePtr_ptr(n_lst, lst, 5);
13543 des_int(n_recover, recover, 6);
13544 xmlResetLastError();
13545 if (mem_base != xmlMemBlocks()) {
13546 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013548 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013549 printf(" %d", n_doc);
13550 printf(" %d", n_sax);
13551 printf(" %d", n_user_data);
13552 printf(" %d", n_depth);
13553 printf(" %d", n_string);
13554 printf(" %d", n_lst);
13555 printf(" %d", n_recover);
13556 printf("\n");
13557 }
13558 }
13559 }
13560 }
13561 }
13562 }
13563 }
13564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013565 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013566#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013567
Daniel Veillard42595322004-11-08 10:52:06 +000013568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013569}
13570
13571
13572static int
13573test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013575
13576#ifdef LIBXML_PUSH_ENABLED
13577 int mem_base;
13578 int ret_val;
13579 xmlParserCtxtPtr ctxt; /* an XML parser context */
13580 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013581 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013582 int n_chunk;
13583 int size; /* the size in byte of the chunk */
13584 int n_size;
13585 int terminate; /* last chunk indicator */
13586 int n_terminate;
13587
13588 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13589 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13590 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13591 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13592 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013593 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13594 chunk = gen_const_char_ptr(n_chunk, 1);
13595 size = gen_int(n_size, 2);
13596 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013597
William M. Brackf13f77f2004-11-12 16:03:48 +000013598 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013599 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013600 desret_int(ret_val);
13601 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013602 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013603 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013604 des_int(n_size, size, 2);
13605 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013606 xmlResetLastError();
13607 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013608 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013610 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013611 printf(" %d", n_ctxt);
13612 printf(" %d", n_chunk);
13613 printf(" %d", n_size);
13614 printf(" %d", n_terminate);
13615 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013616 }
13617 }
13618 }
13619 }
13620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013621 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013622#endif
13623
Daniel Veillard42595322004-11-08 10:52:06 +000013624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013625}
13626
13627
13628static int
13629test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013631
Daniel Veillardce682bc2004-11-05 17:22:25 +000013632 int mem_base;
13633 int ret_val;
13634 xmlParserCtxtPtr ctx; /* the existing parsing context */
13635 int n_ctx;
13636 xmlChar * URL; /* the URL for the entity to load */
13637 int n_URL;
13638 xmlChar * ID; /* the System ID for the entity to load */
13639 int n_ID;
13640 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13641 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013642
Daniel Veillardce682bc2004-11-05 17:22:25 +000013643 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13644 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13645 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13646 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13647 mem_base = xmlMemBlocks();
13648 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13649 URL = gen_const_xmlChar_ptr(n_URL, 1);
13650 ID = gen_const_xmlChar_ptr(n_ID, 2);
13651 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13652
William M. Brackf13f77f2004-11-12 16:03:48 +000013653 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013654 desret_int(ret_val);
13655 call_tests++;
13656 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013657 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13658 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013659 des_xmlNodePtr_ptr(n_lst, lst, 3);
13660 xmlResetLastError();
13661 if (mem_base != xmlMemBlocks()) {
13662 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013664 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013665 printf(" %d", n_ctx);
13666 printf(" %d", n_URL);
13667 printf(" %d", n_ID);
13668 printf(" %d", n_lst);
13669 printf("\n");
13670 }
13671 }
13672 }
13673 }
13674 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013676
Daniel Veillard42595322004-11-08 10:52:06 +000013677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013678}
13679
13680
13681static int
13682test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013684
Daniel Veillarda521d282004-11-09 14:59:59 +000013685#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013686 int mem_base;
13687 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013688 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013689 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013690 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013691 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013692
Daniel Veillard34099b42004-11-04 17:34:35 +000013693 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13694 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13695 mem_base = xmlMemBlocks();
13696 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13697 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13698
William M. Brackf13f77f2004-11-12 16:03:48 +000013699 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013700 desret_xmlDtdPtr(ret_val);
13701 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013702 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13703 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013704 xmlResetLastError();
13705 if (mem_base != xmlMemBlocks()) {
13706 printf("Leak of %d blocks found in xmlParseDTD",
13707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013708 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013709 printf(" %d", n_ExternalID);
13710 printf(" %d", n_SystemID);
13711 printf("\n");
13712 }
13713 }
13714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013715 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013716#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013717
Daniel Veillard42595322004-11-08 10:52:06 +000013718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013719}
13720
13721
13722static int
13723test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013725
Daniel Veillarda521d282004-11-09 14:59:59 +000013726#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013727 int mem_base;
13728 xmlDocPtr ret_val;
13729 xmlChar * cur; /* a pointer to an array of xmlChar */
13730 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013731
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013732 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013734 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013735
13736 ret_val = xmlParseDoc(cur);
13737 desret_xmlDocPtr(ret_val);
13738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013739 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013740 xmlResetLastError();
13741 if (mem_base != xmlMemBlocks()) {
13742 printf("Leak of %d blocks found in xmlParseDoc",
13743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013744 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013745 printf(" %d", n_cur);
13746 printf("\n");
13747 }
13748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013749 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013750#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013751
Daniel Veillard42595322004-11-08 10:52:06 +000013752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013753}
13754
13755
13756static int
13757test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013759
13760 int mem_base;
13761 int ret_val;
13762 xmlParserCtxtPtr ctxt; /* an XML parser context */
13763 int n_ctxt;
13764
13765 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13766 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013767 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013768
13769 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013770 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013771 desret_int(ret_val);
13772 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013773 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013774 xmlResetLastError();
13775 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013776 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013778 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013779 printf(" %d", n_ctxt);
13780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013781 }
13782 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013783 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013784
Daniel Veillard42595322004-11-08 10:52:06 +000013785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013786}
13787
13788
13789static int
13790test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013792
Daniel Veillarda521d282004-11-09 14:59:59 +000013793#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013794 int mem_base;
13795 xmlDocPtr ret_val;
13796 const char * filename; /* the filename */
13797 int n_filename;
13798
13799 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13800 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013801 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013802
13803 ret_val = xmlParseEntity(filename);
13804 desret_xmlDocPtr(ret_val);
13805 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013806 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013807 xmlResetLastError();
13808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013809 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013812 printf(" %d", n_filename);
13813 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013814 }
13815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013816 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013817#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013818
Daniel Veillard42595322004-11-08 10:52:06 +000013819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013820}
13821
13822
13823static int
13824test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013826
13827 int mem_base;
13828 int ret_val;
13829 xmlParserCtxtPtr ctxt; /* an XML parser context */
13830 int n_ctxt;
13831
13832 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13833 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013834 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013835
13836 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013837 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013838 desret_int(ret_val);
13839 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013840 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013841 xmlResetLastError();
13842 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013843 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013845 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013846 printf(" %d", n_ctxt);
13847 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013848 }
13849 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013850 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013851
Daniel Veillard42595322004-11-08 10:52:06 +000013852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013853}
13854
13855
13856static int
13857test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013859
Daniel Veillarda521d282004-11-09 14:59:59 +000013860#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013861 int mem_base;
13862 int ret_val;
13863 xmlDocPtr doc; /* the document the chunk pertains to */
13864 int n_doc;
13865 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13866 int n_sax;
13867 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13868 int n_user_data;
13869 int depth; /* Used for loop detection, use 0 */
13870 int n_depth;
13871 xmlChar * URL; /* the URL for the entity to load */
13872 int n_URL;
13873 xmlChar * ID; /* the System ID for the entity to load */
13874 int n_ID;
13875 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13876 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013877
Daniel Veillardce682bc2004-11-05 17:22:25 +000013878 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13879 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13880 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13881 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13882 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13883 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13884 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13885 mem_base = xmlMemBlocks();
13886 doc = gen_xmlDocPtr(n_doc, 0);
13887 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13888 user_data = gen_userdata(n_user_data, 2);
13889 depth = gen_int(n_depth, 3);
13890 URL = gen_const_xmlChar_ptr(n_URL, 4);
13891 ID = gen_const_xmlChar_ptr(n_ID, 5);
13892 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13893
William M. Brackf13f77f2004-11-12 16:03:48 +000013894 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013895 desret_int(ret_val);
13896 call_tests++;
13897 des_xmlDocPtr(n_doc, doc, 0);
13898 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13899 des_userdata(n_user_data, user_data, 2);
13900 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013901 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13902 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013903 des_xmlNodePtr_ptr(n_lst, lst, 6);
13904 xmlResetLastError();
13905 if (mem_base != xmlMemBlocks()) {
13906 printf("Leak of %d blocks found in xmlParseExternalEntity",
13907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013908 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013909 printf(" %d", n_doc);
13910 printf(" %d", n_sax);
13911 printf(" %d", n_user_data);
13912 printf(" %d", n_depth);
13913 printf(" %d", n_URL);
13914 printf(" %d", n_ID);
13915 printf(" %d", n_lst);
13916 printf("\n");
13917 }
13918 }
13919 }
13920 }
13921 }
13922 }
13923 }
13924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013925 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013926#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013927
Daniel Veillard42595322004-11-08 10:52:06 +000013928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013929}
13930
13931
13932static int
13933test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013935
Daniel Veillarda521d282004-11-09 14:59:59 +000013936#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013937 int mem_base;
13938 xmlDocPtr ret_val;
13939 const char * filename; /* the filename */
13940 int n_filename;
13941
13942 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013944 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013945
13946 ret_val = xmlParseFile(filename);
13947 desret_xmlDocPtr(ret_val);
13948 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013949 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013950 xmlResetLastError();
13951 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013952 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013954 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013955 printf(" %d", n_filename);
13956 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013957 }
13958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013959 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013960#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013961
Daniel Veillard42595322004-11-08 10:52:06 +000013962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013963}
13964
13965
13966static int
13967test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013969
Daniel Veillard57b25162004-11-06 14:50:18 +000013970 int mem_base;
13971 xmlParserErrors ret_val;
13972 xmlNodePtr node; /* the context node */
13973 int n_node;
13974 char * data; /* the input string */
13975 int n_data;
13976 int datalen; /* the input string length in bytes */
13977 int n_datalen;
13978 int options; /* a combination of xmlParserOption */
13979 int n_options;
13980 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13981 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013982
Daniel Veillard57b25162004-11-06 14:50:18 +000013983 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13984 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13985 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013986 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013987 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13988 mem_base = xmlMemBlocks();
13989 node = gen_xmlNodePtr(n_node, 0);
13990 data = gen_const_char_ptr(n_data, 1);
13991 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013992 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013993 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13994
William M. Brackf13f77f2004-11-12 16:03:48 +000013995 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013996 desret_xmlParserErrors(ret_val);
13997 call_tests++;
13998 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013999 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000014000 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014001 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014002 des_xmlNodePtr_ptr(n_lst, lst, 4);
14003 xmlResetLastError();
14004 if (mem_base != xmlMemBlocks()) {
14005 printf("Leak of %d blocks found in xmlParseInNodeContext",
14006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014007 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014008 printf(" %d", n_node);
14009 printf(" %d", n_data);
14010 printf(" %d", n_datalen);
14011 printf(" %d", n_options);
14012 printf(" %d", n_lst);
14013 printf("\n");
14014 }
14015 }
14016 }
14017 }
14018 }
14019 }
Daniel Veillard57b25162004-11-06 14:50:18 +000014020 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014021
Daniel Veillard42595322004-11-08 10:52:06 +000014022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014023}
14024
14025
14026static int
14027test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014029
Daniel Veillarda521d282004-11-09 14:59:59 +000014030#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014031 int mem_base;
14032 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014033 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014034 int n_buffer;
14035 int size; /* the size of the array */
14036 int n_size;
14037
14038 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14039 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14040 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014041 buffer = gen_const_char_ptr(n_buffer, 0);
14042 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014043
William M. Brackf13f77f2004-11-12 16:03:48 +000014044 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014045 desret_xmlDocPtr(ret_val);
14046 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014047 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014048 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014049 xmlResetLastError();
14050 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014051 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014053 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014054 printf(" %d", n_buffer);
14055 printf(" %d", n_size);
14056 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014057 }
14058 }
14059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014060 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014061#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014062
Daniel Veillard42595322004-11-08 10:52:06 +000014063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014064}
14065
14066
Daniel Veillardce682bc2004-11-05 17:22:25 +000014067#define gen_nb_const_xmlParserNodeInfoPtr 1
14068static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14069 return(NULL);
14070}
14071static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14072}
14073
Daniel Veillardd93f6252004-11-02 15:53:51 +000014074static int
14075test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014077
Daniel Veillardce682bc2004-11-05 17:22:25 +000014078 int mem_base;
14079 xmlParserCtxtPtr ctxt; /* an XML parser context */
14080 int n_ctxt;
14081 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14082 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014083
Daniel Veillardce682bc2004-11-05 17:22:25 +000014084 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14085 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14086 mem_base = xmlMemBlocks();
14087 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14088 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14089
William M. Brackf13f77f2004-11-12 16:03:48 +000014090 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014091 call_tests++;
14092 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014093 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014094 xmlResetLastError();
14095 if (mem_base != xmlMemBlocks()) {
14096 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014098 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014099 printf(" %d", n_ctxt);
14100 printf(" %d", n_info);
14101 printf("\n");
14102 }
14103 }
14104 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014106
Daniel Veillard42595322004-11-08 10:52:06 +000014107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014108}
14109
14110
Daniel Veillardce682bc2004-11-05 17:22:25 +000014111#define gen_nb_const_xmlParserCtxtPtr 1
14112static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14113 return(NULL);
14114}
14115static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14116}
14117
Daniel Veillarda521d282004-11-09 14:59:59 +000014118#define gen_nb_const_xmlNodePtr 1
14119static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14120 return(NULL);
14121}
14122static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14123}
14124
Daniel Veillardd93f6252004-11-02 15:53:51 +000014125static int
14126test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014128
William M. Brack094dd862004-11-14 14:28:34 +000014129 int mem_base;
14130 const xmlParserNodeInfo * ret_val;
14131 xmlParserCtxtPtr ctx; /* an XML parser context */
14132 int n_ctx;
14133 xmlNodePtr node; /* an XML node within the tree */
14134 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014135
William M. Brack094dd862004-11-14 14:28:34 +000014136 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14137 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14138 mem_base = xmlMemBlocks();
14139 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14140 node = gen_const_xmlNodePtr(n_node, 1);
14141
14142 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14143 desret_const_xmlParserNodeInfo_ptr(ret_val);
14144 call_tests++;
14145 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14146 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14147 xmlResetLastError();
14148 if (mem_base != xmlMemBlocks()) {
14149 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14150 xmlMemBlocks() - mem_base);
14151 test_ret++;
14152 printf(" %d", n_ctx);
14153 printf(" %d", n_node);
14154 printf("\n");
14155 }
14156 }
14157 }
14158 function_tests++;
14159
Daniel Veillard42595322004-11-08 10:52:06 +000014160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014161}
14162
14163
Daniel Veillardce682bc2004-11-05 17:22:25 +000014164#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14165static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14166 return(NULL);
14167}
14168static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14169}
14170
Daniel Veillardd93f6252004-11-02 15:53:51 +000014171static int
14172test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014174
William M. Brack094dd862004-11-14 14:28:34 +000014175 int mem_base;
14176 unsigned long ret_val;
14177 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14178 int n_seq;
14179 xmlNodePtr node; /* an XML node pointer */
14180 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014181
William M. Brack094dd862004-11-14 14:28:34 +000014182 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14183 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14184 mem_base = xmlMemBlocks();
14185 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14186 node = gen_const_xmlNodePtr(n_node, 1);
14187
14188 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14189 desret_unsigned_long(ret_val);
14190 call_tests++;
14191 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14192 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14193 xmlResetLastError();
14194 if (mem_base != xmlMemBlocks()) {
14195 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14196 xmlMemBlocks() - mem_base);
14197 test_ret++;
14198 printf(" %d", n_seq);
14199 printf(" %d", n_node);
14200 printf("\n");
14201 }
14202 }
14203 }
14204 function_tests++;
14205
Daniel Veillard42595322004-11-08 10:52:06 +000014206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014207}
14208
14209
Daniel Veillardce682bc2004-11-05 17:22:25 +000014210#define gen_nb_xmlParserInputPtr 1
14211static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14212 return(NULL);
14213}
14214static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14215}
14216
Daniel Veillardd93f6252004-11-02 15:53:51 +000014217static int
14218test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014220
Daniel Veillardce682bc2004-11-05 17:22:25 +000014221 int mem_base;
14222 int ret_val;
14223 xmlParserInputPtr in; /* an XML parser input */
14224 int n_in;
14225 int len; /* an indicative size for the lookahead */
14226 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014227
Daniel Veillardce682bc2004-11-05 17:22:25 +000014228 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14229 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14230 mem_base = xmlMemBlocks();
14231 in = gen_xmlParserInputPtr(n_in, 0);
14232 len = gen_int(n_len, 1);
14233
14234 ret_val = xmlParserInputGrow(in, len);
14235 desret_int(ret_val);
14236 call_tests++;
14237 des_xmlParserInputPtr(n_in, in, 0);
14238 des_int(n_len, len, 1);
14239 xmlResetLastError();
14240 if (mem_base != xmlMemBlocks()) {
14241 printf("Leak of %d blocks found in xmlParserInputGrow",
14242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014243 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014244 printf(" %d", n_in);
14245 printf(" %d", n_len);
14246 printf("\n");
14247 }
14248 }
14249 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014250 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014251
Daniel Veillard42595322004-11-08 10:52:06 +000014252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014253}
14254
14255
14256static int
14257test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014259
Daniel Veillardce682bc2004-11-05 17:22:25 +000014260 int mem_base;
14261 int ret_val;
14262 xmlParserInputPtr in; /* an XML parser input */
14263 int n_in;
14264 int len; /* an indicative size for the lookahead */
14265 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014266
Daniel Veillardce682bc2004-11-05 17:22:25 +000014267 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14268 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14269 mem_base = xmlMemBlocks();
14270 in = gen_xmlParserInputPtr(n_in, 0);
14271 len = gen_int(n_len, 1);
14272
14273 ret_val = xmlParserInputRead(in, len);
14274 desret_int(ret_val);
14275 call_tests++;
14276 des_xmlParserInputPtr(n_in, in, 0);
14277 des_int(n_len, len, 1);
14278 xmlResetLastError();
14279 if (mem_base != xmlMemBlocks()) {
14280 printf("Leak of %d blocks found in xmlParserInputRead",
14281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014282 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014283 printf(" %d", n_in);
14284 printf(" %d", n_len);
14285 printf("\n");
14286 }
14287 }
14288 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014290
Daniel Veillard42595322004-11-08 10:52:06 +000014291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014292}
14293
14294
14295static int
14296test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014298
14299 int mem_base;
14300 int ret_val;
14301 int val; /* int 0 or 1 */
14302 int n_val;
14303
14304 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014306 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014307
14308 ret_val = xmlPedanticParserDefault(val);
14309 desret_int(ret_val);
14310 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014311 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014312 xmlResetLastError();
14313 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014314 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014316 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014317 printf(" %d", n_val);
14318 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014319 }
14320 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014321 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014322
Daniel Veillard42595322004-11-08 10:52:06 +000014323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014324}
14325
14326
14327static int
14328test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014330
14331 int mem_base;
14332 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014333 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334 int n_cur;
14335 const char * URL; /* the base URL to use for the document */
14336 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014337 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014338 int n_encoding;
14339 int options; /* a combination of xmlParserOption */
14340 int n_options;
14341
14342 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14343 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14344 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014345 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014346 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014347 cur = gen_const_xmlChar_ptr(n_cur, 0);
14348 URL = gen_filepath(n_URL, 1);
14349 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014350 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014351
William M. Brackf13f77f2004-11-12 16:03:48 +000014352 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014353 desret_xmlDocPtr(ret_val);
14354 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014355 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014356 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014357 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014358 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014359 xmlResetLastError();
14360 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014361 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014363 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014364 printf(" %d", n_cur);
14365 printf(" %d", n_URL);
14366 printf(" %d", n_encoding);
14367 printf(" %d", n_options);
14368 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014369 }
14370 }
14371 }
14372 }
14373 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014375
Daniel Veillard42595322004-11-08 10:52:06 +000014376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014377}
14378
14379
14380static int
14381test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014383
14384 int mem_base;
14385 xmlDocPtr ret_val;
14386 const char * filename; /* a file or URL */
14387 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014388 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014389 int n_encoding;
14390 int options; /* a combination of xmlParserOption */
14391 int n_options;
14392
14393 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14394 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014395 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014396 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014397 filename = gen_filepath(n_filename, 0);
14398 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014399 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014400
William M. Brackf13f77f2004-11-12 16:03:48 +000014401 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014402 desret_xmlDocPtr(ret_val);
14403 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014404 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014405 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014406 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014407 xmlResetLastError();
14408 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014409 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014411 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014412 printf(" %d", n_filename);
14413 printf(" %d", n_encoding);
14414 printf(" %d", n_options);
14415 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014416 }
14417 }
14418 }
14419 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014420 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014421
Daniel Veillard42595322004-11-08 10:52:06 +000014422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014423}
14424
14425
14426static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014427test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014429
14430 int mem_base;
14431 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014432 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014433 int n_buffer;
14434 int size; /* the size of the array */
14435 int n_size;
14436 const char * URL; /* the base URL to use for the document */
14437 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014438 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439 int n_encoding;
14440 int options; /* a combination of xmlParserOption */
14441 int n_options;
14442
14443 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14444 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14445 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14446 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014447 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014448 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014449 buffer = gen_const_char_ptr(n_buffer, 0);
14450 size = gen_int(n_size, 1);
14451 URL = gen_filepath(n_URL, 2);
14452 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014453 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014454
William M. Brackf13f77f2004-11-12 16:03:48 +000014455 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014456 desret_xmlDocPtr(ret_val);
14457 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014458 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014459 des_int(n_size, size, 1);
14460 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014461 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014462 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014463 xmlResetLastError();
14464 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014465 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014467 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014468 printf(" %d", n_buffer);
14469 printf(" %d", n_size);
14470 printf(" %d", n_URL);
14471 printf(" %d", n_encoding);
14472 printf(" %d", n_options);
14473 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014474 }
14475 }
14476 }
14477 }
14478 }
14479 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014481
Daniel Veillard42595322004-11-08 10:52:06 +000014482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014483}
14484
14485
14486static int
14487test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014489
Daniel Veillarda521d282004-11-09 14:59:59 +000014490#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014491 int mem_base;
14492 xmlDocPtr ret_val;
14493 xmlChar * cur; /* a pointer to an array of xmlChar */
14494 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014495
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014496 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014498 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014499
14500 ret_val = xmlRecoverDoc(cur);
14501 desret_xmlDocPtr(ret_val);
14502 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014503 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014504 xmlResetLastError();
14505 if (mem_base != xmlMemBlocks()) {
14506 printf("Leak of %d blocks found in xmlRecoverDoc",
14507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014508 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014509 printf(" %d", n_cur);
14510 printf("\n");
14511 }
14512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014513 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014514#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014515
Daniel Veillard42595322004-11-08 10:52:06 +000014516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014517}
14518
14519
14520static int
14521test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014523
Daniel Veillarda521d282004-11-09 14:59:59 +000014524#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014525 int mem_base;
14526 xmlDocPtr ret_val;
14527 const char * filename; /* the filename */
14528 int n_filename;
14529
14530 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14531 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014532 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014533
14534 ret_val = xmlRecoverFile(filename);
14535 desret_xmlDocPtr(ret_val);
14536 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014537 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014538 xmlResetLastError();
14539 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014540 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014542 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014543 printf(" %d", n_filename);
14544 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014545 }
14546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014547 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014548#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014549
Daniel Veillard42595322004-11-08 10:52:06 +000014550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014551}
14552
14553
14554static int
14555test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014557
Daniel Veillarda521d282004-11-09 14:59:59 +000014558#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014559 int mem_base;
14560 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014561 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014562 int n_buffer;
14563 int size; /* the size of the array */
14564 int n_size;
14565
14566 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14567 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014569 buffer = gen_const_char_ptr(n_buffer, 0);
14570 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014571
William M. Brackf13f77f2004-11-12 16:03:48 +000014572 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014573 desret_xmlDocPtr(ret_val);
14574 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014575 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014576 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014577 xmlResetLastError();
14578 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014579 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014581 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014582 printf(" %d", n_buffer);
14583 printf(" %d", n_size);
14584 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014585 }
14586 }
14587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014588 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014589#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014590
Daniel Veillard42595322004-11-08 10:52:06 +000014591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014592}
14593
14594
14595static int
14596test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014598
Daniel Veillarda521d282004-11-09 14:59:59 +000014599#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014600 int mem_base;
14601 xmlDtdPtr ret_val;
14602 xmlSAXHandlerPtr sax; /* the SAX handler block */
14603 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014604 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014605 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014606 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014607 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014608
Daniel Veillard34099b42004-11-04 17:34:35 +000014609 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14610 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14611 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14612 mem_base = xmlMemBlocks();
14613 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14614 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14615 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14616
William M. Brackf13f77f2004-11-12 16:03:48 +000014617 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014618 desret_xmlDtdPtr(ret_val);
14619 call_tests++;
14620 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014621 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14622 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014623 xmlResetLastError();
14624 if (mem_base != xmlMemBlocks()) {
14625 printf("Leak of %d blocks found in xmlSAXParseDTD",
14626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014627 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014628 printf(" %d", n_sax);
14629 printf(" %d", n_ExternalID);
14630 printf(" %d", n_SystemID);
14631 printf("\n");
14632 }
14633 }
14634 }
14635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014636 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014637#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014638
Daniel Veillard42595322004-11-08 10:52:06 +000014639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014640}
14641
14642
14643static int
14644test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014646
Daniel Veillarda521d282004-11-09 14:59:59 +000014647#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014648 int mem_base;
14649 xmlDocPtr ret_val;
14650 xmlSAXHandlerPtr sax; /* the SAX handler block */
14651 int n_sax;
14652 xmlChar * cur; /* a pointer to an array of xmlChar */
14653 int n_cur;
14654 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14655 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014656
Daniel Veillard34099b42004-11-04 17:34:35 +000014657 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14658 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14659 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14660 mem_base = xmlMemBlocks();
14661 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14662 cur = gen_xmlChar_ptr(n_cur, 1);
14663 recovery = gen_int(n_recovery, 2);
14664
14665 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14666 desret_xmlDocPtr(ret_val);
14667 call_tests++;
14668 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14669 des_xmlChar_ptr(n_cur, cur, 1);
14670 des_int(n_recovery, recovery, 2);
14671 xmlResetLastError();
14672 if (mem_base != xmlMemBlocks()) {
14673 printf("Leak of %d blocks found in xmlSAXParseDoc",
14674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014675 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014676 printf(" %d", n_sax);
14677 printf(" %d", n_cur);
14678 printf(" %d", n_recovery);
14679 printf("\n");
14680 }
14681 }
14682 }
14683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014684 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014685#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014686
Daniel Veillard42595322004-11-08 10:52:06 +000014687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014688}
14689
14690
14691static int
14692test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014694
Daniel Veillarda521d282004-11-09 14:59:59 +000014695#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014696 int mem_base;
14697 xmlDocPtr ret_val;
14698 xmlSAXHandlerPtr sax; /* the SAX handler block */
14699 int n_sax;
14700 const char * filename; /* the filename */
14701 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014702
Daniel Veillard34099b42004-11-04 17:34:35 +000014703 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14704 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14705 mem_base = xmlMemBlocks();
14706 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14707 filename = gen_filepath(n_filename, 1);
14708
14709 ret_val = xmlSAXParseEntity(sax, filename);
14710 desret_xmlDocPtr(ret_val);
14711 call_tests++;
14712 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14713 des_filepath(n_filename, filename, 1);
14714 xmlResetLastError();
14715 if (mem_base != xmlMemBlocks()) {
14716 printf("Leak of %d blocks found in xmlSAXParseEntity",
14717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014718 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014719 printf(" %d", n_sax);
14720 printf(" %d", n_filename);
14721 printf("\n");
14722 }
14723 }
14724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014725 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014726#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014727
Daniel Veillard42595322004-11-08 10:52:06 +000014728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014729}
14730
14731
14732static int
14733test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014735
Daniel Veillarda521d282004-11-09 14:59:59 +000014736#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014737 int mem_base;
14738 xmlDocPtr ret_val;
14739 xmlSAXHandlerPtr sax; /* the SAX handler block */
14740 int n_sax;
14741 const char * filename; /* the filename */
14742 int n_filename;
14743 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14744 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014745
Daniel Veillard34099b42004-11-04 17:34:35 +000014746 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14747 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14748 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14749 mem_base = xmlMemBlocks();
14750 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14751 filename = gen_filepath(n_filename, 1);
14752 recovery = gen_int(n_recovery, 2);
14753
14754 ret_val = xmlSAXParseFile(sax, filename, recovery);
14755 desret_xmlDocPtr(ret_val);
14756 call_tests++;
14757 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14758 des_filepath(n_filename, filename, 1);
14759 des_int(n_recovery, recovery, 2);
14760 xmlResetLastError();
14761 if (mem_base != xmlMemBlocks()) {
14762 printf("Leak of %d blocks found in xmlSAXParseFile",
14763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014764 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014765 printf(" %d", n_sax);
14766 printf(" %d", n_filename);
14767 printf(" %d", n_recovery);
14768 printf("\n");
14769 }
14770 }
14771 }
14772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014773 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014774#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014775
Daniel Veillard42595322004-11-08 10:52:06 +000014776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014777}
14778
14779
14780static int
14781test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014783
Daniel Veillarda521d282004-11-09 14:59:59 +000014784#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014785 int mem_base;
14786 xmlDocPtr ret_val;
14787 xmlSAXHandlerPtr sax; /* the SAX handler block */
14788 int n_sax;
14789 const char * filename; /* the filename */
14790 int n_filename;
14791 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14792 int n_recovery;
14793 void * data; /* the userdata */
14794 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014795
Daniel Veillard34099b42004-11-04 17:34:35 +000014796 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14797 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14798 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14799 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14800 mem_base = xmlMemBlocks();
14801 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14802 filename = gen_filepath(n_filename, 1);
14803 recovery = gen_int(n_recovery, 2);
14804 data = gen_userdata(n_data, 3);
14805
14806 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14807 desret_xmlDocPtr(ret_val);
14808 call_tests++;
14809 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14810 des_filepath(n_filename, filename, 1);
14811 des_int(n_recovery, recovery, 2);
14812 des_userdata(n_data, data, 3);
14813 xmlResetLastError();
14814 if (mem_base != xmlMemBlocks()) {
14815 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014817 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014818 printf(" %d", n_sax);
14819 printf(" %d", n_filename);
14820 printf(" %d", n_recovery);
14821 printf(" %d", n_data);
14822 printf("\n");
14823 }
14824 }
14825 }
14826 }
14827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014828 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014829#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014830
Daniel Veillard42595322004-11-08 10:52:06 +000014831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014832}
14833
14834
14835static int
14836test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014838
Daniel Veillarda521d282004-11-09 14:59:59 +000014839#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014840 int mem_base;
14841 xmlDocPtr ret_val;
14842 xmlSAXHandlerPtr sax; /* the SAX handler block */
14843 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014844 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014845 int n_buffer;
14846 int size; /* the size of the array */
14847 int n_size;
14848 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14849 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014850
Daniel Veillard34099b42004-11-04 17:34:35 +000014851 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14852 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14853 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14854 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14855 mem_base = xmlMemBlocks();
14856 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14857 buffer = gen_const_char_ptr(n_buffer, 1);
14858 size = gen_int(n_size, 2);
14859 recovery = gen_int(n_recovery, 3);
14860
William M. Brackf13f77f2004-11-12 16:03:48 +000014861 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014862 desret_xmlDocPtr(ret_val);
14863 call_tests++;
14864 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014865 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014866 des_int(n_size, size, 2);
14867 des_int(n_recovery, recovery, 3);
14868 xmlResetLastError();
14869 if (mem_base != xmlMemBlocks()) {
14870 printf("Leak of %d blocks found in xmlSAXParseMemory",
14871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014872 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014873 printf(" %d", n_sax);
14874 printf(" %d", n_buffer);
14875 printf(" %d", n_size);
14876 printf(" %d", n_recovery);
14877 printf("\n");
14878 }
14879 }
14880 }
14881 }
14882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014883 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014884#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014885
Daniel Veillard42595322004-11-08 10:52:06 +000014886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014887}
14888
14889
14890static int
14891test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014893
Daniel Veillarda521d282004-11-09 14:59:59 +000014894#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014895 int mem_base;
14896 xmlDocPtr ret_val;
14897 xmlSAXHandlerPtr sax; /* the SAX handler block */
14898 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014899 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014900 int n_buffer;
14901 int size; /* the size of the array */
14902 int n_size;
14903 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14904 int n_recovery;
14905 void * data; /* the userdata */
14906 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014907
Daniel Veillard34099b42004-11-04 17:34:35 +000014908 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14909 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14910 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14911 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14912 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14913 mem_base = xmlMemBlocks();
14914 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14915 buffer = gen_const_char_ptr(n_buffer, 1);
14916 size = gen_int(n_size, 2);
14917 recovery = gen_int(n_recovery, 3);
14918 data = gen_userdata(n_data, 4);
14919
William M. Brackf13f77f2004-11-12 16:03:48 +000014920 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014921 desret_xmlDocPtr(ret_val);
14922 call_tests++;
14923 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014924 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014925 des_int(n_size, size, 2);
14926 des_int(n_recovery, recovery, 3);
14927 des_userdata(n_data, data, 4);
14928 xmlResetLastError();
14929 if (mem_base != xmlMemBlocks()) {
14930 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014932 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014933 printf(" %d", n_sax);
14934 printf(" %d", n_buffer);
14935 printf(" %d", n_size);
14936 printf(" %d", n_recovery);
14937 printf(" %d", n_data);
14938 printf("\n");
14939 }
14940 }
14941 }
14942 }
14943 }
14944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014945 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014946#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014947
Daniel Veillard42595322004-11-08 10:52:06 +000014948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014949}
14950
14951
14952static int
14953test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014955
Daniel Veillarda521d282004-11-09 14:59:59 +000014956#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014957 int mem_base;
14958 int ret_val;
14959 xmlSAXHandlerPtr sax; /* a SAX handler */
14960 int n_sax;
14961 void * user_data; /* The user data returned on SAX callbacks */
14962 int n_user_data;
14963 const char * filename; /* a file name */
14964 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014965
Daniel Veillard34099b42004-11-04 17:34:35 +000014966 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14967 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14968 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14969 mem_base = xmlMemBlocks();
14970 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14971 user_data = gen_userdata(n_user_data, 1);
14972 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014973
14974#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014975 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014976#endif
14977
Daniel Veillard34099b42004-11-04 17:34:35 +000014978
14979 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14980 desret_int(ret_val);
14981 call_tests++;
14982 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14983 des_userdata(n_user_data, user_data, 1);
14984 des_filepath(n_filename, filename, 2);
14985 xmlResetLastError();
14986 if (mem_base != xmlMemBlocks()) {
14987 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014989 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014990 printf(" %d", n_sax);
14991 printf(" %d", n_user_data);
14992 printf(" %d", n_filename);
14993 printf("\n");
14994 }
14995 }
14996 }
14997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014998 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014999#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015000
Daniel Veillard42595322004-11-08 10:52:06 +000015001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015002}
15003
15004
15005static int
15006test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015008
Daniel Veillarda521d282004-11-09 14:59:59 +000015009#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015010 int mem_base;
15011 int ret_val;
15012 xmlSAXHandlerPtr sax; /* a SAX handler */
15013 int n_sax;
15014 void * user_data; /* The user data returned on SAX callbacks */
15015 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015016 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015017 int n_buffer;
15018 int size; /* the length of the XML document in bytes */
15019 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015020
Daniel Veillard34099b42004-11-04 17:34:35 +000015021 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15022 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15023 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15024 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15025 mem_base = xmlMemBlocks();
15026 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15027 user_data = gen_userdata(n_user_data, 1);
15028 buffer = gen_const_char_ptr(n_buffer, 2);
15029 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015030
15031#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015032 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015033#endif
15034
Daniel Veillard34099b42004-11-04 17:34:35 +000015035
William M. Brackf13f77f2004-11-12 16:03:48 +000015036 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015037 desret_int(ret_val);
15038 call_tests++;
15039 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15040 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015041 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015042 des_int(n_size, size, 3);
15043 xmlResetLastError();
15044 if (mem_base != xmlMemBlocks()) {
15045 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015047 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015048 printf(" %d", n_sax);
15049 printf(" %d", n_user_data);
15050 printf(" %d", n_buffer);
15051 printf(" %d", n_size);
15052 printf("\n");
15053 }
15054 }
15055 }
15056 }
15057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015058 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015059#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015060
Daniel Veillard42595322004-11-08 10:52:06 +000015061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015062}
15063
15064
15065static int
15066test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015068
15069
15070 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015072}
15073
15074
15075static int
15076test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015078
Daniel Veillarda521d282004-11-09 14:59:59 +000015079#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015080 int mem_base;
15081 int ret_val;
15082 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15083 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015084 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015085 int n_name;
15086 void * value; /* pointer to the location of the new value */
15087 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015088
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015089 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15090 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15091 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15092 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015093 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15094 name = gen_const_char_ptr(n_name, 1);
15095 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015096
William M. Brackf13f77f2004-11-12 16:03:48 +000015097 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015098 desret_int(ret_val);
15099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015100 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015101 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015102 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015103 xmlResetLastError();
15104 if (mem_base != xmlMemBlocks()) {
15105 printf("Leak of %d blocks found in xmlSetFeature",
15106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015107 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015108 printf(" %d", n_ctxt);
15109 printf(" %d", n_name);
15110 printf(" %d", n_value);
15111 printf("\n");
15112 }
15113 }
15114 }
15115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015116 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015117#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015118
Daniel Veillard42595322004-11-08 10:52:06 +000015119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015120}
15121
15122
15123static int
15124test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015126
Daniel Veillarda521d282004-11-09 14:59:59 +000015127#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015128 int mem_base;
15129 xmlParserCtxtPtr ctxt; /* an XML parser context */
15130 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015131 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015132 int n_buffer;
15133 const char * filename; /* a file name */
15134 int n_filename;
15135
15136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15137 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15138 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15139 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015140 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15141 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15142 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015143
William M. Brackf13f77f2004-11-12 16:03:48 +000015144 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015146 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015147 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015148 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015149 xmlResetLastError();
15150 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015151 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015153 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015154 printf(" %d", n_ctxt);
15155 printf(" %d", n_buffer);
15156 printf(" %d", n_filename);
15157 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015158 }
15159 }
15160 }
15161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015162 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015163#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015164
Daniel Veillard42595322004-11-08 10:52:06 +000015165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015166}
15167
15168
15169static int
15170test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015172
Daniel Veillarda521d282004-11-09 14:59:59 +000015173#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015174 int mem_base;
15175 xmlParserCtxtPtr ctxt; /* an XML parser context */
15176 int n_ctxt;
15177
15178 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015180 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015181
15182 xmlStopParser(ctxt);
15183 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015184 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015185 xmlResetLastError();
15186 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015187 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015189 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015190 printf(" %d", n_ctxt);
15191 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015192 }
15193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015194 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015195#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015196
Daniel Veillard42595322004-11-08 10:52:06 +000015197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015198}
15199
15200
15201static int
15202test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015204
15205 int mem_base;
15206 int ret_val;
15207 int val; /* int 0 or 1 */
15208 int n_val;
15209
15210 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015212 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015213
15214 ret_val = xmlSubstituteEntitiesDefault(val);
15215 desret_int(ret_val);
15216 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015217 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015218 xmlResetLastError();
15219 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015220 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015222 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015223 printf(" %d", n_val);
15224 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015225 }
15226 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015228
Daniel Veillard42595322004-11-08 10:52:06 +000015229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015230}
15231
15232static int
15233test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015235
William M. Brack094dd862004-11-14 14:28:34 +000015236 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015237 test_ret += test_xmlByteConsumed();
15238 test_ret += test_xmlClearNodeInfoSeq();
15239 test_ret += test_xmlClearParserCtxt();
15240 test_ret += test_xmlCreateDocParserCtxt();
15241 test_ret += test_xmlCreatePushParserCtxt();
15242 test_ret += test_xmlCtxtReadDoc();
15243 test_ret += test_xmlCtxtReadFile();
15244 test_ret += test_xmlCtxtReadMemory();
15245 test_ret += test_xmlCtxtReset();
15246 test_ret += test_xmlCtxtResetPush();
15247 test_ret += test_xmlCtxtUseOptions();
15248 test_ret += test_xmlGetExternalEntityLoader();
15249 test_ret += test_xmlGetFeature();
15250 test_ret += test_xmlGetFeaturesList();
15251 test_ret += test_xmlIOParseDTD();
15252 test_ret += test_xmlInitNodeInfoSeq();
15253 test_ret += test_xmlInitParser();
15254 test_ret += test_xmlInitParserCtxt();
15255 test_ret += test_xmlKeepBlanksDefault();
15256 test_ret += test_xmlLineNumbersDefault();
15257 test_ret += test_xmlLoadExternalEntity();
15258 test_ret += test_xmlNewIOInputStream();
15259 test_ret += test_xmlNewParserCtxt();
15260 test_ret += test_xmlParseBalancedChunkMemory();
15261 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15262 test_ret += test_xmlParseChunk();
15263 test_ret += test_xmlParseCtxtExternalEntity();
15264 test_ret += test_xmlParseDTD();
15265 test_ret += test_xmlParseDoc();
15266 test_ret += test_xmlParseDocument();
15267 test_ret += test_xmlParseEntity();
15268 test_ret += test_xmlParseExtParsedEnt();
15269 test_ret += test_xmlParseExternalEntity();
15270 test_ret += test_xmlParseFile();
15271 test_ret += test_xmlParseInNodeContext();
15272 test_ret += test_xmlParseMemory();
15273 test_ret += test_xmlParserAddNodeInfo();
15274 test_ret += test_xmlParserFindNodeInfo();
15275 test_ret += test_xmlParserFindNodeInfoIndex();
15276 test_ret += test_xmlParserInputGrow();
15277 test_ret += test_xmlParserInputRead();
15278 test_ret += test_xmlPedanticParserDefault();
15279 test_ret += test_xmlReadDoc();
15280 test_ret += test_xmlReadFile();
15281 test_ret += test_xmlReadMemory();
15282 test_ret += test_xmlRecoverDoc();
15283 test_ret += test_xmlRecoverFile();
15284 test_ret += test_xmlRecoverMemory();
15285 test_ret += test_xmlSAXParseDTD();
15286 test_ret += test_xmlSAXParseDoc();
15287 test_ret += test_xmlSAXParseEntity();
15288 test_ret += test_xmlSAXParseFile();
15289 test_ret += test_xmlSAXParseFileWithData();
15290 test_ret += test_xmlSAXParseMemory();
15291 test_ret += test_xmlSAXParseMemoryWithData();
15292 test_ret += test_xmlSAXUserParseFile();
15293 test_ret += test_xmlSAXUserParseMemory();
15294 test_ret += test_xmlSetExternalEntityLoader();
15295 test_ret += test_xmlSetFeature();
15296 test_ret += test_xmlSetupParserForBuffer();
15297 test_ret += test_xmlStopParser();
15298 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015299
Daniel Veillard42595322004-11-08 10:52:06 +000015300 if (test_ret != 0)
15301 printf("Module parser: %d errors\n", test_ret);
15302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015303}
15304
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015305static int
15306test_htmlCreateFileParserCtxt(void) {
15307 int test_ret = 0;
15308
15309#ifdef LIBXML_HTML_ENABLED
15310 int mem_base;
15311 htmlParserCtxtPtr ret_val;
15312 const char * filename; /* the filename */
15313 int n_filename;
15314 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15315 int n_encoding;
15316
15317 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15318 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15319 mem_base = xmlMemBlocks();
15320 filename = gen_fileoutput(n_filename, 0);
15321 encoding = gen_const_char_ptr(n_encoding, 1);
15322
William M. Brackf13f77f2004-11-12 16:03:48 +000015323 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015324 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015325 call_tests++;
15326 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015327 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015328 xmlResetLastError();
15329 if (mem_base != xmlMemBlocks()) {
15330 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15331 xmlMemBlocks() - mem_base);
15332 test_ret++;
15333 printf(" %d", n_filename);
15334 printf(" %d", n_encoding);
15335 printf("\n");
15336 }
15337 }
15338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015339 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015340#endif
15341
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015342 return(test_ret);
15343}
15344
15345
15346static int
15347test_htmlInitAutoClose(void) {
15348 int test_ret = 0;
15349
15350#ifdef LIBXML_HTML_ENABLED
15351 int mem_base;
15352
15353 mem_base = xmlMemBlocks();
15354
15355 htmlInitAutoClose();
15356 call_tests++;
15357 xmlResetLastError();
15358 if (mem_base != xmlMemBlocks()) {
15359 printf("Leak of %d blocks found in htmlInitAutoClose",
15360 xmlMemBlocks() - mem_base);
15361 test_ret++;
15362 printf("\n");
15363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015364 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015365#endif
15366
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015367 return(test_ret);
15368}
15369
15370
15371static int
15372test_inputPop(void) {
15373 int test_ret = 0;
15374
15375 int mem_base;
15376 xmlParserInputPtr ret_val;
15377 xmlParserCtxtPtr ctxt; /* an XML parser context */
15378 int n_ctxt;
15379
15380 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15381 mem_base = xmlMemBlocks();
15382 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15383
15384 ret_val = inputPop(ctxt);
15385 desret_xmlParserInputPtr(ret_val);
15386 call_tests++;
15387 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15388 xmlResetLastError();
15389 if (mem_base != xmlMemBlocks()) {
15390 printf("Leak of %d blocks found in inputPop",
15391 xmlMemBlocks() - mem_base);
15392 test_ret++;
15393 printf(" %d", n_ctxt);
15394 printf("\n");
15395 }
15396 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015397 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015398
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015399 return(test_ret);
15400}
15401
15402
15403static int
15404test_inputPush(void) {
15405 int test_ret = 0;
15406
15407 int mem_base;
15408 int ret_val;
15409 xmlParserCtxtPtr ctxt; /* an XML parser context */
15410 int n_ctxt;
15411 xmlParserInputPtr value; /* the parser input */
15412 int n_value;
15413
15414 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15415 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15416 mem_base = xmlMemBlocks();
15417 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15418 value = gen_xmlParserInputPtr(n_value, 1);
15419
15420 ret_val = inputPush(ctxt, value);
15421 desret_int(ret_val);
15422 call_tests++;
15423 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15424 des_xmlParserInputPtr(n_value, value, 1);
15425 xmlResetLastError();
15426 if (mem_base != xmlMemBlocks()) {
15427 printf("Leak of %d blocks found in inputPush",
15428 xmlMemBlocks() - mem_base);
15429 test_ret++;
15430 printf(" %d", n_ctxt);
15431 printf(" %d", n_value);
15432 printf("\n");
15433 }
15434 }
15435 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015436 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015437
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015438 return(test_ret);
15439}
15440
15441
15442static int
15443test_namePop(void) {
15444 int test_ret = 0;
15445
15446 int mem_base;
15447 const xmlChar * ret_val;
15448 xmlParserCtxtPtr ctxt; /* an XML parser context */
15449 int n_ctxt;
15450
15451 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15452 mem_base = xmlMemBlocks();
15453 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15454
15455 ret_val = namePop(ctxt);
15456 desret_const_xmlChar_ptr(ret_val);
15457 call_tests++;
15458 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15459 xmlResetLastError();
15460 if (mem_base != xmlMemBlocks()) {
15461 printf("Leak of %d blocks found in namePop",
15462 xmlMemBlocks() - mem_base);
15463 test_ret++;
15464 printf(" %d", n_ctxt);
15465 printf("\n");
15466 }
15467 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015468 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015469
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015470 return(test_ret);
15471}
15472
15473
15474static int
15475test_namePush(void) {
15476 int test_ret = 0;
15477
15478 int mem_base;
15479 int ret_val;
15480 xmlParserCtxtPtr ctxt; /* an XML parser context */
15481 int n_ctxt;
15482 xmlChar * value; /* the element name */
15483 int n_value;
15484
15485 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15486 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15487 mem_base = xmlMemBlocks();
15488 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15489 value = gen_const_xmlChar_ptr(n_value, 1);
15490
William M. Brackf13f77f2004-11-12 16:03:48 +000015491 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015492 desret_int(ret_val);
15493 call_tests++;
15494 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015495 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015496 xmlResetLastError();
15497 if (mem_base != xmlMemBlocks()) {
15498 printf("Leak of %d blocks found in namePush",
15499 xmlMemBlocks() - mem_base);
15500 test_ret++;
15501 printf(" %d", n_ctxt);
15502 printf(" %d", n_value);
15503 printf("\n");
15504 }
15505 }
15506 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015507 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015508
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015509 return(test_ret);
15510}
15511
15512
15513static int
15514test_nodePop(void) {
15515 int test_ret = 0;
15516
15517 int mem_base;
15518 xmlNodePtr ret_val;
15519 xmlParserCtxtPtr ctxt; /* an XML parser context */
15520 int n_ctxt;
15521
15522 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15523 mem_base = xmlMemBlocks();
15524 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15525
15526 ret_val = nodePop(ctxt);
15527 desret_xmlNodePtr(ret_val);
15528 call_tests++;
15529 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15530 xmlResetLastError();
15531 if (mem_base != xmlMemBlocks()) {
15532 printf("Leak of %d blocks found in nodePop",
15533 xmlMemBlocks() - mem_base);
15534 test_ret++;
15535 printf(" %d", n_ctxt);
15536 printf("\n");
15537 }
15538 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015539 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015540
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015541 return(test_ret);
15542}
15543
15544
15545static int
15546test_nodePush(void) {
15547 int test_ret = 0;
15548
15549 int mem_base;
15550 int ret_val;
15551 xmlParserCtxtPtr ctxt; /* an XML parser context */
15552 int n_ctxt;
15553 xmlNodePtr value; /* the element node */
15554 int n_value;
15555
15556 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15557 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15558 mem_base = xmlMemBlocks();
15559 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15560 value = gen_xmlNodePtr(n_value, 1);
15561
15562 ret_val = nodePush(ctxt, value);
15563 desret_int(ret_val);
15564 call_tests++;
15565 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15566 des_xmlNodePtr(n_value, value, 1);
15567 xmlResetLastError();
15568 if (mem_base != xmlMemBlocks()) {
15569 printf("Leak of %d blocks found in nodePush",
15570 xmlMemBlocks() - mem_base);
15571 test_ret++;
15572 printf(" %d", n_ctxt);
15573 printf(" %d", n_value);
15574 printf("\n");
15575 }
15576 }
15577 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015578 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015579
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015580 return(test_ret);
15581}
15582
15583
15584static int
15585test_xmlCheckLanguageID(void) {
15586 int test_ret = 0;
15587
15588 int mem_base;
15589 int ret_val;
15590 xmlChar * lang; /* pointer to the string value */
15591 int n_lang;
15592
15593 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15594 mem_base = xmlMemBlocks();
15595 lang = gen_const_xmlChar_ptr(n_lang, 0);
15596
William M. Brackf13f77f2004-11-12 16:03:48 +000015597 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015598 desret_int(ret_val);
15599 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015600 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015601 xmlResetLastError();
15602 if (mem_base != xmlMemBlocks()) {
15603 printf("Leak of %d blocks found in xmlCheckLanguageID",
15604 xmlMemBlocks() - mem_base);
15605 test_ret++;
15606 printf(" %d", n_lang);
15607 printf("\n");
15608 }
15609 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015610 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015611
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015612 return(test_ret);
15613}
15614
15615
15616static int
15617test_xmlCopyChar(void) {
15618 int test_ret = 0;
15619
15620 int mem_base;
15621 int ret_val;
15622 int len; /* Ignored, compatibility */
15623 int n_len;
15624 xmlChar * out; /* pointer to an array of xmlChar */
15625 int n_out;
15626 int val; /* the char value */
15627 int n_val;
15628
15629 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15630 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15631 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15632 mem_base = xmlMemBlocks();
15633 len = gen_int(n_len, 0);
15634 out = gen_xmlChar_ptr(n_out, 1);
15635 val = gen_int(n_val, 2);
15636
15637 ret_val = xmlCopyChar(len, out, val);
15638 desret_int(ret_val);
15639 call_tests++;
15640 des_int(n_len, len, 0);
15641 des_xmlChar_ptr(n_out, out, 1);
15642 des_int(n_val, val, 2);
15643 xmlResetLastError();
15644 if (mem_base != xmlMemBlocks()) {
15645 printf("Leak of %d blocks found in xmlCopyChar",
15646 xmlMemBlocks() - mem_base);
15647 test_ret++;
15648 printf(" %d", n_len);
15649 printf(" %d", n_out);
15650 printf(" %d", n_val);
15651 printf("\n");
15652 }
15653 }
15654 }
15655 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015656 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015657
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015658 return(test_ret);
15659}
15660
15661
15662static int
15663test_xmlCopyCharMultiByte(void) {
15664 int test_ret = 0;
15665
15666 int mem_base;
15667 int ret_val;
15668 xmlChar * out; /* pointer to an array of xmlChar */
15669 int n_out;
15670 int val; /* the char value */
15671 int n_val;
15672
15673 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15674 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15675 mem_base = xmlMemBlocks();
15676 out = gen_xmlChar_ptr(n_out, 0);
15677 val = gen_int(n_val, 1);
15678
15679 ret_val = xmlCopyCharMultiByte(out, val);
15680 desret_int(ret_val);
15681 call_tests++;
15682 des_xmlChar_ptr(n_out, out, 0);
15683 des_int(n_val, val, 1);
15684 xmlResetLastError();
15685 if (mem_base != xmlMemBlocks()) {
15686 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15687 xmlMemBlocks() - mem_base);
15688 test_ret++;
15689 printf(" %d", n_out);
15690 printf(" %d", n_val);
15691 printf("\n");
15692 }
15693 }
15694 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015695 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015696
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015697 return(test_ret);
15698}
15699
15700
15701static int
15702test_xmlCreateEntityParserCtxt(void) {
15703 int test_ret = 0;
15704
15705 int mem_base;
15706 xmlParserCtxtPtr ret_val;
15707 xmlChar * URL; /* the entity URL */
15708 int n_URL;
15709 xmlChar * ID; /* the entity PUBLIC ID */
15710 int n_ID;
15711 xmlChar * base; /* a possible base for the target URI */
15712 int n_base;
15713
15714 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15715 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15716 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15717 mem_base = xmlMemBlocks();
15718 URL = gen_const_xmlChar_ptr(n_URL, 0);
15719 ID = gen_const_xmlChar_ptr(n_ID, 1);
15720 base = gen_const_xmlChar_ptr(n_base, 2);
15721
William M. Brackf13f77f2004-11-12 16:03:48 +000015722 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015723 desret_xmlParserCtxtPtr(ret_val);
15724 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015725 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15726 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15727 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015728 xmlResetLastError();
15729 if (mem_base != xmlMemBlocks()) {
15730 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15731 xmlMemBlocks() - mem_base);
15732 test_ret++;
15733 printf(" %d", n_URL);
15734 printf(" %d", n_ID);
15735 printf(" %d", n_base);
15736 printf("\n");
15737 }
15738 }
15739 }
15740 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015742
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015743 return(test_ret);
15744}
15745
15746
15747static int
15748test_xmlCreateFileParserCtxt(void) {
15749 int test_ret = 0;
15750
15751 int mem_base;
15752 xmlParserCtxtPtr ret_val;
15753 const char * filename; /* the filename */
15754 int n_filename;
15755
15756 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15757 mem_base = xmlMemBlocks();
15758 filename = gen_fileoutput(n_filename, 0);
15759
15760 ret_val = xmlCreateFileParserCtxt(filename);
15761 desret_xmlParserCtxtPtr(ret_val);
15762 call_tests++;
15763 des_fileoutput(n_filename, filename, 0);
15764 xmlResetLastError();
15765 if (mem_base != xmlMemBlocks()) {
15766 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15767 xmlMemBlocks() - mem_base);
15768 test_ret++;
15769 printf(" %d", n_filename);
15770 printf("\n");
15771 }
15772 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015773 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015774
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015775 return(test_ret);
15776}
15777
15778
15779static int
15780test_xmlCreateMemoryParserCtxt(void) {
15781 int test_ret = 0;
15782
15783 int mem_base;
15784 xmlParserCtxtPtr ret_val;
15785 char * buffer; /* a pointer to a char array */
15786 int n_buffer;
15787 int size; /* the size of the array */
15788 int n_size;
15789
15790 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15791 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15792 mem_base = xmlMemBlocks();
15793 buffer = gen_const_char_ptr(n_buffer, 0);
15794 size = gen_int(n_size, 1);
15795
William M. Brackf13f77f2004-11-12 16:03:48 +000015796 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015797 desret_xmlParserCtxtPtr(ret_val);
15798 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015799 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015800 des_int(n_size, size, 1);
15801 xmlResetLastError();
15802 if (mem_base != xmlMemBlocks()) {
15803 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15804 xmlMemBlocks() - mem_base);
15805 test_ret++;
15806 printf(" %d", n_buffer);
15807 printf(" %d", n_size);
15808 printf("\n");
15809 }
15810 }
15811 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015812 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015813
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015814 return(test_ret);
15815}
15816
15817
15818static int
15819test_xmlCreateURLParserCtxt(void) {
15820 int test_ret = 0;
15821
15822 int mem_base;
15823 xmlParserCtxtPtr ret_val;
15824 const char * filename; /* the filename or URL */
15825 int n_filename;
15826 int options; /* a combination of xmlParserOption */
15827 int n_options;
15828
15829 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15830 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15831 mem_base = xmlMemBlocks();
15832 filename = gen_fileoutput(n_filename, 0);
15833 options = gen_int(n_options, 1);
15834
15835 ret_val = xmlCreateURLParserCtxt(filename, options);
15836 desret_xmlParserCtxtPtr(ret_val);
15837 call_tests++;
15838 des_fileoutput(n_filename, filename, 0);
15839 des_int(n_options, options, 1);
15840 xmlResetLastError();
15841 if (mem_base != xmlMemBlocks()) {
15842 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15843 xmlMemBlocks() - mem_base);
15844 test_ret++;
15845 printf(" %d", n_filename);
15846 printf(" %d", n_options);
15847 printf("\n");
15848 }
15849 }
15850 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015851 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015852
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015853 return(test_ret);
15854}
15855
15856
15857static int
15858test_xmlCurrentChar(void) {
15859 int test_ret = 0;
15860
15861 int mem_base;
15862 int ret_val;
15863 xmlParserCtxtPtr ctxt; /* the XML parser context */
15864 int n_ctxt;
15865 int * len; /* pointer to the length of the char read */
15866 int n_len;
15867
15868 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15869 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15870 mem_base = xmlMemBlocks();
15871 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15872 len = gen_int_ptr(n_len, 1);
15873
15874 ret_val = xmlCurrentChar(ctxt, len);
15875 desret_int(ret_val);
15876 call_tests++;
15877 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15878 des_int_ptr(n_len, len, 1);
15879 xmlResetLastError();
15880 if (mem_base != xmlMemBlocks()) {
15881 printf("Leak of %d blocks found in xmlCurrentChar",
15882 xmlMemBlocks() - mem_base);
15883 test_ret++;
15884 printf(" %d", n_ctxt);
15885 printf(" %d", n_len);
15886 printf("\n");
15887 }
15888 }
15889 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015890 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015891
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015892 return(test_ret);
15893}
15894
15895
15896static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015897test_xmlErrMemory(void) {
15898 int test_ret = 0;
15899
15900 int mem_base;
15901 xmlParserCtxtPtr ctxt; /* an XML parser context */
15902 int n_ctxt;
15903 char * extra; /* extra informations */
15904 int n_extra;
15905
15906 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15907 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15908 mem_base = xmlMemBlocks();
15909 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15910 extra = gen_const_char_ptr(n_extra, 1);
15911
William M. Brackf13f77f2004-11-12 16:03:48 +000015912 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015913 call_tests++;
15914 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015915 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015916 xmlResetLastError();
15917 if (mem_base != xmlMemBlocks()) {
15918 printf("Leak of %d blocks found in xmlErrMemory",
15919 xmlMemBlocks() - mem_base);
15920 test_ret++;
15921 printf(" %d", n_ctxt);
15922 printf(" %d", n_extra);
15923 printf("\n");
15924 }
15925 }
15926 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015928
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015929 return(test_ret);
15930}
15931
15932
15933static int
15934test_xmlIsLetter(void) {
15935 int test_ret = 0;
15936
15937 int mem_base;
15938 int ret_val;
15939 int c; /* an unicode character (int) */
15940 int n_c;
15941
15942 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15943 mem_base = xmlMemBlocks();
15944 c = gen_int(n_c, 0);
15945
15946 ret_val = xmlIsLetter(c);
15947 desret_int(ret_val);
15948 call_tests++;
15949 des_int(n_c, c, 0);
15950 xmlResetLastError();
15951 if (mem_base != xmlMemBlocks()) {
15952 printf("Leak of %d blocks found in xmlIsLetter",
15953 xmlMemBlocks() - mem_base);
15954 test_ret++;
15955 printf(" %d", n_c);
15956 printf("\n");
15957 }
15958 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015959 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015960
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015961 return(test_ret);
15962}
15963
15964
15965static int
15966test_xmlNewEntityInputStream(void) {
15967 int test_ret = 0;
15968
15969 int mem_base;
15970 xmlParserInputPtr ret_val;
15971 xmlParserCtxtPtr ctxt; /* an XML parser context */
15972 int n_ctxt;
15973 xmlEntityPtr entity; /* an Entity pointer */
15974 int n_entity;
15975
15976 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15977 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15978 mem_base = xmlMemBlocks();
15979 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15980 entity = gen_xmlEntityPtr(n_entity, 1);
15981
15982 ret_val = xmlNewEntityInputStream(ctxt, entity);
15983 desret_xmlParserInputPtr(ret_val);
15984 call_tests++;
15985 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15986 des_xmlEntityPtr(n_entity, entity, 1);
15987 xmlResetLastError();
15988 if (mem_base != xmlMemBlocks()) {
15989 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15990 xmlMemBlocks() - mem_base);
15991 test_ret++;
15992 printf(" %d", n_ctxt);
15993 printf(" %d", n_entity);
15994 printf("\n");
15995 }
15996 }
15997 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015998 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015999
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016000 return(test_ret);
16001}
16002
16003
16004static int
16005test_xmlNewInputFromFile(void) {
16006 int test_ret = 0;
16007
16008 int mem_base;
16009 xmlParserInputPtr ret_val;
16010 xmlParserCtxtPtr ctxt; /* an XML parser context */
16011 int n_ctxt;
16012 const char * filename; /* the filename to use as entity */
16013 int n_filename;
16014
16015 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16016 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16017 mem_base = xmlMemBlocks();
16018 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16019 filename = gen_filepath(n_filename, 1);
16020
16021 ret_val = xmlNewInputFromFile(ctxt, filename);
16022 desret_xmlParserInputPtr(ret_val);
16023 call_tests++;
16024 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16025 des_filepath(n_filename, filename, 1);
16026 xmlResetLastError();
16027 if (mem_base != xmlMemBlocks()) {
16028 printf("Leak of %d blocks found in xmlNewInputFromFile",
16029 xmlMemBlocks() - mem_base);
16030 test_ret++;
16031 printf(" %d", n_ctxt);
16032 printf(" %d", n_filename);
16033 printf("\n");
16034 }
16035 }
16036 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016037 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016038
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016039 return(test_ret);
16040}
16041
16042
16043static int
16044test_xmlNewInputStream(void) {
16045 int test_ret = 0;
16046
16047 int mem_base;
16048 xmlParserInputPtr ret_val;
16049 xmlParserCtxtPtr ctxt; /* an XML parser context */
16050 int n_ctxt;
16051
16052 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16053 mem_base = xmlMemBlocks();
16054 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16055
16056 ret_val = xmlNewInputStream(ctxt);
16057 desret_xmlParserInputPtr(ret_val);
16058 call_tests++;
16059 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16060 xmlResetLastError();
16061 if (mem_base != xmlMemBlocks()) {
16062 printf("Leak of %d blocks found in xmlNewInputStream",
16063 xmlMemBlocks() - mem_base);
16064 test_ret++;
16065 printf(" %d", n_ctxt);
16066 printf("\n");
16067 }
16068 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016069 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016070
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016071 return(test_ret);
16072}
16073
16074
16075static int
16076test_xmlNewStringInputStream(void) {
16077 int test_ret = 0;
16078
16079 int mem_base;
16080 xmlParserInputPtr ret_val;
16081 xmlParserCtxtPtr ctxt; /* an XML parser context */
16082 int n_ctxt;
16083 xmlChar * buffer; /* an memory buffer */
16084 int n_buffer;
16085
16086 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16087 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16088 mem_base = xmlMemBlocks();
16089 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16090 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16091
William M. Brackf13f77f2004-11-12 16:03:48 +000016092 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016093 desret_xmlParserInputPtr(ret_val);
16094 call_tests++;
16095 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016096 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016097 xmlResetLastError();
16098 if (mem_base != xmlMemBlocks()) {
16099 printf("Leak of %d blocks found in xmlNewStringInputStream",
16100 xmlMemBlocks() - mem_base);
16101 test_ret++;
16102 printf(" %d", n_ctxt);
16103 printf(" %d", n_buffer);
16104 printf("\n");
16105 }
16106 }
16107 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016109
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016110 return(test_ret);
16111}
16112
16113
16114static int
16115test_xmlNextChar(void) {
16116 int test_ret = 0;
16117
16118 int mem_base;
16119 xmlParserCtxtPtr ctxt; /* the XML parser context */
16120 int n_ctxt;
16121
16122 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16123 mem_base = xmlMemBlocks();
16124 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16125
16126 xmlNextChar(ctxt);
16127 call_tests++;
16128 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16129 xmlResetLastError();
16130 if (mem_base != xmlMemBlocks()) {
16131 printf("Leak of %d blocks found in xmlNextChar",
16132 xmlMemBlocks() - mem_base);
16133 test_ret++;
16134 printf(" %d", n_ctxt);
16135 printf("\n");
16136 }
16137 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016138 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016139
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016140 return(test_ret);
16141}
16142
16143
16144static int
16145test_xmlParserInputShrink(void) {
16146 int test_ret = 0;
16147
16148 int mem_base;
16149 xmlParserInputPtr in; /* an XML parser input */
16150 int n_in;
16151
16152 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16153 mem_base = xmlMemBlocks();
16154 in = gen_xmlParserInputPtr(n_in, 0);
16155
16156 xmlParserInputShrink(in);
16157 call_tests++;
16158 des_xmlParserInputPtr(n_in, in, 0);
16159 xmlResetLastError();
16160 if (mem_base != xmlMemBlocks()) {
16161 printf("Leak of %d blocks found in xmlParserInputShrink",
16162 xmlMemBlocks() - mem_base);
16163 test_ret++;
16164 printf(" %d", n_in);
16165 printf("\n");
16166 }
16167 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016168 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016169
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016170 return(test_ret);
16171}
16172
16173
16174static int
16175test_xmlPopInput(void) {
16176 int test_ret = 0;
16177
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016178 int mem_base;
16179 xmlChar ret_val;
16180 xmlParserCtxtPtr ctxt; /* an XML parser context */
16181 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016182
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016183 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16184 mem_base = xmlMemBlocks();
16185 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16186
16187 ret_val = xmlPopInput(ctxt);
16188 desret_xmlChar(ret_val);
16189 call_tests++;
16190 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16191 xmlResetLastError();
16192 if (mem_base != xmlMemBlocks()) {
16193 printf("Leak of %d blocks found in xmlPopInput",
16194 xmlMemBlocks() - mem_base);
16195 test_ret++;
16196 printf(" %d", n_ctxt);
16197 printf("\n");
16198 }
16199 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016200 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016201
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016202 return(test_ret);
16203}
16204
16205
16206static int
16207test_xmlPushInput(void) {
16208 int test_ret = 0;
16209
16210 int mem_base;
16211 xmlParserCtxtPtr ctxt; /* an XML parser context */
16212 int n_ctxt;
16213 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16214 int n_input;
16215
16216 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16217 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16218 mem_base = xmlMemBlocks();
16219 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16220 input = gen_xmlParserInputPtr(n_input, 1);
16221
16222 xmlPushInput(ctxt, input);
16223 call_tests++;
16224 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16225 des_xmlParserInputPtr(n_input, input, 1);
16226 xmlResetLastError();
16227 if (mem_base != xmlMemBlocks()) {
16228 printf("Leak of %d blocks found in xmlPushInput",
16229 xmlMemBlocks() - mem_base);
16230 test_ret++;
16231 printf(" %d", n_ctxt);
16232 printf(" %d", n_input);
16233 printf("\n");
16234 }
16235 }
16236 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016237 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016238
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016239 return(test_ret);
16240}
16241
16242
16243static int
16244test_xmlSetEntityReferenceFunc(void) {
16245 int test_ret = 0;
16246
16247
16248 /* missing type support */
16249 return(test_ret);
16250}
16251
16252
16253static int
16254test_xmlSplitQName(void) {
16255 int test_ret = 0;
16256
16257 int mem_base;
16258 xmlChar * ret_val;
16259 xmlParserCtxtPtr ctxt; /* an XML parser context */
16260 int n_ctxt;
16261 xmlChar * name; /* an XML parser context */
16262 int n_name;
16263 xmlChar ** prefix; /* a xmlChar ** */
16264 int n_prefix;
16265
16266 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16267 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16268 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16269 mem_base = xmlMemBlocks();
16270 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16271 name = gen_const_xmlChar_ptr(n_name, 1);
16272 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16273
William M. Brackf13f77f2004-11-12 16:03:48 +000016274 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016275 desret_xmlChar_ptr(ret_val);
16276 call_tests++;
16277 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016278 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016279 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16280 xmlResetLastError();
16281 if (mem_base != xmlMemBlocks()) {
16282 printf("Leak of %d blocks found in xmlSplitQName",
16283 xmlMemBlocks() - mem_base);
16284 test_ret++;
16285 printf(" %d", n_ctxt);
16286 printf(" %d", n_name);
16287 printf(" %d", n_prefix);
16288 printf("\n");
16289 }
16290 }
16291 }
16292 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016293 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016294
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016295 return(test_ret);
16296}
16297
16298
16299static int
16300test_xmlStringCurrentChar(void) {
16301 int test_ret = 0;
16302
16303 int mem_base;
16304 int ret_val;
16305 xmlParserCtxtPtr ctxt; /* the XML parser context */
16306 int n_ctxt;
16307 xmlChar * cur; /* pointer to the beginning of the char */
16308 int n_cur;
16309 int * len; /* pointer to the length of the char read */
16310 int n_len;
16311
16312 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16313 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16314 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16315 mem_base = xmlMemBlocks();
16316 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16317 cur = gen_const_xmlChar_ptr(n_cur, 1);
16318 len = gen_int_ptr(n_len, 2);
16319
William M. Brackf13f77f2004-11-12 16:03:48 +000016320 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016321 desret_int(ret_val);
16322 call_tests++;
16323 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016324 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016325 des_int_ptr(n_len, len, 2);
16326 xmlResetLastError();
16327 if (mem_base != xmlMemBlocks()) {
16328 printf("Leak of %d blocks found in xmlStringCurrentChar",
16329 xmlMemBlocks() - mem_base);
16330 test_ret++;
16331 printf(" %d", n_ctxt);
16332 printf(" %d", n_cur);
16333 printf(" %d", n_len);
16334 printf("\n");
16335 }
16336 }
16337 }
16338 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016340
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016341 return(test_ret);
16342}
16343
16344
16345static int
16346test_xmlStringDecodeEntities(void) {
16347 int test_ret = 0;
16348
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016349 int mem_base;
16350 xmlChar * ret_val;
16351 xmlParserCtxtPtr ctxt; /* the parser context */
16352 int n_ctxt;
16353 xmlChar * str; /* the input string */
16354 int n_str;
16355 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16356 int n_what;
16357 xmlChar end; /* an end marker xmlChar, 0 if none */
16358 int n_end;
16359 xmlChar end2; /* an end marker xmlChar, 0 if none */
16360 int n_end2;
16361 xmlChar end3; /* an end marker xmlChar, 0 if none */
16362 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016363
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016364 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16365 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16366 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16367 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16368 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16369 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16370 mem_base = xmlMemBlocks();
16371 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16372 str = gen_const_xmlChar_ptr(n_str, 1);
16373 what = gen_int(n_what, 2);
16374 end = gen_xmlChar(n_end, 3);
16375 end2 = gen_xmlChar(n_end2, 4);
16376 end3 = gen_xmlChar(n_end3, 5);
16377
William M. Brackf13f77f2004-11-12 16:03:48 +000016378 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016379 desret_xmlChar_ptr(ret_val);
16380 call_tests++;
16381 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016382 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016383 des_int(n_what, what, 2);
16384 des_xmlChar(n_end, end, 3);
16385 des_xmlChar(n_end2, end2, 4);
16386 des_xmlChar(n_end3, end3, 5);
16387 xmlResetLastError();
16388 if (mem_base != xmlMemBlocks()) {
16389 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16390 xmlMemBlocks() - mem_base);
16391 test_ret++;
16392 printf(" %d", n_ctxt);
16393 printf(" %d", n_str);
16394 printf(" %d", n_what);
16395 printf(" %d", n_end);
16396 printf(" %d", n_end2);
16397 printf(" %d", n_end3);
16398 printf("\n");
16399 }
16400 }
16401 }
16402 }
16403 }
16404 }
16405 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016407
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016408 return(test_ret);
16409}
16410
16411
16412static int
16413test_xmlStringLenDecodeEntities(void) {
16414 int test_ret = 0;
16415
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016416 int mem_base;
16417 xmlChar * ret_val;
16418 xmlParserCtxtPtr ctxt; /* the parser context */
16419 int n_ctxt;
16420 xmlChar * str; /* the input string */
16421 int n_str;
16422 int len; /* the string length */
16423 int n_len;
16424 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16425 int n_what;
16426 xmlChar end; /* an end marker xmlChar, 0 if none */
16427 int n_end;
16428 xmlChar end2; /* an end marker xmlChar, 0 if none */
16429 int n_end2;
16430 xmlChar end3; /* an end marker xmlChar, 0 if none */
16431 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016432
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016433 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16434 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16435 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16436 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16437 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16438 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16439 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16440 mem_base = xmlMemBlocks();
16441 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16442 str = gen_const_xmlChar_ptr(n_str, 1);
16443 len = gen_int(n_len, 2);
16444 what = gen_int(n_what, 3);
16445 end = gen_xmlChar(n_end, 4);
16446 end2 = gen_xmlChar(n_end2, 5);
16447 end3 = gen_xmlChar(n_end3, 6);
16448
William M. Brackf13f77f2004-11-12 16:03:48 +000016449 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016450 desret_xmlChar_ptr(ret_val);
16451 call_tests++;
16452 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016453 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016454 des_int(n_len, len, 2);
16455 des_int(n_what, what, 3);
16456 des_xmlChar(n_end, end, 4);
16457 des_xmlChar(n_end2, end2, 5);
16458 des_xmlChar(n_end3, end3, 6);
16459 xmlResetLastError();
16460 if (mem_base != xmlMemBlocks()) {
16461 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16462 xmlMemBlocks() - mem_base);
16463 test_ret++;
16464 printf(" %d", n_ctxt);
16465 printf(" %d", n_str);
16466 printf(" %d", n_len);
16467 printf(" %d", n_what);
16468 printf(" %d", n_end);
16469 printf(" %d", n_end2);
16470 printf(" %d", n_end3);
16471 printf("\n");
16472 }
16473 }
16474 }
16475 }
16476 }
16477 }
16478 }
16479 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016481
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016482 return(test_ret);
16483}
16484
16485
16486static int
16487test_xmlSwitchEncoding(void) {
16488 int test_ret = 0;
16489
16490 int mem_base;
16491 int ret_val;
16492 xmlParserCtxtPtr ctxt; /* the parser context */
16493 int n_ctxt;
16494 xmlCharEncoding enc; /* the encoding value (number) */
16495 int n_enc;
16496
16497 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16498 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16499 mem_base = xmlMemBlocks();
16500 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16501 enc = gen_xmlCharEncoding(n_enc, 1);
16502
16503 ret_val = xmlSwitchEncoding(ctxt, enc);
16504 desret_int(ret_val);
16505 call_tests++;
16506 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16507 des_xmlCharEncoding(n_enc, enc, 1);
16508 xmlResetLastError();
16509 if (mem_base != xmlMemBlocks()) {
16510 printf("Leak of %d blocks found in xmlSwitchEncoding",
16511 xmlMemBlocks() - mem_base);
16512 test_ret++;
16513 printf(" %d", n_ctxt);
16514 printf(" %d", n_enc);
16515 printf("\n");
16516 }
16517 }
16518 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016520
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016521 return(test_ret);
16522}
16523
16524
16525static int
16526test_xmlSwitchInputEncoding(void) {
16527 int test_ret = 0;
16528
16529 int mem_base;
16530 int ret_val;
16531 xmlParserCtxtPtr ctxt; /* the parser context */
16532 int n_ctxt;
16533 xmlParserInputPtr input; /* the input stream */
16534 int n_input;
16535 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16536 int n_handler;
16537
16538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16539 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16540 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16541 mem_base = xmlMemBlocks();
16542 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16543 input = gen_xmlParserInputPtr(n_input, 1);
16544 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16545
16546 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16547 desret_int(ret_val);
16548 call_tests++;
16549 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16550 des_xmlParserInputPtr(n_input, input, 1);
16551 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16552 xmlResetLastError();
16553 if (mem_base != xmlMemBlocks()) {
16554 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16555 xmlMemBlocks() - mem_base);
16556 test_ret++;
16557 printf(" %d", n_ctxt);
16558 printf(" %d", n_input);
16559 printf(" %d", n_handler);
16560 printf("\n");
16561 }
16562 }
16563 }
16564 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016565 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016566
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016567 return(test_ret);
16568}
16569
16570
16571static int
16572test_xmlSwitchToEncoding(void) {
16573 int test_ret = 0;
16574
16575 int mem_base;
16576 int ret_val;
16577 xmlParserCtxtPtr ctxt; /* the parser context */
16578 int n_ctxt;
16579 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16580 int n_handler;
16581
16582 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16583 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16584 mem_base = xmlMemBlocks();
16585 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16586 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16587
16588 ret_val = xmlSwitchToEncoding(ctxt, handler);
16589 desret_int(ret_val);
16590 call_tests++;
16591 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16592 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16593 xmlResetLastError();
16594 if (mem_base != xmlMemBlocks()) {
16595 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16596 xmlMemBlocks() - mem_base);
16597 test_ret++;
16598 printf(" %d", n_ctxt);
16599 printf(" %d", n_handler);
16600 printf("\n");
16601 }
16602 }
16603 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016604 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016605
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016606 return(test_ret);
16607}
16608
16609static int
16610test_parserInternals(void) {
16611 int test_ret = 0;
16612
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016613 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016614 test_ret += test_htmlCreateFileParserCtxt();
16615 test_ret += test_htmlInitAutoClose();
16616 test_ret += test_inputPop();
16617 test_ret += test_inputPush();
16618 test_ret += test_namePop();
16619 test_ret += test_namePush();
16620 test_ret += test_nodePop();
16621 test_ret += test_nodePush();
16622 test_ret += test_xmlCheckLanguageID();
16623 test_ret += test_xmlCopyChar();
16624 test_ret += test_xmlCopyCharMultiByte();
16625 test_ret += test_xmlCreateEntityParserCtxt();
16626 test_ret += test_xmlCreateFileParserCtxt();
16627 test_ret += test_xmlCreateMemoryParserCtxt();
16628 test_ret += test_xmlCreateURLParserCtxt();
16629 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016630 test_ret += test_xmlErrMemory();
16631 test_ret += test_xmlIsLetter();
16632 test_ret += test_xmlNewEntityInputStream();
16633 test_ret += test_xmlNewInputFromFile();
16634 test_ret += test_xmlNewInputStream();
16635 test_ret += test_xmlNewStringInputStream();
16636 test_ret += test_xmlNextChar();
16637 test_ret += test_xmlParserInputShrink();
16638 test_ret += test_xmlPopInput();
16639 test_ret += test_xmlPushInput();
16640 test_ret += test_xmlSetEntityReferenceFunc();
16641 test_ret += test_xmlSplitQName();
16642 test_ret += test_xmlStringCurrentChar();
16643 test_ret += test_xmlStringDecodeEntities();
16644 test_ret += test_xmlStringLenDecodeEntities();
16645 test_ret += test_xmlSwitchEncoding();
16646 test_ret += test_xmlSwitchInputEncoding();
16647 test_ret += test_xmlSwitchToEncoding();
16648
16649 if (test_ret != 0)
16650 printf("Module parserInternals: %d errors\n", test_ret);
16651 return(test_ret);
16652}
16653
Daniel Veillardd93f6252004-11-02 15:53:51 +000016654static int
16655test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016657
Daniel Veillardce682bc2004-11-05 17:22:25 +000016658#ifdef LIBXML_PATTERN_ENABLED
16659 int mem_base;
16660 int ret_val;
16661 xmlPatternPtr comp; /* the precompiled pattern */
16662 int n_comp;
16663 xmlNodePtr node; /* a node */
16664 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016665
Daniel Veillardce682bc2004-11-05 17:22:25 +000016666 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16667 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16668 mem_base = xmlMemBlocks();
16669 comp = gen_xmlPatternPtr(n_comp, 0);
16670 node = gen_xmlNodePtr(n_node, 1);
16671
16672 ret_val = xmlPatternMatch(comp, node);
16673 desret_int(ret_val);
16674 call_tests++;
16675 des_xmlPatternPtr(n_comp, comp, 0);
16676 des_xmlNodePtr(n_node, node, 1);
16677 xmlResetLastError();
16678 if (mem_base != xmlMemBlocks()) {
16679 printf("Leak of %d blocks found in xmlPatternMatch",
16680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016681 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016682 printf(" %d", n_comp);
16683 printf(" %d", n_node);
16684 printf("\n");
16685 }
16686 }
16687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016688 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016689#endif
16690
Daniel Veillard42595322004-11-08 10:52:06 +000016691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016692}
16693
16694
16695static int
16696test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016698
16699
16700 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016702}
16703
16704static int
16705test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016707
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016708 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016709 test_ret += test_xmlPatternMatch();
16710 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016711
Daniel Veillard42595322004-11-08 10:52:06 +000016712 if (test_ret != 0)
16713 printf("Module pattern: %d errors\n", test_ret);
16714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016715}
Daniel Veillarda521d282004-11-09 14:59:59 +000016716#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016717
Daniel Veillardce682bc2004-11-05 17:22:25 +000016718#define gen_nb_xmlRelaxNGPtr 1
16719static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16720 return(NULL);
16721}
16722static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16723}
Daniel Veillarda521d282004-11-09 14:59:59 +000016724#endif
16725
Daniel Veillardce682bc2004-11-05 17:22:25 +000016726
Daniel Veillardd93f6252004-11-02 15:53:51 +000016727static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016728test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016730
Daniel Veillardce682bc2004-11-05 17:22:25 +000016731#ifdef LIBXML_SCHEMAS_ENABLED
16732#ifdef LIBXML_OUTPUT_ENABLED
16733 int mem_base;
16734 FILE * output; /* the file output */
16735 int n_output;
16736 xmlRelaxNGPtr schema; /* a schema structure */
16737 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016738
Daniel Veillardce682bc2004-11-05 17:22:25 +000016739 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16740 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16741 mem_base = xmlMemBlocks();
16742 output = gen_FILE_ptr(n_output, 0);
16743 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16744
16745 xmlRelaxNGDump(output, schema);
16746 call_tests++;
16747 des_FILE_ptr(n_output, output, 0);
16748 des_xmlRelaxNGPtr(n_schema, schema, 1);
16749 xmlResetLastError();
16750 if (mem_base != xmlMemBlocks()) {
16751 printf("Leak of %d blocks found in xmlRelaxNGDump",
16752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016753 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016754 printf(" %d", n_output);
16755 printf(" %d", n_schema);
16756 printf("\n");
16757 }
16758 }
16759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016760 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016761#endif
16762#endif
16763
Daniel Veillard42595322004-11-08 10:52:06 +000016764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016765}
16766
16767
16768static int
16769test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016771
Daniel Veillardce682bc2004-11-05 17:22:25 +000016772#ifdef LIBXML_SCHEMAS_ENABLED
16773#ifdef LIBXML_OUTPUT_ENABLED
16774 int mem_base;
16775 FILE * output; /* the file output */
16776 int n_output;
16777 xmlRelaxNGPtr schema; /* a schema structure */
16778 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016779
Daniel Veillardce682bc2004-11-05 17:22:25 +000016780 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16781 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16782 mem_base = xmlMemBlocks();
16783 output = gen_FILE_ptr(n_output, 0);
16784 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16785
16786 xmlRelaxNGDumpTree(output, schema);
16787 call_tests++;
16788 des_FILE_ptr(n_output, output, 0);
16789 des_xmlRelaxNGPtr(n_schema, schema, 1);
16790 xmlResetLastError();
16791 if (mem_base != xmlMemBlocks()) {
16792 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016794 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016795 printf(" %d", n_output);
16796 printf(" %d", n_schema);
16797 printf("\n");
16798 }
16799 }
16800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016801 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016802#endif
16803#endif
16804
Daniel Veillard42595322004-11-08 10:52:06 +000016805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016806}
16807
Daniel Veillarda521d282004-11-09 14:59:59 +000016808#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016809
Daniel Veillardce682bc2004-11-05 17:22:25 +000016810#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16811static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16812 return(NULL);
16813}
16814static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16815}
Daniel Veillarda521d282004-11-09 14:59:59 +000016816#endif
16817
16818#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016819
16820#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16821static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16822 return(NULL);
16823}
16824static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16825}
Daniel Veillarda521d282004-11-09 14:59:59 +000016826#endif
16827
16828#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016829
16830#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16831static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16832 return(NULL);
16833}
16834static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16835}
Daniel Veillarda521d282004-11-09 14:59:59 +000016836#endif
16837
16838#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016839
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016840#define gen_nb_void_ptr_ptr 1
16841static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16842 return(NULL);
16843}
16844static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16845}
Daniel Veillarda521d282004-11-09 14:59:59 +000016846#endif
16847
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016848
Daniel Veillardd93f6252004-11-02 15:53:51 +000016849static int
16850test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016852
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016853#ifdef LIBXML_SCHEMAS_ENABLED
16854 int mem_base;
16855 int ret_val;
16856 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16857 int n_ctxt;
16858 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16859 int n_err;
16860 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16861 int n_warn;
16862 void ** ctx; /* contextual data for the callbacks result */
16863 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016864
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016865 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16866 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16867 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16868 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16869 mem_base = xmlMemBlocks();
16870 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16871 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16872 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16873 ctx = gen_void_ptr_ptr(n_ctx, 3);
16874
16875 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16876 desret_int(ret_val);
16877 call_tests++;
16878 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16879 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16880 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16881 des_void_ptr_ptr(n_ctx, ctx, 3);
16882 xmlResetLastError();
16883 if (mem_base != xmlMemBlocks()) {
16884 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016886 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016887 printf(" %d", n_ctxt);
16888 printf(" %d", n_err);
16889 printf(" %d", n_warn);
16890 printf(" %d", n_ctx);
16891 printf("\n");
16892 }
16893 }
16894 }
16895 }
16896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016897 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016898#endif
16899
Daniel Veillard42595322004-11-08 10:52:06 +000016900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016901}
16902
Daniel Veillarda521d282004-11-09 14:59:59 +000016903#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016904
Daniel Veillardce682bc2004-11-05 17:22:25 +000016905#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16906static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16907 return(NULL);
16908}
16909static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16910}
Daniel Veillarda521d282004-11-09 14:59:59 +000016911#endif
16912
Daniel Veillardce682bc2004-11-05 17:22:25 +000016913
Daniel Veillardd93f6252004-11-02 15:53:51 +000016914static int
16915test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016917
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016918#ifdef LIBXML_SCHEMAS_ENABLED
16919 int mem_base;
16920 int ret_val;
16921 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16922 int n_ctxt;
16923 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16924 int n_err;
16925 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16926 int n_warn;
16927 void ** ctx; /* the functions context result */
16928 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016929
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016930 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16931 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16932 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16933 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16934 mem_base = xmlMemBlocks();
16935 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16936 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16937 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16938 ctx = gen_void_ptr_ptr(n_ctx, 3);
16939
16940 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16941 desret_int(ret_val);
16942 call_tests++;
16943 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16944 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16945 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16946 des_void_ptr_ptr(n_ctx, ctx, 3);
16947 xmlResetLastError();
16948 if (mem_base != xmlMemBlocks()) {
16949 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016951 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016952 printf(" %d", n_ctxt);
16953 printf(" %d", n_err);
16954 printf(" %d", n_warn);
16955 printf(" %d", n_ctx);
16956 printf("\n");
16957 }
16958 }
16959 }
16960 }
16961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016962 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016963#endif
16964
Daniel Veillard42595322004-11-08 10:52:06 +000016965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016966}
16967
16968
16969static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016970test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016971 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016972
16973#ifdef LIBXML_SCHEMAS_ENABLED
16974 int mem_base;
16975 int ret_val;
16976
16977 mem_base = xmlMemBlocks();
16978
16979 ret_val = xmlRelaxNGInitTypes();
16980 desret_int(ret_val);
16981 call_tests++;
16982 xmlResetLastError();
16983 if (mem_base != xmlMemBlocks()) {
16984 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016986 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016987 printf("\n");
16988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016989 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016990#endif
16991
Daniel Veillard42595322004-11-08 10:52:06 +000016992 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016993}
16994
16995
16996static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016997test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016999
Daniel Veillard42595322004-11-08 10:52:06 +000017000#ifdef LIBXML_SCHEMAS_ENABLED
17001 int mem_base;
17002 xmlRelaxNGParserCtxtPtr ret_val;
17003 xmlDocPtr doc; /* a preparsed document tree */
17004 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017005
Daniel Veillard42595322004-11-08 10:52:06 +000017006 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17007 mem_base = xmlMemBlocks();
17008 doc = gen_xmlDocPtr(n_doc, 0);
17009
17010 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17011 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17012 call_tests++;
17013 des_xmlDocPtr(n_doc, doc, 0);
17014 xmlResetLastError();
17015 if (mem_base != xmlMemBlocks()) {
17016 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17017 xmlMemBlocks() - mem_base);
17018 test_ret++;
17019 printf(" %d", n_doc);
17020 printf("\n");
17021 }
17022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017023 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017024#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_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017033
Daniel Veillard42595322004-11-08 10:52:06 +000017034#ifdef LIBXML_SCHEMAS_ENABLED
17035 int mem_base;
17036 xmlRelaxNGParserCtxtPtr ret_val;
17037 char * buffer; /* a pointer to a char array containing the schemas */
17038 int n_buffer;
17039 int size; /* the size of the array */
17040 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017041
Daniel Veillard42595322004-11-08 10:52:06 +000017042 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17043 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17044 mem_base = xmlMemBlocks();
17045 buffer = gen_const_char_ptr(n_buffer, 0);
17046 size = gen_int(n_size, 1);
17047
William M. Brackf13f77f2004-11-12 16:03:48 +000017048 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017049 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17050 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017051 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017052 des_int(n_size, size, 1);
17053 xmlResetLastError();
17054 if (mem_base != xmlMemBlocks()) {
17055 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17056 xmlMemBlocks() - mem_base);
17057 test_ret++;
17058 printf(" %d", n_buffer);
17059 printf(" %d", n_size);
17060 printf("\n");
17061 }
17062 }
17063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017064 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017065#endif
17066
Daniel Veillard42595322004-11-08 10:52:06 +000017067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017068}
17069
17070
17071static int
17072test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017074
Daniel Veillard42595322004-11-08 10:52:06 +000017075#ifdef LIBXML_SCHEMAS_ENABLED
17076 int mem_base;
17077 xmlRelaxNGParserCtxtPtr ret_val;
17078 char * URL; /* the location of the schema */
17079 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017080
Daniel Veillard42595322004-11-08 10:52:06 +000017081 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17082 mem_base = xmlMemBlocks();
17083 URL = gen_const_char_ptr(n_URL, 0);
17084
William M. Brackf13f77f2004-11-12 16:03:48 +000017085 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017086 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17087 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017088 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017089 xmlResetLastError();
17090 if (mem_base != xmlMemBlocks()) {
17091 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17092 xmlMemBlocks() - mem_base);
17093 test_ret++;
17094 printf(" %d", n_URL);
17095 printf("\n");
17096 }
17097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017098 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017099#endif
17100
Daniel Veillard42595322004-11-08 10:52:06 +000017101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017102}
17103
17104
17105static int
17106test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017108
17109
17110 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017112}
17113
17114
17115static int
17116test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017118
17119
17120 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017122}
17123
17124
17125static int
17126test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017128
17129
17130 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017132}
17133
17134
17135static int
17136test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017138
17139
17140 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017142}
17143
17144
17145static int
17146test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017148
Daniel Veillardce682bc2004-11-05 17:22:25 +000017149#ifdef LIBXML_SCHEMAS_ENABLED
17150 int mem_base;
17151 int ret_val;
17152 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17153 int n_ctxt;
17154 xmlDocPtr doc; /* a parsed document tree */
17155 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017156
Daniel Veillardce682bc2004-11-05 17:22:25 +000017157 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17158 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17159 mem_base = xmlMemBlocks();
17160 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17161 doc = gen_xmlDocPtr(n_doc, 1);
17162
17163 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17164 desret_int(ret_val);
17165 call_tests++;
17166 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17167 des_xmlDocPtr(n_doc, doc, 1);
17168 xmlResetLastError();
17169 if (mem_base != xmlMemBlocks()) {
17170 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017173 printf(" %d", n_ctxt);
17174 printf(" %d", n_doc);
17175 printf("\n");
17176 }
17177 }
17178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017179 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017180#endif
17181
Daniel Veillard42595322004-11-08 10:52:06 +000017182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017183}
17184
17185
17186static int
17187test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017189
Daniel Veillardce682bc2004-11-05 17:22:25 +000017190#ifdef LIBXML_SCHEMAS_ENABLED
17191 int mem_base;
17192 int ret_val;
17193 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17194 int n_ctxt;
17195 xmlDocPtr doc; /* a document instance */
17196 int n_doc;
17197 xmlNodePtr elem; /* an element instance */
17198 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017199
Daniel Veillardce682bc2004-11-05 17:22:25 +000017200 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17201 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17202 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17203 mem_base = xmlMemBlocks();
17204 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17205 doc = gen_xmlDocPtr(n_doc, 1);
17206 elem = gen_xmlNodePtr(n_elem, 2);
17207
17208 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17209 desret_int(ret_val);
17210 call_tests++;
17211 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17212 des_xmlDocPtr(n_doc, doc, 1);
17213 des_xmlNodePtr(n_elem, elem, 2);
17214 xmlResetLastError();
17215 if (mem_base != xmlMemBlocks()) {
17216 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017218 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017219 printf(" %d", n_ctxt);
17220 printf(" %d", n_doc);
17221 printf(" %d", n_elem);
17222 printf("\n");
17223 }
17224 }
17225 }
17226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017227 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017228#endif
17229
Daniel Veillard42595322004-11-08 10:52:06 +000017230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017231}
17232
17233
17234static int
17235test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017237
Daniel Veillardce682bc2004-11-05 17:22:25 +000017238#ifdef LIBXML_SCHEMAS_ENABLED
17239 int mem_base;
17240 int ret_val;
17241 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17242 int n_ctxt;
17243 xmlDocPtr doc; /* a document instance */
17244 int n_doc;
17245 xmlNodePtr elem; /* an element instance */
17246 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017247
Daniel Veillardce682bc2004-11-05 17:22:25 +000017248 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17249 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17250 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17251 mem_base = xmlMemBlocks();
17252 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17253 doc = gen_xmlDocPtr(n_doc, 1);
17254 elem = gen_xmlNodePtr(n_elem, 2);
17255
17256 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17257 desret_int(ret_val);
17258 call_tests++;
17259 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17260 des_xmlDocPtr(n_doc, doc, 1);
17261 des_xmlNodePtr(n_elem, elem, 2);
17262 xmlResetLastError();
17263 if (mem_base != xmlMemBlocks()) {
17264 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017266 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017267 printf(" %d", n_ctxt);
17268 printf(" %d", n_doc);
17269 printf(" %d", n_elem);
17270 printf("\n");
17271 }
17272 }
17273 }
17274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017275 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017276#endif
17277
Daniel Veillard42595322004-11-08 10:52:06 +000017278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017279}
17280
17281
17282static int
17283test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017285
Daniel Veillardce682bc2004-11-05 17:22:25 +000017286#ifdef LIBXML_SCHEMAS_ENABLED
17287 int mem_base;
17288 int ret_val;
17289 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17290 int n_ctxt;
17291 xmlChar * data; /* some character data read */
17292 int n_data;
17293 int len; /* the lenght of the data */
17294 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017295
Daniel Veillardce682bc2004-11-05 17:22:25 +000017296 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17297 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17298 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17299 mem_base = xmlMemBlocks();
17300 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17301 data = gen_const_xmlChar_ptr(n_data, 1);
17302 len = gen_int(n_len, 2);
17303
William M. Brackf13f77f2004-11-12 16:03:48 +000017304 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017305 desret_int(ret_val);
17306 call_tests++;
17307 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017308 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017309 des_int(n_len, len, 2);
17310 xmlResetLastError();
17311 if (mem_base != xmlMemBlocks()) {
17312 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017314 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017315 printf(" %d", n_ctxt);
17316 printf(" %d", n_data);
17317 printf(" %d", n_len);
17318 printf("\n");
17319 }
17320 }
17321 }
17322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017323 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017324#endif
17325
Daniel Veillard42595322004-11-08 10:52:06 +000017326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017327}
17328
17329
17330static int
17331test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017333
Daniel Veillardce682bc2004-11-05 17:22:25 +000017334#ifdef LIBXML_SCHEMAS_ENABLED
17335 int mem_base;
17336 int ret_val;
17337 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17338 int n_ctxt;
17339 xmlDocPtr doc; /* a document instance */
17340 int n_doc;
17341 xmlNodePtr elem; /* an element instance */
17342 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017343
Daniel Veillardce682bc2004-11-05 17:22:25 +000017344 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17345 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17346 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17347 mem_base = xmlMemBlocks();
17348 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17349 doc = gen_xmlDocPtr(n_doc, 1);
17350 elem = gen_xmlNodePtr(n_elem, 2);
17351
17352 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17353 desret_int(ret_val);
17354 call_tests++;
17355 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17356 des_xmlDocPtr(n_doc, doc, 1);
17357 des_xmlNodePtr(n_elem, elem, 2);
17358 xmlResetLastError();
17359 if (mem_base != xmlMemBlocks()) {
17360 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017362 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017363 printf(" %d", n_ctxt);
17364 printf(" %d", n_doc);
17365 printf(" %d", n_elem);
17366 printf("\n");
17367 }
17368 }
17369 }
17370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017371 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017372#endif
17373
Daniel Veillard42595322004-11-08 10:52:06 +000017374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017375}
17376
17377
17378static int
17379test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017381
Daniel Veillardce682bc2004-11-05 17:22:25 +000017382#ifdef LIBXML_SCHEMAS_ENABLED
17383 int mem_base;
17384 int ret_val;
17385 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17386 int n_ctxt;
17387 int flags; /* a set of flags values */
17388 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017389
Daniel Veillardce682bc2004-11-05 17:22:25 +000017390 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17391 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17392 mem_base = xmlMemBlocks();
17393 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17394 flags = gen_int(n_flags, 1);
17395
17396 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17397 desret_int(ret_val);
17398 call_tests++;
17399 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17400 des_int(n_flags, flags, 1);
17401 xmlResetLastError();
17402 if (mem_base != xmlMemBlocks()) {
17403 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017405 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017406 printf(" %d", n_ctxt);
17407 printf(" %d", n_flags);
17408 printf("\n");
17409 }
17410 }
17411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017412 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017413#endif
17414
Daniel Veillard42595322004-11-08 10:52:06 +000017415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017416}
17417
17418static int
17419test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017421
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017422 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017423 test_ret += test_xmlRelaxNGDump();
17424 test_ret += test_xmlRelaxNGDumpTree();
17425 test_ret += test_xmlRelaxNGGetParserErrors();
17426 test_ret += test_xmlRelaxNGGetValidErrors();
17427 test_ret += test_xmlRelaxNGInitTypes();
17428 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17429 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17430 test_ret += test_xmlRelaxNGNewParserCtxt();
17431 test_ret += test_xmlRelaxNGNewValidCtxt();
17432 test_ret += test_xmlRelaxNGParse();
17433 test_ret += test_xmlRelaxNGSetParserErrors();
17434 test_ret += test_xmlRelaxNGSetValidErrors();
17435 test_ret += test_xmlRelaxNGValidateDoc();
17436 test_ret += test_xmlRelaxNGValidateFullElement();
17437 test_ret += test_xmlRelaxNGValidatePopElement();
17438 test_ret += test_xmlRelaxNGValidatePushCData();
17439 test_ret += test_xmlRelaxNGValidatePushElement();
17440 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017441
Daniel Veillard42595322004-11-08 10:52:06 +000017442 if (test_ret != 0)
17443 printf("Module relaxng: %d errors\n", test_ret);
17444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017445}
17446static int
17447test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017449
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017450 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017451
Daniel Veillard42595322004-11-08 10:52:06 +000017452 if (test_ret != 0)
17453 printf("Module schemasInternals: %d errors\n", test_ret);
17454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017455}
17456
17457static int
17458test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017460
17461 int mem_base;
17462 xmlNodePtr ret_val;
17463 xmlNodePtr parent; /* the parent node */
17464 int n_parent;
17465 xmlNodePtr cur; /* the child node */
17466 int n_cur;
17467
Daniel Veillarda03e3652004-11-02 18:45:30 +000017468 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017469 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017471 parent = gen_xmlNodePtr(n_parent, 0);
17472 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017473
17474 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017475 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017476 desret_xmlNodePtr(ret_val);
17477 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017478 des_xmlNodePtr(n_parent, parent, 0);
17479 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017480 xmlResetLastError();
17481 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017482 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017484 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017485 printf(" %d", n_parent);
17486 printf(" %d", n_cur);
17487 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017488 }
17489 }
17490 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017491 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017492
Daniel Veillard42595322004-11-08 10:52:06 +000017493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017494}
17495
17496
17497static int
17498test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017500
17501 int mem_base;
17502 xmlNodePtr ret_val;
17503 xmlNodePtr parent; /* the parent node */
17504 int n_parent;
17505 xmlNodePtr cur; /* the first node in the list */
17506 int n_cur;
17507
Daniel Veillarda03e3652004-11-02 18:45:30 +000017508 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017509 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17510 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017511 parent = gen_xmlNodePtr(n_parent, 0);
17512 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017513
17514 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017515 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017516 desret_xmlNodePtr(ret_val);
17517 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017518 des_xmlNodePtr(n_parent, parent, 0);
17519 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017520 xmlResetLastError();
17521 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017522 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017524 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017525 printf(" %d", n_parent);
17526 printf(" %d", n_cur);
17527 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017528 }
17529 }
17530 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017531 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017532
Daniel Veillard42595322004-11-08 10:52:06 +000017533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017534}
17535
17536
17537static int
17538test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017540
17541 int mem_base;
17542 xmlNodePtr ret_val;
17543 xmlNodePtr cur; /* the child node */
17544 int n_cur;
17545 xmlNodePtr elem; /* the new node */
17546 int n_elem;
17547
17548 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017549 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017550 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017551 cur = gen_xmlNodePtr(n_cur, 0);
17552 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017553
17554 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017555 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017556 desret_xmlNodePtr(ret_val);
17557 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017558 des_xmlNodePtr(n_cur, cur, 0);
17559 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017560 xmlResetLastError();
17561 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017562 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017564 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017565 printf(" %d", n_cur);
17566 printf(" %d", n_elem);
17567 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017568 }
17569 }
17570 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017571 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017572
Daniel Veillard42595322004-11-08 10:52:06 +000017573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017574}
17575
17576
17577static int
17578test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017580
17581#ifdef LIBXML_TREE_ENABLED
17582 int mem_base;
17583 xmlNodePtr ret_val;
17584 xmlNodePtr cur; /* the child node */
17585 int n_cur;
17586 xmlNodePtr elem; /* the new node */
17587 int n_elem;
17588
17589 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017590 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017591 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017592 cur = gen_xmlNodePtr(n_cur, 0);
17593 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017594
17595 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017596 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017597 desret_xmlNodePtr(ret_val);
17598 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017599 des_xmlNodePtr(n_cur, cur, 0);
17600 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017601 xmlResetLastError();
17602 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017603 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017605 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017606 printf(" %d", n_cur);
17607 printf(" %d", n_elem);
17608 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017609 }
17610 }
17611 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017612 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017613#endif
17614
Daniel Veillard42595322004-11-08 10:52:06 +000017615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017616}
17617
17618
17619static int
17620test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017622
17623 int mem_base;
17624 xmlNodePtr ret_val;
17625 xmlNodePtr cur; /* the child node */
17626 int n_cur;
17627 xmlNodePtr elem; /* the new node */
17628 int n_elem;
17629
17630 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017631 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017632 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017633 cur = gen_xmlNodePtr(n_cur, 0);
17634 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017635
17636 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017637 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017638 desret_xmlNodePtr(ret_val);
17639 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017640 des_xmlNodePtr(n_cur, cur, 0);
17641 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017642 xmlResetLastError();
17643 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017644 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017646 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017647 printf(" %d", n_cur);
17648 printf(" %d", n_elem);
17649 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017650 }
17651 }
17652 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017653 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017654
Daniel Veillard42595322004-11-08 10:52:06 +000017655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017656}
17657
17658
17659static int
17660test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017662
Daniel Veillarda521d282004-11-09 14:59:59 +000017663#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017664 int mem_base;
17665 xmlBufferPtr buf; /* the XML buffer output */
17666 int n_buf;
17667 xmlDocPtr doc; /* the document */
17668 int n_doc;
17669 xmlAttrPtr attr; /* the attribute node */
17670 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017671 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017672 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017673
Daniel Veillardce244ad2004-11-05 10:03:46 +000017674 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17675 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17676 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17677 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17678 mem_base = xmlMemBlocks();
17679 buf = gen_xmlBufferPtr(n_buf, 0);
17680 doc = gen_xmlDocPtr(n_doc, 1);
17681 attr = gen_xmlAttrPtr(n_attr, 2);
17682 string = gen_const_xmlChar_ptr(n_string, 3);
17683
William M. Brackf13f77f2004-11-12 16:03:48 +000017684 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017685 call_tests++;
17686 des_xmlBufferPtr(n_buf, buf, 0);
17687 des_xmlDocPtr(n_doc, doc, 1);
17688 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017689 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017690 xmlResetLastError();
17691 if (mem_base != xmlMemBlocks()) {
17692 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017694 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017695 printf(" %d", n_buf);
17696 printf(" %d", n_doc);
17697 printf(" %d", n_attr);
17698 printf(" %d", n_string);
17699 printf("\n");
17700 }
17701 }
17702 }
17703 }
17704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017705 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017706#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017707
Daniel Veillard42595322004-11-08 10:52:06 +000017708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017709}
17710
17711
17712static int
17713test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017715
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017716 int mem_base;
17717 int ret_val;
17718 xmlBufferPtr buf; /* the buffer to dump */
17719 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017720 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017721 int n_str;
17722 int len; /* the number of #xmlChar to add */
17723 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017724
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017725 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17726 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17727 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017729 buf = gen_xmlBufferPtr(n_buf, 0);
17730 str = gen_const_xmlChar_ptr(n_str, 1);
17731 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017732
William M. Brackf13f77f2004-11-12 16:03:48 +000017733 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017734 desret_int(ret_val);
17735 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017736 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017737 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017738 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017739 xmlResetLastError();
17740 if (mem_base != xmlMemBlocks()) {
17741 printf("Leak of %d blocks found in xmlBufferAdd",
17742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017743 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017744 printf(" %d", n_buf);
17745 printf(" %d", n_str);
17746 printf(" %d", n_len);
17747 printf("\n");
17748 }
17749 }
17750 }
17751 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017752 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017753
Daniel Veillard42595322004-11-08 10:52:06 +000017754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017755}
17756
17757
17758static int
17759test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017761
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017762 int mem_base;
17763 int ret_val;
17764 xmlBufferPtr buf; /* the buffer */
17765 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017766 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017767 int n_str;
17768 int len; /* the number of #xmlChar to add */
17769 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017770
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017771 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17772 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17773 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017775 buf = gen_xmlBufferPtr(n_buf, 0);
17776 str = gen_const_xmlChar_ptr(n_str, 1);
17777 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017778
William M. Brackf13f77f2004-11-12 16:03:48 +000017779 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017780 desret_int(ret_val);
17781 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017782 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017783 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017784 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017785 xmlResetLastError();
17786 if (mem_base != xmlMemBlocks()) {
17787 printf("Leak of %d blocks found in xmlBufferAddHead",
17788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017789 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017790 printf(" %d", n_buf);
17791 printf(" %d", n_str);
17792 printf(" %d", n_len);
17793 printf("\n");
17794 }
17795 }
17796 }
17797 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017798 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017799
Daniel Veillard42595322004-11-08 10:52:06 +000017800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017801}
17802
17803
17804static int
17805test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017807
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017808 int mem_base;
17809 int ret_val;
17810 xmlBufferPtr buf; /* the buffer to dump */
17811 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017812 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017813 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017814
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017815 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17816 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017818 buf = gen_xmlBufferPtr(n_buf, 0);
17819 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017820
William M. Brackf13f77f2004-11-12 16:03:48 +000017821 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017822 desret_int(ret_val);
17823 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017824 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017825 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017826 xmlResetLastError();
17827 if (mem_base != xmlMemBlocks()) {
17828 printf("Leak of %d blocks found in xmlBufferCCat",
17829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017830 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017831 printf(" %d", n_buf);
17832 printf(" %d", n_str);
17833 printf("\n");
17834 }
17835 }
17836 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017837 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017838
Daniel Veillard42595322004-11-08 10:52:06 +000017839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017840}
17841
17842
17843static int
17844test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017846
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017847 int mem_base;
17848 int ret_val;
17849 xmlBufferPtr buf; /* the buffer to add to */
17850 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017851 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017852 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017853
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017854 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17855 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017857 buf = gen_xmlBufferPtr(n_buf, 0);
17858 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017859
William M. Brackf13f77f2004-11-12 16:03:48 +000017860 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017861 desret_int(ret_val);
17862 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017863 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017864 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017865 xmlResetLastError();
17866 if (mem_base != xmlMemBlocks()) {
17867 printf("Leak of %d blocks found in xmlBufferCat",
17868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017869 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017870 printf(" %d", n_buf);
17871 printf(" %d", n_str);
17872 printf("\n");
17873 }
17874 }
17875 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017876 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017877
Daniel Veillard42595322004-11-08 10:52:06 +000017878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017879}
17880
17881
Daniel Veillardce682bc2004-11-05 17:22:25 +000017882#define gen_nb_const_xmlBufferPtr 1
17883static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17884 return(NULL);
17885}
17886static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17887}
17888
Daniel Veillardd93f6252004-11-02 15:53:51 +000017889static int
17890test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017892
Daniel Veillardce682bc2004-11-05 17:22:25 +000017893 int mem_base;
17894 const xmlChar * ret_val;
17895 xmlBufferPtr buf; /* the buffer */
17896 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017897
Daniel Veillardce682bc2004-11-05 17:22:25 +000017898 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17899 mem_base = xmlMemBlocks();
17900 buf = gen_const_xmlBufferPtr(n_buf, 0);
17901
William M. Brackf13f77f2004-11-12 16:03:48 +000017902 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017903 desret_const_xmlChar_ptr(ret_val);
17904 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017905 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017906 xmlResetLastError();
17907 if (mem_base != xmlMemBlocks()) {
17908 printf("Leak of %d blocks found in xmlBufferContent",
17909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017910 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017911 printf(" %d", n_buf);
17912 printf("\n");
17913 }
17914 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000017915 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017916
Daniel Veillard42595322004-11-08 10:52:06 +000017917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017918}
17919
17920
17921static int
17922test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017924
Daniel Veillard3d95c732004-11-06 22:25:14 +000017925 int mem_base;
17926 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017927
Daniel Veillard3d95c732004-11-06 22:25:14 +000017928 mem_base = xmlMemBlocks();
17929
17930 ret_val = xmlBufferCreate();
17931 desret_xmlBufferPtr(ret_val);
17932 call_tests++;
17933 xmlResetLastError();
17934 if (mem_base != xmlMemBlocks()) {
17935 printf("Leak of %d blocks found in xmlBufferCreate",
17936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017937 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017938 printf("\n");
17939 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000017940 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017941
Daniel Veillard42595322004-11-08 10:52:06 +000017942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017943}
17944
17945
17946static int
17947test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017949
17950
17951 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017953}
17954
17955
17956static int
17957test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017959
17960
17961 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017963}
17964
17965
17966static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017967test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017969
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017970 int mem_base;
17971 xmlBufferPtr buf; /* the buffer */
17972 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017973
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017974 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017976 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017977
17978 xmlBufferEmpty(buf);
17979 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017980 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017981 xmlResetLastError();
17982 if (mem_base != xmlMemBlocks()) {
17983 printf("Leak of %d blocks found in xmlBufferEmpty",
17984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017985 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017986 printf(" %d", n_buf);
17987 printf("\n");
17988 }
17989 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017990 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017991
Daniel Veillard42595322004-11-08 10:52:06 +000017992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017993}
17994
17995
17996static int
17997test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017999
Daniel Veillard3d97e662004-11-04 10:49:00 +000018000 int mem_base;
18001 int ret_val;
18002 xmlBufferPtr buf; /* the buffer */
18003 int n_buf;
18004 unsigned int len; /* the minimum free size to allocate */
18005 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018006
Daniel Veillard3d97e662004-11-04 10:49:00 +000018007 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18008 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18009 mem_base = xmlMemBlocks();
18010 buf = gen_xmlBufferPtr(n_buf, 0);
18011 len = gen_unsigned_int(n_len, 1);
18012
18013 ret_val = xmlBufferGrow(buf, len);
18014 desret_int(ret_val);
18015 call_tests++;
18016 des_xmlBufferPtr(n_buf, buf, 0);
18017 des_unsigned_int(n_len, len, 1);
18018 xmlResetLastError();
18019 if (mem_base != xmlMemBlocks()) {
18020 printf("Leak of %d blocks found in xmlBufferGrow",
18021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018022 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018023 printf(" %d", n_buf);
18024 printf(" %d", n_len);
18025 printf("\n");
18026 }
18027 }
18028 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018029 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018030
Daniel Veillard42595322004-11-08 10:52:06 +000018031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018032}
18033
18034
18035static int
18036test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018038
Daniel Veillardce682bc2004-11-05 17:22:25 +000018039 int mem_base;
18040 int ret_val;
18041 xmlBufferPtr buf; /* the buffer */
18042 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018043
Daniel Veillardce682bc2004-11-05 17:22:25 +000018044 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18045 mem_base = xmlMemBlocks();
18046 buf = gen_const_xmlBufferPtr(n_buf, 0);
18047
William M. Brackf13f77f2004-11-12 16:03:48 +000018048 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018049 desret_int(ret_val);
18050 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018051 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018052 xmlResetLastError();
18053 if (mem_base != xmlMemBlocks()) {
18054 printf("Leak of %d blocks found in xmlBufferLength",
18055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018056 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018057 printf(" %d", n_buf);
18058 printf("\n");
18059 }
18060 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018061 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018062
Daniel Veillard42595322004-11-08 10:52:06 +000018063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018064}
18065
18066
18067static int
18068test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018070
Daniel Veillard3d97e662004-11-04 10:49:00 +000018071 int mem_base;
18072 int ret_val;
18073 xmlBufferPtr buf; /* the buffer to resize */
18074 int n_buf;
18075 unsigned int size; /* the desired size */
18076 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018077
Daniel Veillard3d97e662004-11-04 10:49:00 +000018078 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18079 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18080 mem_base = xmlMemBlocks();
18081 buf = gen_xmlBufferPtr(n_buf, 0);
18082 size = gen_unsigned_int(n_size, 1);
18083
18084 ret_val = xmlBufferResize(buf, size);
18085 desret_int(ret_val);
18086 call_tests++;
18087 des_xmlBufferPtr(n_buf, buf, 0);
18088 des_unsigned_int(n_size, size, 1);
18089 xmlResetLastError();
18090 if (mem_base != xmlMemBlocks()) {
18091 printf("Leak of %d blocks found in xmlBufferResize",
18092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018093 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018094 printf(" %d", n_buf);
18095 printf(" %d", n_size);
18096 printf("\n");
18097 }
18098 }
18099 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018101
Daniel Veillard42595322004-11-08 10:52:06 +000018102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018103}
18104
18105
18106static int
18107test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018109
Daniel Veillard57b25162004-11-06 14:50:18 +000018110 int mem_base;
18111 xmlBufferPtr buf; /* the buffer to tune */
18112 int n_buf;
18113 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18114 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018115
Daniel Veillard57b25162004-11-06 14:50:18 +000018116 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18117 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18118 mem_base = xmlMemBlocks();
18119 buf = gen_xmlBufferPtr(n_buf, 0);
18120 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18121
18122 xmlBufferSetAllocationScheme(buf, scheme);
18123 call_tests++;
18124 des_xmlBufferPtr(n_buf, buf, 0);
18125 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18126 xmlResetLastError();
18127 if (mem_base != xmlMemBlocks()) {
18128 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018130 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018131 printf(" %d", n_buf);
18132 printf(" %d", n_scheme);
18133 printf("\n");
18134 }
18135 }
18136 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018137 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018138
Daniel Veillard42595322004-11-08 10:52:06 +000018139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018140}
18141
18142
18143static int
18144test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018146
Daniel Veillard3d97e662004-11-04 10:49:00 +000018147 int mem_base;
18148 int ret_val;
18149 xmlBufferPtr buf; /* the buffer to dump */
18150 int n_buf;
18151 unsigned int len; /* the number of xmlChar to remove */
18152 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018153
Daniel Veillard3d97e662004-11-04 10:49:00 +000018154 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18155 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18156 mem_base = xmlMemBlocks();
18157 buf = gen_xmlBufferPtr(n_buf, 0);
18158 len = gen_unsigned_int(n_len, 1);
18159
18160 ret_val = xmlBufferShrink(buf, len);
18161 desret_int(ret_val);
18162 call_tests++;
18163 des_xmlBufferPtr(n_buf, buf, 0);
18164 des_unsigned_int(n_len, len, 1);
18165 xmlResetLastError();
18166 if (mem_base != xmlMemBlocks()) {
18167 printf("Leak of %d blocks found in xmlBufferShrink",
18168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018169 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018170 printf(" %d", n_buf);
18171 printf(" %d", n_len);
18172 printf("\n");
18173 }
18174 }
18175 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018176 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018177
Daniel Veillard42595322004-11-08 10:52:06 +000018178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018179}
18180
18181
18182static int
18183test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018185
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018186 int mem_base;
18187 xmlBufferPtr buf; /* the XML buffer */
18188 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018189 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018190 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018191
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018192 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18193 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018195 buf = gen_xmlBufferPtr(n_buf, 0);
18196 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018197
William M. Brackf13f77f2004-11-12 16:03:48 +000018198 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018200 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018201 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018202 xmlResetLastError();
18203 if (mem_base != xmlMemBlocks()) {
18204 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018206 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018207 printf(" %d", n_buf);
18208 printf(" %d", n_string);
18209 printf("\n");
18210 }
18211 }
18212 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018214
Daniel Veillard42595322004-11-08 10:52:06 +000018215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018216}
18217
18218
18219static int
18220test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018222
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018223 int mem_base;
18224 xmlBufferPtr buf; /* the XML buffer output */
18225 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018226 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018227 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018228
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018229 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18230 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18231 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018232 buf = gen_xmlBufferPtr(n_buf, 0);
18233 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018234
William M. Brackf13f77f2004-11-12 16:03:48 +000018235 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018236 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018237 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018238 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018239 xmlResetLastError();
18240 if (mem_base != xmlMemBlocks()) {
18241 printf("Leak of %d blocks found in xmlBufferWriteChar",
18242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018243 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018244 printf(" %d", n_buf);
18245 printf(" %d", n_string);
18246 printf("\n");
18247 }
18248 }
18249 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018250 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018251
Daniel Veillard42595322004-11-08 10:52:06 +000018252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018253}
18254
18255
18256static int
18257test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018259
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018260 int mem_base;
18261 xmlBufferPtr buf; /* the XML buffer output */
18262 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018263 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018264 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018265
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018266 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18267 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18268 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018269 buf = gen_xmlBufferPtr(n_buf, 0);
18270 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018271
William M. Brackf13f77f2004-11-12 16:03:48 +000018272 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018273 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018274 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018275 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018276 xmlResetLastError();
18277 if (mem_base != xmlMemBlocks()) {
18278 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018280 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018281 printf(" %d", n_buf);
18282 printf(" %d", n_string);
18283 printf("\n");
18284 }
18285 }
18286 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018287 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018288
Daniel Veillard42595322004-11-08 10:52:06 +000018289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018290}
18291
18292
18293static int
18294test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018296
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018297 int mem_base;
18298 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018299 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018300 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018301 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018302 int n_prefix;
18303 xmlChar * memory; /* preallocated memory */
18304 int n_memory;
18305 int len; /* preallocated memory length */
18306 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018307
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018308 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18309 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18310 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18311 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018313 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18314 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18315 memory = gen_xmlChar_ptr(n_memory, 2);
18316 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018317
William M. Brackf13f77f2004-11-12 16:03:48 +000018318 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018319 if ((ret_val != NULL) && (ret_val != ncname) &&
18320 (ret_val != prefix) && (ret_val != memory))
18321 xmlFree(ret_val);
18322 ret_val = NULL;
18323 desret_xmlChar_ptr(ret_val);
18324 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018325 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18326 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018327 des_xmlChar_ptr(n_memory, memory, 2);
18328 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018329 xmlResetLastError();
18330 if (mem_base != xmlMemBlocks()) {
18331 printf("Leak of %d blocks found in xmlBuildQName",
18332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018333 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018334 printf(" %d", n_ncname);
18335 printf(" %d", n_prefix);
18336 printf(" %d", n_memory);
18337 printf(" %d", n_len);
18338 printf("\n");
18339 }
18340 }
18341 }
18342 }
18343 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018344 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018345
Daniel Veillard42595322004-11-08 10:52:06 +000018346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018347}
18348
18349
18350static int
18351test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018353
18354#ifdef LIBXML_TREE_ENABLED
18355 int mem_base;
18356 xmlDocPtr ret_val;
18357 xmlDocPtr doc; /* the document */
18358 int n_doc;
18359 int recursive; /* if not zero do a recursive copy. */
18360 int n_recursive;
18361
18362 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18363 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018365 doc = gen_xmlDocPtr(n_doc, 0);
18366 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018367
18368 ret_val = xmlCopyDoc(doc, recursive);
18369 desret_xmlDocPtr(ret_val);
18370 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018371 des_xmlDocPtr(n_doc, doc, 0);
18372 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018373 xmlResetLastError();
18374 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018375 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018377 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018378 printf(" %d", n_doc);
18379 printf(" %d", n_recursive);
18380 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018381 }
18382 }
18383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018384 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018385#endif
18386
Daniel Veillard42595322004-11-08 10:52:06 +000018387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018388}
18389
18390
18391static int
18392test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018394
Daniel Veillard27f20102004-11-05 11:50:11 +000018395#ifdef LIBXML_TREE_ENABLED
18396 int mem_base;
18397 xmlDtdPtr ret_val;
18398 xmlDtdPtr dtd; /* the dtd */
18399 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018400
Daniel Veillard27f20102004-11-05 11:50:11 +000018401 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18402 mem_base = xmlMemBlocks();
18403 dtd = gen_xmlDtdPtr(n_dtd, 0);
18404
18405 ret_val = xmlCopyDtd(dtd);
18406 desret_xmlDtdPtr(ret_val);
18407 call_tests++;
18408 des_xmlDtdPtr(n_dtd, dtd, 0);
18409 xmlResetLastError();
18410 if (mem_base != xmlMemBlocks()) {
18411 printf("Leak of %d blocks found in xmlCopyDtd",
18412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018413 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018414 printf(" %d", n_dtd);
18415 printf("\n");
18416 }
18417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018418 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018419#endif
18420
Daniel Veillard42595322004-11-08 10:52:06 +000018421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018422}
18423
18424
18425static int
18426test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018428
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018429 int mem_base;
18430 xmlNsPtr ret_val;
18431 xmlNsPtr cur; /* the namespace */
18432 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018433
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018434 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18435 mem_base = xmlMemBlocks();
18436 cur = gen_xmlNsPtr(n_cur, 0);
18437
18438 ret_val = xmlCopyNamespace(cur);
18439 if (ret_val != NULL) xmlFreeNs(ret_val);
18440 desret_xmlNsPtr(ret_val);
18441 call_tests++;
18442 des_xmlNsPtr(n_cur, cur, 0);
18443 xmlResetLastError();
18444 if (mem_base != xmlMemBlocks()) {
18445 printf("Leak of %d blocks found in xmlCopyNamespace",
18446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018447 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018448 printf(" %d", n_cur);
18449 printf("\n");
18450 }
18451 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018453
Daniel Veillard42595322004-11-08 10:52:06 +000018454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018455}
18456
18457
18458static int
18459test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018461
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018462 int mem_base;
18463 xmlNsPtr ret_val;
18464 xmlNsPtr cur; /* the first namespace */
18465 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018467 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18468 mem_base = xmlMemBlocks();
18469 cur = gen_xmlNsPtr(n_cur, 0);
18470
18471 ret_val = xmlCopyNamespaceList(cur);
18472 if (ret_val != NULL) xmlFreeNsList(ret_val);
18473 desret_xmlNsPtr(ret_val);
18474 call_tests++;
18475 des_xmlNsPtr(n_cur, cur, 0);
18476 xmlResetLastError();
18477 if (mem_base != xmlMemBlocks()) {
18478 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018480 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018481 printf(" %d", n_cur);
18482 printf("\n");
18483 }
18484 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018486
Daniel Veillard42595322004-11-08 10:52:06 +000018487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018488}
18489
18490
18491static int
18492test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018494
Daniel Veillardce682bc2004-11-05 17:22:25 +000018495 int mem_base;
18496 xmlNodePtr ret_val;
18497 xmlNodePtr node; /* the node */
18498 int n_node;
18499 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18500 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018501
Daniel Veillardce682bc2004-11-05 17:22:25 +000018502 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18503 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18504 mem_base = xmlMemBlocks();
18505 node = gen_const_xmlNodePtr(n_node, 0);
18506 extended = gen_int(n_extended, 1);
18507
William M. Brackf13f77f2004-11-12 16:03:48 +000018508 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018509 desret_xmlNodePtr(ret_val);
18510 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018511 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018512 des_int(n_extended, extended, 1);
18513 xmlResetLastError();
18514 if (mem_base != xmlMemBlocks()) {
18515 printf("Leak of %d blocks found in xmlCopyNode",
18516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018517 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018518 printf(" %d", n_node);
18519 printf(" %d", n_extended);
18520 printf("\n");
18521 }
18522 }
18523 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018525
Daniel Veillard42595322004-11-08 10:52:06 +000018526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018527}
18528
18529
18530static int
18531test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018533
Daniel Veillardce682bc2004-11-05 17:22:25 +000018534 int mem_base;
18535 xmlNodePtr ret_val;
18536 xmlNodePtr node; /* the first node in the list. */
18537 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018538
Daniel Veillardce682bc2004-11-05 17:22:25 +000018539 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18540 mem_base = xmlMemBlocks();
18541 node = gen_const_xmlNodePtr(n_node, 0);
18542
William M. Brackf13f77f2004-11-12 16:03:48 +000018543 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018544 desret_xmlNodePtr(ret_val);
18545 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018546 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018547 xmlResetLastError();
18548 if (mem_base != xmlMemBlocks()) {
18549 printf("Leak of %d blocks found in xmlCopyNodeList",
18550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018551 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018552 printf(" %d", n_node);
18553 printf("\n");
18554 }
18555 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018556 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018557
Daniel Veillard42595322004-11-08 10:52:06 +000018558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018559}
18560
18561
18562static int
18563test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018565
Daniel Veillard57b25162004-11-06 14:50:18 +000018566 int mem_base;
18567 xmlAttrPtr ret_val;
18568 xmlNodePtr target; /* the element where the attribute will be grafted */
18569 int n_target;
18570 xmlAttrPtr cur; /* the attribute */
18571 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018572
Daniel Veillard57b25162004-11-06 14:50:18 +000018573 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18574 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18575 mem_base = xmlMemBlocks();
18576 target = gen_xmlNodePtr(n_target, 0);
18577 cur = gen_xmlAttrPtr(n_cur, 1);
18578
18579 ret_val = xmlCopyProp(target, cur);
18580 desret_xmlAttrPtr(ret_val);
18581 call_tests++;
18582 des_xmlNodePtr(n_target, target, 0);
18583 des_xmlAttrPtr(n_cur, cur, 1);
18584 xmlResetLastError();
18585 if (mem_base != xmlMemBlocks()) {
18586 printf("Leak of %d blocks found in xmlCopyProp",
18587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018588 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018589 printf(" %d", n_target);
18590 printf(" %d", n_cur);
18591 printf("\n");
18592 }
18593 }
18594 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018595 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018596
Daniel Veillard42595322004-11-08 10:52:06 +000018597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018598}
18599
18600
18601static int
18602test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018604
Daniel Veillard57b25162004-11-06 14:50:18 +000018605 int mem_base;
18606 xmlAttrPtr ret_val;
18607 xmlNodePtr target; /* the element where the attributes will be grafted */
18608 int n_target;
18609 xmlAttrPtr cur; /* the first attribute */
18610 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018611
Daniel Veillard57b25162004-11-06 14:50:18 +000018612 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18613 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18614 mem_base = xmlMemBlocks();
18615 target = gen_xmlNodePtr(n_target, 0);
18616 cur = gen_xmlAttrPtr(n_cur, 1);
18617
18618 ret_val = xmlCopyPropList(target, cur);
18619 desret_xmlAttrPtr(ret_val);
18620 call_tests++;
18621 des_xmlNodePtr(n_target, target, 0);
18622 des_xmlAttrPtr(n_cur, cur, 1);
18623 xmlResetLastError();
18624 if (mem_base != xmlMemBlocks()) {
18625 printf("Leak of %d blocks found in xmlCopyPropList",
18626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018627 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018628 printf(" %d", n_target);
18629 printf(" %d", n_cur);
18630 printf("\n");
18631 }
18632 }
18633 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018634 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018635
Daniel Veillard42595322004-11-08 10:52:06 +000018636 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018637}
18638
18639
18640static int
18641test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018642 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018643
Daniel Veillard34099b42004-11-04 17:34:35 +000018644 int mem_base;
18645 xmlDtdPtr ret_val;
18646 xmlDocPtr doc; /* the document pointer */
18647 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018648 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018649 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018650 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018651 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018652 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018653 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018654
Daniel Veillard34099b42004-11-04 17:34:35 +000018655 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18656 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18657 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18658 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18659 mem_base = xmlMemBlocks();
18660 doc = gen_xmlDocPtr(n_doc, 0);
18661 name = gen_const_xmlChar_ptr(n_name, 1);
18662 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18663 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18664
William M. Brackf13f77f2004-11-12 16:03:48 +000018665 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018666 desret_xmlDtdPtr(ret_val);
18667 call_tests++;
18668 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018669 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18670 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18671 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018672 xmlResetLastError();
18673 if (mem_base != xmlMemBlocks()) {
18674 printf("Leak of %d blocks found in xmlCreateIntSubset",
18675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018676 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018677 printf(" %d", n_doc);
18678 printf(" %d", n_name);
18679 printf(" %d", n_ExternalID);
18680 printf(" %d", n_SystemID);
18681 printf("\n");
18682 }
18683 }
18684 }
18685 }
18686 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018687 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018688
Daniel Veillard42595322004-11-08 10:52:06 +000018689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018690}
18691
18692
18693static int
18694test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018696
Daniel Veillardce682bc2004-11-05 17:22:25 +000018697 int mem_base;
18698 xmlNodePtr ret_val;
18699 xmlNodePtr node; /* the node */
18700 int n_node;
18701 xmlDocPtr doc; /* the document */
18702 int n_doc;
18703 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18704 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018705
Daniel Veillardce682bc2004-11-05 17:22:25 +000018706 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18707 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18708 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18709 mem_base = xmlMemBlocks();
18710 node = gen_const_xmlNodePtr(n_node, 0);
18711 doc = gen_xmlDocPtr(n_doc, 1);
18712 extended = gen_int(n_extended, 2);
18713
William M. Brackf13f77f2004-11-12 16:03:48 +000018714 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018715 desret_xmlNodePtr(ret_val);
18716 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018717 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018718 des_xmlDocPtr(n_doc, doc, 1);
18719 des_int(n_extended, extended, 2);
18720 xmlResetLastError();
18721 if (mem_base != xmlMemBlocks()) {
18722 printf("Leak of %d blocks found in xmlDocCopyNode",
18723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018724 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018725 printf(" %d", n_node);
18726 printf(" %d", n_doc);
18727 printf(" %d", n_extended);
18728 printf("\n");
18729 }
18730 }
18731 }
18732 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018733 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018734
Daniel Veillard42595322004-11-08 10:52:06 +000018735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018736}
18737
18738
18739static int
18740test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018742
Daniel Veillardce682bc2004-11-05 17:22:25 +000018743 int mem_base;
18744 xmlNodePtr ret_val;
18745 xmlDocPtr doc; /* the target document */
18746 int n_doc;
18747 xmlNodePtr node; /* the first node in the list. */
18748 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018749
Daniel Veillardce682bc2004-11-05 17:22:25 +000018750 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18751 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18752 mem_base = xmlMemBlocks();
18753 doc = gen_xmlDocPtr(n_doc, 0);
18754 node = gen_const_xmlNodePtr(n_node, 1);
18755
William M. Brackf13f77f2004-11-12 16:03:48 +000018756 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018757 desret_xmlNodePtr(ret_val);
18758 call_tests++;
18759 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018760 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018761 xmlResetLastError();
18762 if (mem_base != xmlMemBlocks()) {
18763 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018765 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018766 printf(" %d", n_doc);
18767 printf(" %d", n_node);
18768 printf("\n");
18769 }
18770 }
18771 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018773
Daniel Veillard42595322004-11-08 10:52:06 +000018774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018775}
18776
18777
18778static int
18779test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018781
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018782#ifdef LIBXML_OUTPUT_ENABLED
18783 int mem_base;
18784 int ret_val;
18785 FILE * f; /* the FILE* */
18786 int n_f;
18787 xmlDocPtr cur; /* the document */
18788 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018789
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018790 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18791 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18792 mem_base = xmlMemBlocks();
18793 f = gen_FILE_ptr(n_f, 0);
18794 cur = gen_xmlDocPtr(n_cur, 1);
18795
18796 ret_val = xmlDocDump(f, cur);
18797 desret_int(ret_val);
18798 call_tests++;
18799 des_FILE_ptr(n_f, f, 0);
18800 des_xmlDocPtr(n_cur, cur, 1);
18801 xmlResetLastError();
18802 if (mem_base != xmlMemBlocks()) {
18803 printf("Leak of %d blocks found in xmlDocDump",
18804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018805 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018806 printf(" %d", n_f);
18807 printf(" %d", n_cur);
18808 printf("\n");
18809 }
18810 }
18811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018812 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018813#endif
18814
Daniel Veillard42595322004-11-08 10:52:06 +000018815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018816}
18817
18818
18819static int
18820test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018822
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018823#ifdef LIBXML_OUTPUT_ENABLED
18824 int mem_base;
18825 xmlDocPtr cur; /* the document */
18826 int n_cur;
18827 xmlChar ** mem; /* OUT: the memory pointer */
18828 int n_mem;
18829 int * size; /* OUT: the memory length */
18830 int n_size;
18831 int format; /* should formatting spaces been added */
18832 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018833
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018834 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18835 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18836 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18837 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18838 mem_base = xmlMemBlocks();
18839 cur = gen_xmlDocPtr(n_cur, 0);
18840 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18841 size = gen_int_ptr(n_size, 2);
18842 format = gen_int(n_format, 3);
18843
18844 xmlDocDumpFormatMemory(cur, mem, size, format);
18845 call_tests++;
18846 des_xmlDocPtr(n_cur, cur, 0);
18847 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18848 des_int_ptr(n_size, size, 2);
18849 des_int(n_format, format, 3);
18850 xmlResetLastError();
18851 if (mem_base != xmlMemBlocks()) {
18852 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018854 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018855 printf(" %d", n_cur);
18856 printf(" %d", n_mem);
18857 printf(" %d", n_size);
18858 printf(" %d", n_format);
18859 printf("\n");
18860 }
18861 }
18862 }
18863 }
18864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018865 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018866#endif
18867
Daniel Veillard42595322004-11-08 10:52:06 +000018868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018869}
18870
18871
18872static int
18873test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018875
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018876#ifdef LIBXML_OUTPUT_ENABLED
18877 int mem_base;
18878 xmlDocPtr out_doc; /* Document to generate XML text from */
18879 int n_out_doc;
18880 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18881 int n_doc_txt_ptr;
18882 int * doc_txt_len; /* Length of the generated XML text */
18883 int n_doc_txt_len;
18884 char * txt_encoding; /* Character encoding to use when generating XML text */
18885 int n_txt_encoding;
18886 int format; /* should formatting spaces been added */
18887 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018888
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018889 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18890 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18891 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18892 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18893 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18894 mem_base = xmlMemBlocks();
18895 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18896 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18897 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18898 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18899 format = gen_int(n_format, 4);
18900
William M. Brackf13f77f2004-11-12 16:03:48 +000018901 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018902 call_tests++;
18903 des_xmlDocPtr(n_out_doc, out_doc, 0);
18904 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18905 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018906 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018907 des_int(n_format, format, 4);
18908 xmlResetLastError();
18909 if (mem_base != xmlMemBlocks()) {
18910 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018912 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018913 printf(" %d", n_out_doc);
18914 printf(" %d", n_doc_txt_ptr);
18915 printf(" %d", n_doc_txt_len);
18916 printf(" %d", n_txt_encoding);
18917 printf(" %d", n_format);
18918 printf("\n");
18919 }
18920 }
18921 }
18922 }
18923 }
18924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018925 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018926#endif
18927
Daniel Veillard42595322004-11-08 10:52:06 +000018928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018929}
18930
18931
18932static int
18933test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018936#ifdef LIBXML_OUTPUT_ENABLED
18937 int mem_base;
18938 xmlDocPtr cur; /* the document */
18939 int n_cur;
18940 xmlChar ** mem; /* OUT: the memory pointer */
18941 int n_mem;
18942 int * size; /* OUT: the memory length */
18943 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018944
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018945 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18946 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18947 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18948 mem_base = xmlMemBlocks();
18949 cur = gen_xmlDocPtr(n_cur, 0);
18950 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18951 size = gen_int_ptr(n_size, 2);
18952
18953 xmlDocDumpMemory(cur, mem, size);
18954 call_tests++;
18955 des_xmlDocPtr(n_cur, cur, 0);
18956 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18957 des_int_ptr(n_size, size, 2);
18958 xmlResetLastError();
18959 if (mem_base != xmlMemBlocks()) {
18960 printf("Leak of %d blocks found in xmlDocDumpMemory",
18961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018962 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018963 printf(" %d", n_cur);
18964 printf(" %d", n_mem);
18965 printf(" %d", n_size);
18966 printf("\n");
18967 }
18968 }
18969 }
18970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018971 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018972#endif
18973
Daniel Veillard42595322004-11-08 10:52:06 +000018974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018975}
18976
18977
18978static int
18979test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018981
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018982#ifdef LIBXML_OUTPUT_ENABLED
18983 int mem_base;
18984 xmlDocPtr out_doc; /* Document to generate XML text from */
18985 int n_out_doc;
18986 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18987 int n_doc_txt_ptr;
18988 int * doc_txt_len; /* Length of the generated XML text */
18989 int n_doc_txt_len;
18990 char * txt_encoding; /* Character encoding to use when generating XML text */
18991 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018992
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018993 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18994 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18995 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18996 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18997 mem_base = xmlMemBlocks();
18998 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18999 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19000 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19001 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19002
William M. Brackf13f77f2004-11-12 16:03:48 +000019003 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019004 call_tests++;
19005 des_xmlDocPtr(n_out_doc, out_doc, 0);
19006 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19007 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019008 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019009 xmlResetLastError();
19010 if (mem_base != xmlMemBlocks()) {
19011 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019013 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019014 printf(" %d", n_out_doc);
19015 printf(" %d", n_doc_txt_ptr);
19016 printf(" %d", n_doc_txt_len);
19017 printf(" %d", n_txt_encoding);
19018 printf("\n");
19019 }
19020 }
19021 }
19022 }
19023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019024 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019025#endif
19026
Daniel Veillard42595322004-11-08 10:52:06 +000019027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019028}
19029
19030
19031static int
19032test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019034
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019035#ifdef LIBXML_OUTPUT_ENABLED
19036 int mem_base;
19037 int ret_val;
19038 FILE * f; /* the FILE* */
19039 int n_f;
19040 xmlDocPtr cur; /* the document */
19041 int n_cur;
19042 int format; /* should formatting spaces been added */
19043 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019044
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019045 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19046 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19047 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19048 mem_base = xmlMemBlocks();
19049 f = gen_FILE_ptr(n_f, 0);
19050 cur = gen_xmlDocPtr(n_cur, 1);
19051 format = gen_int(n_format, 2);
19052
19053 ret_val = xmlDocFormatDump(f, cur, format);
19054 desret_int(ret_val);
19055 call_tests++;
19056 des_FILE_ptr(n_f, f, 0);
19057 des_xmlDocPtr(n_cur, cur, 1);
19058 des_int(n_format, format, 2);
19059 xmlResetLastError();
19060 if (mem_base != xmlMemBlocks()) {
19061 printf("Leak of %d blocks found in xmlDocFormatDump",
19062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019063 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019064 printf(" %d", n_f);
19065 printf(" %d", n_cur);
19066 printf(" %d", n_format);
19067 printf("\n");
19068 }
19069 }
19070 }
19071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019072 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019073#endif
19074
Daniel Veillard42595322004-11-08 10:52:06 +000019075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019076}
19077
19078
19079static int
19080test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019082
19083 int mem_base;
19084 xmlNodePtr ret_val;
19085 xmlDocPtr doc; /* the document */
19086 int n_doc;
19087
19088 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19089 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019090 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019091
19092 ret_val = xmlDocGetRootElement(doc);
19093 desret_xmlNodePtr(ret_val);
19094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019095 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019096 xmlResetLastError();
19097 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019098 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019100 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019101 printf(" %d", n_doc);
19102 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019103 }
19104 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019106
Daniel Veillard42595322004-11-08 10:52:06 +000019107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019108}
19109
19110
19111static int
19112test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019114
19115#ifdef LIBXML_TREE_ENABLED
19116 int mem_base;
19117 xmlNodePtr ret_val;
19118 xmlDocPtr doc; /* the document */
19119 int n_doc;
19120 xmlNodePtr root; /* the new document root element */
19121 int n_root;
19122
19123 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019124 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019126 doc = gen_xmlDocPtr(n_doc, 0);
19127 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019128
19129 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019130 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131 desret_xmlNodePtr(ret_val);
19132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019133 des_xmlDocPtr(n_doc, doc, 0);
19134 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019135 xmlResetLastError();
19136 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019137 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019139 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019140 printf(" %d", n_doc);
19141 printf(" %d", n_root);
19142 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019143 }
19144 }
19145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019146 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019147#endif
19148
Daniel Veillard42595322004-11-08 10:52:06 +000019149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019150}
19151
19152
19153static int
19154test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019156
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019157#ifdef LIBXML_OUTPUT_ENABLED
19158 int mem_base;
19159 FILE * f; /* the FILE * for the output */
19160 int n_f;
19161 xmlDocPtr doc; /* the document */
19162 int n_doc;
19163 xmlNodePtr cur; /* the current node */
19164 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019165
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019166 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19167 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19168 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19169 mem_base = xmlMemBlocks();
19170 f = gen_FILE_ptr(n_f, 0);
19171 doc = gen_xmlDocPtr(n_doc, 1);
19172 cur = gen_xmlNodePtr(n_cur, 2);
19173
19174 xmlElemDump(f, doc, cur);
19175 call_tests++;
19176 des_FILE_ptr(n_f, f, 0);
19177 des_xmlDocPtr(n_doc, doc, 1);
19178 des_xmlNodePtr(n_cur, cur, 2);
19179 xmlResetLastError();
19180 if (mem_base != xmlMemBlocks()) {
19181 printf("Leak of %d blocks found in xmlElemDump",
19182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019183 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019184 printf(" %d", n_f);
19185 printf(" %d", n_doc);
19186 printf(" %d", n_cur);
19187 printf("\n");
19188 }
19189 }
19190 }
19191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019192 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019193#endif
19194
Daniel Veillard42595322004-11-08 10:52:06 +000019195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019196}
19197
19198
19199static int
19200test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019202
Daniel Veillard57b25162004-11-06 14:50:18 +000019203 int mem_base;
19204 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019205
Daniel Veillard57b25162004-11-06 14:50:18 +000019206 mem_base = xmlMemBlocks();
19207
19208 ret_val = xmlGetBufferAllocationScheme();
19209 desret_xmlBufferAllocationScheme(ret_val);
19210 call_tests++;
19211 xmlResetLastError();
19212 if (mem_base != xmlMemBlocks()) {
19213 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019215 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019216 printf("\n");
19217 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019219
Daniel Veillard42595322004-11-08 10:52:06 +000019220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019221}
19222
19223
19224static int
19225test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019227
19228 int mem_base;
19229 int ret_val;
19230
19231 mem_base = xmlMemBlocks();
19232
19233 ret_val = xmlGetCompressMode();
19234 desret_int(ret_val);
19235 call_tests++;
19236 xmlResetLastError();
19237 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019238 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019240 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019241 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019242 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019243 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019244
Daniel Veillard42595322004-11-08 10:52:06 +000019245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019246}
19247
19248
19249static int
19250test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019252
19253 int mem_base;
19254 int ret_val;
19255 xmlDocPtr doc; /* the document */
19256 int n_doc;
19257
19258 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19259 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019260 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019261
19262 ret_val = xmlGetDocCompressMode(doc);
19263 desret_int(ret_val);
19264 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019265 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019266 xmlResetLastError();
19267 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019268 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019270 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019271 printf(" %d", n_doc);
19272 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019273 }
19274 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019276
Daniel Veillard42595322004-11-08 10:52:06 +000019277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019278}
19279
19280
19281static int
19282test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019284
Daniel Veillard34099b42004-11-04 17:34:35 +000019285 int mem_base;
19286 xmlDtdPtr ret_val;
19287 xmlDocPtr doc; /* the document pointer */
19288 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019289
Daniel Veillard34099b42004-11-04 17:34:35 +000019290 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19291 mem_base = xmlMemBlocks();
19292 doc = gen_xmlDocPtr(n_doc, 0);
19293
19294 ret_val = xmlGetIntSubset(doc);
19295 desret_xmlDtdPtr(ret_val);
19296 call_tests++;
19297 des_xmlDocPtr(n_doc, doc, 0);
19298 xmlResetLastError();
19299 if (mem_base != xmlMemBlocks()) {
19300 printf("Leak of %d blocks found in xmlGetIntSubset",
19301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019302 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019303 printf(" %d", n_doc);
19304 printf("\n");
19305 }
19306 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019307 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019308
Daniel Veillard42595322004-11-08 10:52:06 +000019309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019310}
19311
19312
19313static int
19314test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019316
19317 int mem_base;
19318 xmlNodePtr ret_val;
19319 xmlNodePtr parent; /* the parent node */
19320 int n_parent;
19321
19322 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019324 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019325
19326 ret_val = xmlGetLastChild(parent);
19327 desret_xmlNodePtr(ret_val);
19328 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019329 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019330 xmlResetLastError();
19331 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019332 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019334 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019335 printf(" %d", n_parent);
19336 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019337 }
19338 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019340
Daniel Veillard42595322004-11-08 10:52:06 +000019341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019342}
19343
19344
19345static int
19346test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019348
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019349 int mem_base;
19350 long ret_val;
19351 xmlNodePtr node; /* valid node */
19352 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019353
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019354 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19355 mem_base = xmlMemBlocks();
19356 node = gen_xmlNodePtr(n_node, 0);
19357
19358 ret_val = xmlGetLineNo(node);
19359 desret_long(ret_val);
19360 call_tests++;
19361 des_xmlNodePtr(n_node, node, 0);
19362 xmlResetLastError();
19363 if (mem_base != xmlMemBlocks()) {
19364 printf("Leak of %d blocks found in xmlGetLineNo",
19365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019366 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019367 printf(" %d", n_node);
19368 printf("\n");
19369 }
19370 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019372
Daniel Veillard42595322004-11-08 10:52:06 +000019373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019374}
19375
19376
19377static int
19378test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019380
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019381 int mem_base;
19382 xmlChar * ret_val;
19383 xmlNodePtr node; /* the node */
19384 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019385 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019386 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019387
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019388 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19389 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19390 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019391 node = gen_xmlNodePtr(n_node, 0);
19392 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019393
William M. Brackf13f77f2004-11-12 16:03:48 +000019394 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019395 desret_xmlChar_ptr(ret_val);
19396 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019397 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019398 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019399 xmlResetLastError();
19400 if (mem_base != xmlMemBlocks()) {
19401 printf("Leak of %d blocks found in xmlGetNoNsProp",
19402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019403 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019404 printf(" %d", n_node);
19405 printf(" %d", n_name);
19406 printf("\n");
19407 }
19408 }
19409 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019410 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019411
Daniel Veillard42595322004-11-08 10:52:06 +000019412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019413}
19414
19415
19416static int
19417test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019419
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019420#ifdef LIBXML_TREE_ENABLED
19421 int mem_base;
19422 xmlChar * ret_val;
19423 xmlNodePtr node; /* a node */
19424 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019425
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019426 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19427 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019428 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019429
19430 ret_val = xmlGetNodePath(node);
19431 desret_xmlChar_ptr(ret_val);
19432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019433 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019434 xmlResetLastError();
19435 if (mem_base != xmlMemBlocks()) {
19436 printf("Leak of %d blocks found in xmlGetNodePath",
19437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019438 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019439 printf(" %d", n_node);
19440 printf("\n");
19441 }
19442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019443 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019444#endif
19445
Daniel Veillard42595322004-11-08 10:52:06 +000019446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019447}
19448
19449
19450static int
19451test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019453
19454
19455 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019457}
19458
19459
19460static int
19461test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019463
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019464 int mem_base;
19465 xmlChar * ret_val;
19466 xmlNodePtr node; /* the node */
19467 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019468 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019469 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019470 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019471 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019472
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019473 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19474 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19475 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019477 node = gen_xmlNodePtr(n_node, 0);
19478 name = gen_const_xmlChar_ptr(n_name, 1);
19479 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019480
William M. Brackf13f77f2004-11-12 16:03:48 +000019481 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019482 desret_xmlChar_ptr(ret_val);
19483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019484 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019485 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19486 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019487 xmlResetLastError();
19488 if (mem_base != xmlMemBlocks()) {
19489 printf("Leak of %d blocks found in xmlGetNsProp",
19490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019491 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019492 printf(" %d", n_node);
19493 printf(" %d", n_name);
19494 printf(" %d", n_nameSpace);
19495 printf("\n");
19496 }
19497 }
19498 }
19499 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019500 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019501
Daniel Veillard42595322004-11-08 10:52:06 +000019502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019503}
19504
19505
19506static int
19507test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019509
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019510 int mem_base;
19511 xmlChar * ret_val;
19512 xmlNodePtr node; /* the node */
19513 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019514 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019515 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019516
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019517 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19518 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19519 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019520 node = gen_xmlNodePtr(n_node, 0);
19521 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019522
William M. Brackf13f77f2004-11-12 16:03:48 +000019523 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019524 desret_xmlChar_ptr(ret_val);
19525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019526 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019527 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019528 xmlResetLastError();
19529 if (mem_base != xmlMemBlocks()) {
19530 printf("Leak of %d blocks found in xmlGetProp",
19531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019532 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019533 printf(" %d", n_node);
19534 printf(" %d", n_name);
19535 printf("\n");
19536 }
19537 }
19538 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019539 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019540
Daniel Veillard42595322004-11-08 10:52:06 +000019541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019542}
19543
19544
19545static int
19546test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019548
Daniel Veillard57b25162004-11-06 14:50:18 +000019549 int mem_base;
19550 xmlAttrPtr ret_val;
19551 xmlNodePtr node; /* the node */
19552 int n_node;
19553 xmlChar * name; /* the attribute name */
19554 int n_name;
19555 xmlChar * nameSpace; /* the URI of the namespace */
19556 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019557
Daniel Veillard57b25162004-11-06 14:50:18 +000019558 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19559 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19560 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19561 mem_base = xmlMemBlocks();
19562 node = gen_xmlNodePtr(n_node, 0);
19563 name = gen_const_xmlChar_ptr(n_name, 1);
19564 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19565
William M. Brackf13f77f2004-11-12 16:03:48 +000019566 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019567 desret_xmlAttrPtr(ret_val);
19568 call_tests++;
19569 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019570 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19571 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019572 xmlResetLastError();
19573 if (mem_base != xmlMemBlocks()) {
19574 printf("Leak of %d blocks found in xmlHasNsProp",
19575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019576 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019577 printf(" %d", n_node);
19578 printf(" %d", n_name);
19579 printf(" %d", n_nameSpace);
19580 printf("\n");
19581 }
19582 }
19583 }
19584 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019585 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019586
Daniel Veillard42595322004-11-08 10:52:06 +000019587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019588}
19589
19590
19591static int
19592test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019594
Daniel Veillard57b25162004-11-06 14:50:18 +000019595 int mem_base;
19596 xmlAttrPtr ret_val;
19597 xmlNodePtr node; /* the node */
19598 int n_node;
19599 xmlChar * name; /* the attribute name */
19600 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019601
Daniel Veillard57b25162004-11-06 14:50:18 +000019602 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19603 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19604 mem_base = xmlMemBlocks();
19605 node = gen_xmlNodePtr(n_node, 0);
19606 name = gen_const_xmlChar_ptr(n_name, 1);
19607
William M. Brackf13f77f2004-11-12 16:03:48 +000019608 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019609 desret_xmlAttrPtr(ret_val);
19610 call_tests++;
19611 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019612 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019613 xmlResetLastError();
19614 if (mem_base != xmlMemBlocks()) {
19615 printf("Leak of %d blocks found in xmlHasProp",
19616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019617 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019618 printf(" %d", n_node);
19619 printf(" %d", n_name);
19620 printf("\n");
19621 }
19622 }
19623 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019624 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019625
Daniel Veillard42595322004-11-08 10:52:06 +000019626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019627}
19628
19629
19630static int
19631test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019633
19634 int mem_base;
19635 int ret_val;
19636 xmlNodePtr node; /* the node */
19637 int n_node;
19638
19639 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19640 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019641 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019642
19643 ret_val = xmlIsBlankNode(node);
19644 desret_int(ret_val);
19645 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019646 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019647 xmlResetLastError();
19648 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019649 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019651 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019652 printf(" %d", n_node);
19653 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019654 }
19655 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019656 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019657
Daniel Veillard42595322004-11-08 10:52:06 +000019658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019659}
19660
19661
19662static int
19663test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019665
19666 int mem_base;
19667 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019668 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019669 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019670 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019671 int n_publicID;
19672
19673 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19674 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19675 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019676 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19677 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019678
William M. Brackf13f77f2004-11-12 16:03:48 +000019679 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019680 desret_int(ret_val);
19681 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019682 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19683 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019684 xmlResetLastError();
19685 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019686 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019688 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019689 printf(" %d", n_systemID);
19690 printf(" %d", n_publicID);
19691 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019692 }
19693 }
19694 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019695 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019696
Daniel Veillard42595322004-11-08 10:52:06 +000019697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019698}
19699
19700
19701static int
19702test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019704
19705 int mem_base;
19706 xmlNodePtr ret_val;
19707 xmlDocPtr doc; /* the document */
19708 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019709 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019710 int n_content;
19711 int len; /* the length of the block */
19712 int n_len;
19713
19714 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19715 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19716 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019718 doc = gen_xmlDocPtr(n_doc, 0);
19719 content = gen_const_xmlChar_ptr(n_content, 1);
19720 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019721
William M. Brackf13f77f2004-11-12 16:03:48 +000019722 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019723 desret_xmlNodePtr(ret_val);
19724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019725 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019726 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019727 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019728 xmlResetLastError();
19729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019730 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019733 printf(" %d", n_doc);
19734 printf(" %d", n_content);
19735 printf(" %d", n_len);
19736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019737 }
19738 }
19739 }
19740 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019742
Daniel Veillard42595322004-11-08 10:52:06 +000019743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019744}
19745
19746
19747static int
19748test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019750
19751 int mem_base;
19752 xmlNodePtr ret_val;
19753 xmlDocPtr doc; /* the document */
19754 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019755 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019756 int n_name;
19757
19758 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19759 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019761 doc = gen_xmlDocPtr(n_doc, 0);
19762 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019763
William M. Brackf13f77f2004-11-12 16:03:48 +000019764 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019765 desret_xmlNodePtr(ret_val);
19766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019767 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019768 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019769 xmlResetLastError();
19770 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019771 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019773 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019774 printf(" %d", n_doc);
19775 printf(" %d", n_name);
19776 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019777 }
19778 }
19779 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019780 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019781
Daniel Veillard42595322004-11-08 10:52:06 +000019782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019783}
19784
19785
19786static int
19787test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019789
Daniel Veillarda521d282004-11-09 14:59:59 +000019790#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019791 int mem_base;
19792 xmlNodePtr ret_val;
19793 xmlNodePtr parent; /* the parent node */
19794 int n_parent;
19795 xmlNsPtr ns; /* a namespace if any */
19796 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019797 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019798 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019799 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019800 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019801
Daniel Veillard27f20102004-11-05 11:50:11 +000019802 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19803 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19804 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19805 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19806 mem_base = xmlMemBlocks();
19807 parent = gen_xmlNodePtr(n_parent, 0);
19808 ns = gen_xmlNsPtr(n_ns, 1);
19809 name = gen_const_xmlChar_ptr(n_name, 2);
19810 content = gen_const_xmlChar_ptr(n_content, 3);
19811
William M. Brackf13f77f2004-11-12 16:03:48 +000019812 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019813 desret_xmlNodePtr(ret_val);
19814 call_tests++;
19815 des_xmlNodePtr(n_parent, parent, 0);
19816 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019817 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19818 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019819 xmlResetLastError();
19820 if (mem_base != xmlMemBlocks()) {
19821 printf("Leak of %d blocks found in xmlNewChild",
19822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019823 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019824 printf(" %d", n_parent);
19825 printf(" %d", n_ns);
19826 printf(" %d", n_name);
19827 printf(" %d", n_content);
19828 printf("\n");
19829 }
19830 }
19831 }
19832 }
19833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019834 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019835#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019836
Daniel Veillard42595322004-11-08 10:52:06 +000019837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019838}
19839
19840
19841static int
19842test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019844
19845 int mem_base;
19846 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019847 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019848 int n_content;
19849
19850 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019852 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019853
William M. Brackf13f77f2004-11-12 16:03:48 +000019854 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019855 desret_xmlNodePtr(ret_val);
19856 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019857 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019858 xmlResetLastError();
19859 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019860 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019862 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019863 printf(" %d", n_content);
19864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019865 }
19866 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019868
Daniel Veillard42595322004-11-08 10:52:06 +000019869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019870}
19871
19872
19873static int
19874test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019876
19877 int mem_base;
19878 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019879 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019880 int n_version;
19881
19882 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19883 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019884 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019885
William M. Brackf13f77f2004-11-12 16:03:48 +000019886 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019887 desret_xmlDocPtr(ret_val);
19888 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019889 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019890 xmlResetLastError();
19891 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019892 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019894 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019895 printf(" %d", n_version);
19896 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019897 }
19898 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019899 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019900
Daniel Veillard42595322004-11-08 10:52:06 +000019901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019902}
19903
19904
19905static int
19906test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019908
19909 int mem_base;
19910 xmlNodePtr ret_val;
19911 xmlDocPtr doc; /* the document */
19912 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019913 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019914 int n_content;
19915
19916 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19917 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019919 doc = gen_xmlDocPtr(n_doc, 0);
19920 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019921
William M. Brackf13f77f2004-11-12 16:03:48 +000019922 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019923 desret_xmlNodePtr(ret_val);
19924 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019925 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019926 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927 xmlResetLastError();
19928 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019929 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019931 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019932 printf(" %d", n_doc);
19933 printf(" %d", n_content);
19934 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019935 }
19936 }
19937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019939
Daniel Veillard42595322004-11-08 10:52:06 +000019940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019941}
19942
19943
19944static int
19945test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019947
19948#ifdef LIBXML_TREE_ENABLED
19949 int mem_base;
19950 xmlNodePtr ret_val;
19951 xmlDocPtr doc; /* the document owning the fragment */
19952 int n_doc;
19953
19954 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019956 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019957
19958 ret_val = xmlNewDocFragment(doc);
19959 desret_xmlNodePtr(ret_val);
19960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019961 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019962 xmlResetLastError();
19963 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019964 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019966 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019967 printf(" %d", n_doc);
19968 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019969 }
19970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019971 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019972#endif
19973
Daniel Veillard42595322004-11-08 10:52:06 +000019974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019975}
19976
19977
19978static int
19979test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019981
Daniel Veillard27f20102004-11-05 11:50:11 +000019982 int mem_base;
19983 xmlNodePtr ret_val;
19984 xmlDocPtr doc; /* the document */
19985 int n_doc;
19986 xmlNsPtr ns; /* namespace if any */
19987 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019988 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019989 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019990 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019991 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019992
Daniel Veillard27f20102004-11-05 11:50:11 +000019993 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19994 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19995 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19996 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19997 mem_base = xmlMemBlocks();
19998 doc = gen_xmlDocPtr(n_doc, 0);
19999 ns = gen_xmlNsPtr(n_ns, 1);
20000 name = gen_const_xmlChar_ptr(n_name, 2);
20001 content = gen_const_xmlChar_ptr(n_content, 3);
20002
William M. Brackf13f77f2004-11-12 16:03:48 +000020003 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020004 desret_xmlNodePtr(ret_val);
20005 call_tests++;
20006 des_xmlDocPtr(n_doc, doc, 0);
20007 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020008 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20009 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020010 xmlResetLastError();
20011 if (mem_base != xmlMemBlocks()) {
20012 printf("Leak of %d blocks found in xmlNewDocNode",
20013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020014 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020015 printf(" %d", n_doc);
20016 printf(" %d", n_ns);
20017 printf(" %d", n_name);
20018 printf(" %d", n_content);
20019 printf("\n");
20020 }
20021 }
20022 }
20023 }
20024 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020025 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020026
Daniel Veillard42595322004-11-08 10:52:06 +000020027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020028}
20029
20030
20031static int
20032test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020034
Daniel Veillard27f20102004-11-05 11:50:11 +000020035 int mem_base;
20036 xmlNodePtr ret_val;
20037 xmlDocPtr doc; /* the document */
20038 int n_doc;
20039 xmlNsPtr ns; /* namespace if any */
20040 int n_ns;
20041 xmlChar * name; /* the node name */
20042 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020043 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020044 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020045
Daniel Veillard27f20102004-11-05 11:50:11 +000020046 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20047 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20048 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20049 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20050 mem_base = xmlMemBlocks();
20051 doc = gen_xmlDocPtr(n_doc, 0);
20052 ns = gen_xmlNsPtr(n_ns, 1);
20053 name = gen_eaten_name(n_name, 2);
20054 content = gen_const_xmlChar_ptr(n_content, 3);
20055
William M. Brackf13f77f2004-11-12 16:03:48 +000020056 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020057 desret_xmlNodePtr(ret_val);
20058 call_tests++;
20059 des_xmlDocPtr(n_doc, doc, 0);
20060 des_xmlNsPtr(n_ns, ns, 1);
20061 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020062 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020063 xmlResetLastError();
20064 if (mem_base != xmlMemBlocks()) {
20065 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020067 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020068 printf(" %d", n_doc);
20069 printf(" %d", n_ns);
20070 printf(" %d", n_name);
20071 printf(" %d", n_content);
20072 printf("\n");
20073 }
20074 }
20075 }
20076 }
20077 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020078 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020079
Daniel Veillard42595322004-11-08 10:52:06 +000020080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020081}
20082
20083
20084static int
20085test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020087
20088 int mem_base;
20089 xmlNodePtr ret_val;
20090 xmlDocPtr doc; /* the target document */
20091 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020092 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020093 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020094 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020095 int n_content;
20096
20097 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20098 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20099 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020101 doc = gen_xmlDocPtr(n_doc, 0);
20102 name = gen_const_xmlChar_ptr(n_name, 1);
20103 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020104
William M. Brackf13f77f2004-11-12 16:03:48 +000020105 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020106 desret_xmlNodePtr(ret_val);
20107 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020108 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020109 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20110 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111 xmlResetLastError();
20112 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020113 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020115 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020116 printf(" %d", n_doc);
20117 printf(" %d", n_name);
20118 printf(" %d", n_content);
20119 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020120 }
20121 }
20122 }
20123 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020124 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020125
Daniel Veillard42595322004-11-08 10:52:06 +000020126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020127}
20128
20129
20130static int
20131test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020133
Daniel Veillard57b25162004-11-06 14:50:18 +000020134 int mem_base;
20135 xmlAttrPtr ret_val;
20136 xmlDocPtr doc; /* the document */
20137 int n_doc;
20138 xmlChar * name; /* the name of the attribute */
20139 int n_name;
20140 xmlChar * value; /* the value of the attribute */
20141 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020142
Daniel Veillard57b25162004-11-06 14:50:18 +000020143 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20144 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20145 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20146 mem_base = xmlMemBlocks();
20147 doc = gen_xmlDocPtr(n_doc, 0);
20148 name = gen_const_xmlChar_ptr(n_name, 1);
20149 value = gen_const_xmlChar_ptr(n_value, 2);
20150
William M. Brackf13f77f2004-11-12 16:03:48 +000020151 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020152 desret_xmlAttrPtr(ret_val);
20153 call_tests++;
20154 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020155 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20156 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020157 xmlResetLastError();
20158 if (mem_base != xmlMemBlocks()) {
20159 printf("Leak of %d blocks found in xmlNewDocProp",
20160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020161 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020162 printf(" %d", n_doc);
20163 printf(" %d", n_name);
20164 printf(" %d", n_value);
20165 printf("\n");
20166 }
20167 }
20168 }
20169 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020171
Daniel Veillard42595322004-11-08 10:52:06 +000020172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020173}
20174
20175
20176static int
20177test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020179
Daniel Veillarda521d282004-11-09 14:59:59 +000020180#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020181 int mem_base;
20182 xmlNodePtr ret_val;
20183 xmlDocPtr doc; /* the document */
20184 int n_doc;
20185 xmlNsPtr ns; /* namespace if any */
20186 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020187 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020188 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020189 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020190 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020191
Daniel Veillard27f20102004-11-05 11:50:11 +000020192 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20193 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20194 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20195 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20196 mem_base = xmlMemBlocks();
20197 doc = gen_xmlDocPtr(n_doc, 0);
20198 ns = gen_xmlNsPtr(n_ns, 1);
20199 name = gen_const_xmlChar_ptr(n_name, 2);
20200 content = gen_const_xmlChar_ptr(n_content, 3);
20201
William M. Brackf13f77f2004-11-12 16:03:48 +000020202 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020203 desret_xmlNodePtr(ret_val);
20204 call_tests++;
20205 des_xmlDocPtr(n_doc, doc, 0);
20206 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020207 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20208 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020209 xmlResetLastError();
20210 if (mem_base != xmlMemBlocks()) {
20211 printf("Leak of %d blocks found in xmlNewDocRawNode",
20212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020213 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020214 printf(" %d", n_doc);
20215 printf(" %d", n_ns);
20216 printf(" %d", n_name);
20217 printf(" %d", n_content);
20218 printf("\n");
20219 }
20220 }
20221 }
20222 }
20223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020224 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020225#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020226
Daniel Veillard42595322004-11-08 10:52:06 +000020227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020228}
20229
20230
20231static int
20232test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020234
20235 int mem_base;
20236 xmlNodePtr ret_val;
20237 xmlDocPtr doc; /* the document */
20238 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020239 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020240 int n_content;
20241
20242 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20243 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020245 doc = gen_xmlDocPtr(n_doc, 0);
20246 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020247
William M. Brackf13f77f2004-11-12 16:03:48 +000020248 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020249 desret_xmlNodePtr(ret_val);
20250 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020251 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020252 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020253 xmlResetLastError();
20254 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020255 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020257 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020258 printf(" %d", n_doc);
20259 printf(" %d", n_content);
20260 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020261 }
20262 }
20263 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020265
Daniel Veillard42595322004-11-08 10:52:06 +000020266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020267}
20268
20269
20270static int
20271test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020273
20274 int mem_base;
20275 xmlNodePtr ret_val;
20276 xmlDocPtr doc; /* the document */
20277 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020278 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020279 int n_content;
20280 int len; /* the text len. */
20281 int n_len;
20282
20283 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20284 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20285 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020287 doc = gen_xmlDocPtr(n_doc, 0);
20288 content = gen_const_xmlChar_ptr(n_content, 1);
20289 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020290
William M. Brackf13f77f2004-11-12 16:03:48 +000020291 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020292 desret_xmlNodePtr(ret_val);
20293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020294 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020295 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020296 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020297 xmlResetLastError();
20298 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020299 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020301 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020302 printf(" %d", n_doc);
20303 printf(" %d", n_content);
20304 printf(" %d", n_len);
20305 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020306 }
20307 }
20308 }
20309 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020311
Daniel Veillard42595322004-11-08 10:52:06 +000020312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020313}
20314
20315
20316static int
20317test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020319
Daniel Veillard34099b42004-11-04 17:34:35 +000020320 int mem_base;
20321 xmlDtdPtr ret_val;
20322 xmlDocPtr doc; /* the document pointer */
20323 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020324 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020325 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020326 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020327 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020328 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020329 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020330
Daniel Veillard34099b42004-11-04 17:34:35 +000020331 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20332 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20333 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20334 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20335 mem_base = xmlMemBlocks();
20336 doc = gen_xmlDocPtr(n_doc, 0);
20337 name = gen_const_xmlChar_ptr(n_name, 1);
20338 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20339 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20340
William M. Brackf13f77f2004-11-12 16:03:48 +000020341 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020342 desret_xmlDtdPtr(ret_val);
20343 call_tests++;
20344 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020345 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20346 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20347 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020348 xmlResetLastError();
20349 if (mem_base != xmlMemBlocks()) {
20350 printf("Leak of %d blocks found in xmlNewDtd",
20351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020352 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020353 printf(" %d", n_doc);
20354 printf(" %d", n_name);
20355 printf(" %d", n_ExternalID);
20356 printf(" %d", n_SystemID);
20357 printf("\n");
20358 }
20359 }
20360 }
20361 }
20362 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020363 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020364
Daniel Veillard42595322004-11-08 10:52:06 +000020365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020366}
20367
20368
20369static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020370test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020372
Daniel Veillard27f20102004-11-05 11:50:11 +000020373 int mem_base;
20374 xmlNodePtr ret_val;
20375 xmlNsPtr ns; /* namespace if any */
20376 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020377 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020378 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020379
Daniel Veillard27f20102004-11-05 11:50:11 +000020380 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20381 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20382 mem_base = xmlMemBlocks();
20383 ns = gen_xmlNsPtr(n_ns, 0);
20384 name = gen_const_xmlChar_ptr(n_name, 1);
20385
William M. Brackf13f77f2004-11-12 16:03:48 +000020386 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020387 desret_xmlNodePtr(ret_val);
20388 call_tests++;
20389 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020390 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020391 xmlResetLastError();
20392 if (mem_base != xmlMemBlocks()) {
20393 printf("Leak of %d blocks found in xmlNewNode",
20394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020395 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020396 printf(" %d", n_ns);
20397 printf(" %d", n_name);
20398 printf("\n");
20399 }
20400 }
20401 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020403
Daniel Veillard42595322004-11-08 10:52:06 +000020404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020405}
20406
20407
20408static int
20409test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020411
Daniel Veillard27f20102004-11-05 11:50:11 +000020412 int mem_base;
20413 xmlNodePtr ret_val;
20414 xmlNsPtr ns; /* namespace if any */
20415 int n_ns;
20416 xmlChar * name; /* the node name */
20417 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020418
Daniel Veillard27f20102004-11-05 11:50:11 +000020419 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20420 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20421 mem_base = xmlMemBlocks();
20422 ns = gen_xmlNsPtr(n_ns, 0);
20423 name = gen_eaten_name(n_name, 1);
20424
20425 ret_val = xmlNewNodeEatName(ns, name);
20426 desret_xmlNodePtr(ret_val);
20427 call_tests++;
20428 des_xmlNsPtr(n_ns, ns, 0);
20429 des_eaten_name(n_name, name, 1);
20430 xmlResetLastError();
20431 if (mem_base != xmlMemBlocks()) {
20432 printf("Leak of %d blocks found in xmlNewNodeEatName",
20433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020434 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020435 printf(" %d", n_ns);
20436 printf(" %d", n_name);
20437 printf("\n");
20438 }
20439 }
20440 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020441 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020442
Daniel Veillard42595322004-11-08 10:52:06 +000020443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020444}
20445
20446
20447static int
20448test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020450
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020451 int mem_base;
20452 xmlNsPtr ret_val;
20453 xmlNodePtr node; /* the element carrying the namespace */
20454 int n_node;
20455 xmlChar * href; /* the URI associated */
20456 int n_href;
20457 xmlChar * prefix; /* the prefix for the namespace */
20458 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020459
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020460 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20461 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20462 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20463 mem_base = xmlMemBlocks();
20464 node = gen_xmlNodePtr(n_node, 0);
20465 href = gen_const_xmlChar_ptr(n_href, 1);
20466 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20467
William M. Brackf13f77f2004-11-12 16:03:48 +000020468 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020469 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20470 desret_xmlNsPtr(ret_val);
20471 call_tests++;
20472 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020473 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20474 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020475 xmlResetLastError();
20476 if (mem_base != xmlMemBlocks()) {
20477 printf("Leak of %d blocks found in xmlNewNs",
20478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020479 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020480 printf(" %d", n_node);
20481 printf(" %d", n_href);
20482 printf(" %d", n_prefix);
20483 printf("\n");
20484 }
20485 }
20486 }
20487 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020488 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020489
Daniel Veillard42595322004-11-08 10:52:06 +000020490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020491}
20492
20493
20494static int
20495test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020497
Daniel Veillard57b25162004-11-06 14:50:18 +000020498 int mem_base;
20499 xmlAttrPtr ret_val;
20500 xmlNodePtr node; /* the holding node */
20501 int n_node;
20502 xmlNsPtr ns; /* the namespace */
20503 int n_ns;
20504 xmlChar * name; /* the name of the attribute */
20505 int n_name;
20506 xmlChar * value; /* the value of the attribute */
20507 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020508
Daniel Veillard57b25162004-11-06 14:50:18 +000020509 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20510 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20511 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20512 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20513 mem_base = xmlMemBlocks();
20514 node = gen_xmlNodePtr(n_node, 0);
20515 ns = gen_xmlNsPtr(n_ns, 1);
20516 name = gen_const_xmlChar_ptr(n_name, 2);
20517 value = gen_const_xmlChar_ptr(n_value, 3);
20518
William M. Brackf13f77f2004-11-12 16:03:48 +000020519 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020520 desret_xmlAttrPtr(ret_val);
20521 call_tests++;
20522 des_xmlNodePtr(n_node, node, 0);
20523 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020524 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20525 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020526 xmlResetLastError();
20527 if (mem_base != xmlMemBlocks()) {
20528 printf("Leak of %d blocks found in xmlNewNsProp",
20529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020530 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020531 printf(" %d", n_node);
20532 printf(" %d", n_ns);
20533 printf(" %d", n_name);
20534 printf(" %d", n_value);
20535 printf("\n");
20536 }
20537 }
20538 }
20539 }
20540 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020542
Daniel Veillard42595322004-11-08 10:52:06 +000020543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020544}
20545
20546
20547static int
20548test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020550
Daniel Veillard57b25162004-11-06 14:50:18 +000020551 int mem_base;
20552 xmlAttrPtr ret_val;
20553 xmlNodePtr node; /* the holding node */
20554 int n_node;
20555 xmlNsPtr ns; /* the namespace */
20556 int n_ns;
20557 xmlChar * name; /* the name of the attribute */
20558 int n_name;
20559 xmlChar * value; /* the value of the attribute */
20560 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020561
Daniel Veillard57b25162004-11-06 14:50:18 +000020562 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20563 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20564 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20565 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20566 mem_base = xmlMemBlocks();
20567 node = gen_xmlNodePtr(n_node, 0);
20568 ns = gen_xmlNsPtr(n_ns, 1);
20569 name = gen_eaten_name(n_name, 2);
20570 value = gen_const_xmlChar_ptr(n_value, 3);
20571
William M. Brackf13f77f2004-11-12 16:03:48 +000020572 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020573 desret_xmlAttrPtr(ret_val);
20574 call_tests++;
20575 des_xmlNodePtr(n_node, node, 0);
20576 des_xmlNsPtr(n_ns, ns, 1);
20577 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020578 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020579 xmlResetLastError();
20580 if (mem_base != xmlMemBlocks()) {
20581 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020583 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020584 printf(" %d", n_node);
20585 printf(" %d", n_ns);
20586 printf(" %d", n_name);
20587 printf(" %d", n_value);
20588 printf("\n");
20589 }
20590 }
20591 }
20592 }
20593 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020594 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020595
Daniel Veillard42595322004-11-08 10:52:06 +000020596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020597}
20598
20599
20600static int
20601test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020603
20604 int mem_base;
20605 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020606 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020607 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020608 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020609 int n_content;
20610
20611 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20612 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020614 name = gen_const_xmlChar_ptr(n_name, 0);
20615 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020616
William M. Brackf13f77f2004-11-12 16:03:48 +000020617 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020618 desret_xmlNodePtr(ret_val);
20619 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020620 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20621 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020622 xmlResetLastError();
20623 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020624 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020626 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020627 printf(" %d", n_name);
20628 printf(" %d", n_content);
20629 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020630 }
20631 }
20632 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020633 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020634
Daniel Veillard42595322004-11-08 10:52:06 +000020635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020636}
20637
20638
20639static int
20640test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020642
Daniel Veillarda521d282004-11-09 14:59:59 +000020643#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020644 int mem_base;
20645 xmlAttrPtr ret_val;
20646 xmlNodePtr node; /* the holding node */
20647 int n_node;
20648 xmlChar * name; /* the name of the attribute */
20649 int n_name;
20650 xmlChar * value; /* the value of the attribute */
20651 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020652
Daniel Veillard57b25162004-11-06 14:50:18 +000020653 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20654 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20655 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20656 mem_base = xmlMemBlocks();
20657 node = gen_xmlNodePtr(n_node, 0);
20658 name = gen_const_xmlChar_ptr(n_name, 1);
20659 value = gen_const_xmlChar_ptr(n_value, 2);
20660
William M. Brackf13f77f2004-11-12 16:03:48 +000020661 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020662 desret_xmlAttrPtr(ret_val);
20663 call_tests++;
20664 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020665 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20666 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020667 xmlResetLastError();
20668 if (mem_base != xmlMemBlocks()) {
20669 printf("Leak of %d blocks found in xmlNewProp",
20670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020671 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020672 printf(" %d", n_node);
20673 printf(" %d", n_name);
20674 printf(" %d", n_value);
20675 printf("\n");
20676 }
20677 }
20678 }
20679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020680 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020681#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020682
Daniel Veillard42595322004-11-08 10:52:06 +000020683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020684}
20685
20686
20687static int
20688test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020690
20691 int mem_base;
20692 xmlNodePtr ret_val;
20693 xmlDocPtr doc; /* the document */
20694 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020695 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020696 int n_name;
20697
20698 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20699 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20700 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020701 doc = gen_xmlDocPtr(n_doc, 0);
20702 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020703
William M. Brackf13f77f2004-11-12 16:03:48 +000020704 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020705 desret_xmlNodePtr(ret_val);
20706 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020707 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020708 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020709 xmlResetLastError();
20710 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020711 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020713 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020714 printf(" %d", n_doc);
20715 printf(" %d", n_name);
20716 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020717 }
20718 }
20719 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020720 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020721
Daniel Veillard42595322004-11-08 10:52:06 +000020722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020723}
20724
20725
20726static int
20727test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020729
20730 int mem_base;
20731 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020732 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020733 int n_content;
20734
20735 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020737 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020738
William M. Brackf13f77f2004-11-12 16:03:48 +000020739 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020740 desret_xmlNodePtr(ret_val);
20741 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020742 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020743 xmlResetLastError();
20744 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020745 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020747 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020748 printf(" %d", n_content);
20749 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020750 }
20751 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020752 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020753
Daniel Veillard42595322004-11-08 10:52:06 +000020754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020755}
20756
20757
20758static int
20759test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020761
Daniel Veillarda521d282004-11-09 14:59:59 +000020762#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020763 int mem_base;
20764 xmlNodePtr ret_val;
20765 xmlNodePtr parent; /* the parent node */
20766 int n_parent;
20767 xmlNsPtr ns; /* a namespace if any */
20768 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020769 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020770 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020771 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020772 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020773
Daniel Veillard27f20102004-11-05 11:50:11 +000020774 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20775 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20776 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20777 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20778 mem_base = xmlMemBlocks();
20779 parent = gen_xmlNodePtr(n_parent, 0);
20780 ns = gen_xmlNsPtr(n_ns, 1);
20781 name = gen_const_xmlChar_ptr(n_name, 2);
20782 content = gen_const_xmlChar_ptr(n_content, 3);
20783
William M. Brackf13f77f2004-11-12 16:03:48 +000020784 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020785 desret_xmlNodePtr(ret_val);
20786 call_tests++;
20787 des_xmlNodePtr(n_parent, parent, 0);
20788 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020789 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20790 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020791 xmlResetLastError();
20792 if (mem_base != xmlMemBlocks()) {
20793 printf("Leak of %d blocks found in xmlNewTextChild",
20794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020795 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020796 printf(" %d", n_parent);
20797 printf(" %d", n_ns);
20798 printf(" %d", n_name);
20799 printf(" %d", n_content);
20800 printf("\n");
20801 }
20802 }
20803 }
20804 }
20805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020806 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020807#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020808
Daniel Veillard42595322004-11-08 10:52:06 +000020809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020810}
20811
20812
20813static int
20814test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020816
20817 int mem_base;
20818 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020819 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020820 int n_content;
20821 int len; /* the text len. */
20822 int n_len;
20823
20824 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20825 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020827 content = gen_const_xmlChar_ptr(n_content, 0);
20828 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020829
William M. Brackf13f77f2004-11-12 16:03:48 +000020830 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020831 desret_xmlNodePtr(ret_val);
20832 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020833 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020834 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020835 xmlResetLastError();
20836 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020837 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020839 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020840 printf(" %d", n_content);
20841 printf(" %d", n_len);
20842 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020843 }
20844 }
20845 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020846 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020847
Daniel Veillard42595322004-11-08 10:52:06 +000020848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020849}
20850
20851
20852static int
20853test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020855
20856 int mem_base;
20857 xmlNodePtr cur; /* the node being modified */
20858 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020859 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020860 int n_content;
20861
20862 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20863 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020865 cur = gen_xmlNodePtr(n_cur, 0);
20866 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020867
William M. Brackf13f77f2004-11-12 16:03:48 +000020868 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020870 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020871 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020872 xmlResetLastError();
20873 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020874 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020876 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020877 printf(" %d", n_cur);
20878 printf(" %d", n_content);
20879 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020880 }
20881 }
20882 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020883 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020884
Daniel Veillard42595322004-11-08 10:52:06 +000020885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020886}
20887
20888
20889static int
20890test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020892
20893 int mem_base;
20894 xmlNodePtr cur; /* the node being modified */
20895 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020896 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020897 int n_content;
20898 int len; /* the size of @content */
20899 int n_len;
20900
20901 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20902 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20903 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020905 cur = gen_xmlNodePtr(n_cur, 0);
20906 content = gen_const_xmlChar_ptr(n_content, 1);
20907 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020908
William M. Brackf13f77f2004-11-12 16:03:48 +000020909 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020910 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020911 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020912 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020913 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020914 xmlResetLastError();
20915 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020916 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020918 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020919 printf(" %d", n_cur);
20920 printf(" %d", n_content);
20921 printf(" %d", n_len);
20922 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020923 }
20924 }
20925 }
20926 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020928
Daniel Veillard42595322004-11-08 10:52:06 +000020929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020930}
20931
20932
20933static int
20934test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020936
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020937 int mem_base;
20938 int ret_val;
20939 xmlBufferPtr buffer; /* a buffer */
20940 int n_buffer;
20941 xmlNodePtr cur; /* the node being read */
20942 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020943
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020944 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20945 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020947 buffer = gen_xmlBufferPtr(n_buffer, 0);
20948 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020949
20950 ret_val = xmlNodeBufGetContent(buffer, cur);
20951 desret_int(ret_val);
20952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020953 des_xmlBufferPtr(n_buffer, buffer, 0);
20954 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020955 xmlResetLastError();
20956 if (mem_base != xmlMemBlocks()) {
20957 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020959 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020960 printf(" %d", n_buffer);
20961 printf(" %d", n_cur);
20962 printf("\n");
20963 }
20964 }
20965 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020966 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020967
Daniel Veillard42595322004-11-08 10:52:06 +000020968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020969}
20970
20971
20972static int
20973test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020975
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020976#ifdef LIBXML_OUTPUT_ENABLED
20977 int mem_base;
20978 int ret_val;
20979 xmlBufferPtr buf; /* the XML buffer output */
20980 int n_buf;
20981 xmlDocPtr doc; /* the document */
20982 int n_doc;
20983 xmlNodePtr cur; /* the current node */
20984 int n_cur;
20985 int level; /* the imbrication level for indenting */
20986 int n_level;
20987 int format; /* is formatting allowed */
20988 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020989
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020990 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
20991 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20992 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20993 for (n_level = 0;n_level < gen_nb_int;n_level++) {
20994 for (n_format = 0;n_format < gen_nb_int;n_format++) {
20995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020996 buf = gen_xmlBufferPtr(n_buf, 0);
20997 doc = gen_xmlDocPtr(n_doc, 1);
20998 cur = gen_xmlNodePtr(n_cur, 2);
20999 level = gen_int(n_level, 3);
21000 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021001
21002 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21003 desret_int(ret_val);
21004 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021005 des_xmlBufferPtr(n_buf, buf, 0);
21006 des_xmlDocPtr(n_doc, doc, 1);
21007 des_xmlNodePtr(n_cur, cur, 2);
21008 des_int(n_level, level, 3);
21009 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021010 xmlResetLastError();
21011 if (mem_base != xmlMemBlocks()) {
21012 printf("Leak of %d blocks found in xmlNodeDump",
21013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021014 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021015 printf(" %d", n_buf);
21016 printf(" %d", n_doc);
21017 printf(" %d", n_cur);
21018 printf(" %d", n_level);
21019 printf(" %d", n_format);
21020 printf("\n");
21021 }
21022 }
21023 }
21024 }
21025 }
21026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021027 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021028#endif
21029
Daniel Veillard42595322004-11-08 10:52:06 +000021030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021031}
21032
21033
21034static int
21035test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021037
Daniel Veillard3d97e662004-11-04 10:49:00 +000021038#ifdef LIBXML_OUTPUT_ENABLED
21039 int mem_base;
21040 xmlOutputBufferPtr buf; /* the XML buffer output */
21041 int n_buf;
21042 xmlDocPtr doc; /* the document */
21043 int n_doc;
21044 xmlNodePtr cur; /* the current node */
21045 int n_cur;
21046 int level; /* the imbrication level for indenting */
21047 int n_level;
21048 int format; /* is formatting allowed */
21049 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021050 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021051 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021052
Daniel Veillard3d97e662004-11-04 10:49:00 +000021053 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21054 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21055 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21056 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21057 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21058 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21059 mem_base = xmlMemBlocks();
21060 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21061 doc = gen_xmlDocPtr(n_doc, 1);
21062 cur = gen_xmlNodePtr(n_cur, 2);
21063 level = gen_int(n_level, 3);
21064 format = gen_int(n_format, 4);
21065 encoding = gen_const_char_ptr(n_encoding, 5);
21066
William M. Brackf13f77f2004-11-12 16:03:48 +000021067 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021068 call_tests++;
21069 des_xmlOutputBufferPtr(n_buf, buf, 0);
21070 des_xmlDocPtr(n_doc, doc, 1);
21071 des_xmlNodePtr(n_cur, cur, 2);
21072 des_int(n_level, level, 3);
21073 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021074 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021075 xmlResetLastError();
21076 if (mem_base != xmlMemBlocks()) {
21077 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021079 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021080 printf(" %d", n_buf);
21081 printf(" %d", n_doc);
21082 printf(" %d", n_cur);
21083 printf(" %d", n_level);
21084 printf(" %d", n_format);
21085 printf(" %d", n_encoding);
21086 printf("\n");
21087 }
21088 }
21089 }
21090 }
21091 }
21092 }
21093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021094 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021095#endif
21096
Daniel Veillard42595322004-11-08 10:52:06 +000021097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021098}
21099
21100
21101static int
21102test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021104
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021105 int mem_base;
21106 xmlChar * ret_val;
21107 xmlDocPtr doc; /* the document the node pertains to */
21108 int n_doc;
21109 xmlNodePtr cur; /* the node being checked */
21110 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021111
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021112 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21113 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21114 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021115 doc = gen_xmlDocPtr(n_doc, 0);
21116 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021117
21118 ret_val = xmlNodeGetBase(doc, cur);
21119 desret_xmlChar_ptr(ret_val);
21120 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021121 des_xmlDocPtr(n_doc, doc, 0);
21122 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021123 xmlResetLastError();
21124 if (mem_base != xmlMemBlocks()) {
21125 printf("Leak of %d blocks found in xmlNodeGetBase",
21126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021127 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021128 printf(" %d", n_doc);
21129 printf(" %d", n_cur);
21130 printf("\n");
21131 }
21132 }
21133 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021134 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021135
Daniel Veillard42595322004-11-08 10:52:06 +000021136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021137}
21138
21139
21140static int
21141test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021143
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021144 int mem_base;
21145 xmlChar * ret_val;
21146 xmlNodePtr cur; /* the node being read */
21147 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021148
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021149 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21150 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021151 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021152
21153 ret_val = xmlNodeGetContent(cur);
21154 desret_xmlChar_ptr(ret_val);
21155 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021156 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021157 xmlResetLastError();
21158 if (mem_base != xmlMemBlocks()) {
21159 printf("Leak of %d blocks found in xmlNodeGetContent",
21160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021161 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021162 printf(" %d", n_cur);
21163 printf("\n");
21164 }
21165 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021166 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021167
Daniel Veillard42595322004-11-08 10:52:06 +000021168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021169}
21170
21171
21172static int
21173test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021175
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021176 int mem_base;
21177 xmlChar * ret_val;
21178 xmlNodePtr cur; /* the node being checked */
21179 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021180
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021181 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21182 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021183 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021184
21185 ret_val = xmlNodeGetLang(cur);
21186 desret_xmlChar_ptr(ret_val);
21187 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021188 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021189 xmlResetLastError();
21190 if (mem_base != xmlMemBlocks()) {
21191 printf("Leak of %d blocks found in xmlNodeGetLang",
21192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021193 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021194 printf(" %d", n_cur);
21195 printf("\n");
21196 }
21197 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021198 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021199
Daniel Veillard42595322004-11-08 10:52:06 +000021200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021201}
21202
21203
21204static int
21205test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021207
21208 int mem_base;
21209 int ret_val;
21210 xmlNodePtr cur; /* the node being checked */
21211 int n_cur;
21212
21213 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021215 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021216
21217 ret_val = xmlNodeGetSpacePreserve(cur);
21218 desret_int(ret_val);
21219 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021220 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021221 xmlResetLastError();
21222 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021223 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021225 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021226 printf(" %d", n_cur);
21227 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021228 }
21229 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021230 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021231
Daniel Veillard42595322004-11-08 10:52:06 +000021232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021233}
21234
21235
21236static int
21237test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021239
21240 int mem_base;
21241 int ret_val;
21242 xmlNodePtr node; /* the node */
21243 int n_node;
21244
21245 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21246 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021247 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021248
21249 ret_val = xmlNodeIsText(node);
21250 desret_int(ret_val);
21251 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021252 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021253 xmlResetLastError();
21254 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021255 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021257 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021258 printf(" %d", n_node);
21259 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021260 }
21261 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021262 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021263
Daniel Veillard42595322004-11-08 10:52:06 +000021264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021265}
21266
21267
21268static int
21269test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021271
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021272#ifdef LIBXML_TREE_ENABLED
21273 int mem_base;
21274 xmlChar * ret_val;
21275 xmlDocPtr doc; /* the document */
21276 int n_doc;
21277 xmlNodePtr list; /* a Node list */
21278 int n_list;
21279 int inLine; /* should we replace entity contents or show their external form */
21280 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021281
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021282 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21283 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21284 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21285 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021286 doc = gen_xmlDocPtr(n_doc, 0);
21287 list = gen_xmlNodePtr(n_list, 1);
21288 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021289
21290 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21291 desret_xmlChar_ptr(ret_val);
21292 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021293 des_xmlDocPtr(n_doc, doc, 0);
21294 des_xmlNodePtr(n_list, list, 1);
21295 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021296 xmlResetLastError();
21297 if (mem_base != xmlMemBlocks()) {
21298 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021300 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021301 printf(" %d", n_doc);
21302 printf(" %d", n_list);
21303 printf(" %d", n_inLine);
21304 printf("\n");
21305 }
21306 }
21307 }
21308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021309 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021310#endif
21311
Daniel Veillard42595322004-11-08 10:52:06 +000021312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021313}
21314
21315
21316static int
21317test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021319
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021320 int mem_base;
21321 xmlChar * ret_val;
21322 xmlDocPtr doc; /* the document */
21323 int n_doc;
21324 xmlNodePtr list; /* a Node list */
21325 int n_list;
21326 int inLine; /* should we replace entity contents or show their external form */
21327 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021328
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021329 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21330 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21331 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021333 doc = gen_xmlDocPtr(n_doc, 0);
21334 list = gen_xmlNodePtr(n_list, 1);
21335 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021336
21337 ret_val = xmlNodeListGetString(doc, list, inLine);
21338 desret_xmlChar_ptr(ret_val);
21339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021340 des_xmlDocPtr(n_doc, doc, 0);
21341 des_xmlNodePtr(n_list, list, 1);
21342 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021343 xmlResetLastError();
21344 if (mem_base != xmlMemBlocks()) {
21345 printf("Leak of %d blocks found in xmlNodeListGetString",
21346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021347 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021348 printf(" %d", n_doc);
21349 printf(" %d", n_list);
21350 printf(" %d", n_inLine);
21351 printf("\n");
21352 }
21353 }
21354 }
21355 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021357
Daniel Veillard42595322004-11-08 10:52:06 +000021358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021359}
21360
21361
21362static int
21363test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021365
21366#ifdef LIBXML_TREE_ENABLED
21367 int mem_base;
21368 xmlNodePtr cur; /* the node being changed */
21369 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021370 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021371 int n_uri;
21372
21373 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21374 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21375 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021376 cur = gen_xmlNodePtr(n_cur, 0);
21377 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021378
William M. Brackf13f77f2004-11-12 16:03:48 +000021379 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021380 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021381 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021382 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021383 xmlResetLastError();
21384 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021385 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021387 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021388 printf(" %d", n_cur);
21389 printf(" %d", n_uri);
21390 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021391 }
21392 }
21393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021394 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021395#endif
21396
Daniel Veillard42595322004-11-08 10:52:06 +000021397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021398}
21399
21400
21401static int
21402test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021404
21405 int mem_base;
21406 xmlNodePtr cur; /* the node being modified */
21407 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021408 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021409 int n_content;
21410
21411 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21412 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21413 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021414 cur = gen_xmlNodePtr(n_cur, 0);
21415 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021416
William M. Brackf13f77f2004-11-12 16:03:48 +000021417 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021418 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021419 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021420 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021421 xmlResetLastError();
21422 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021423 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021425 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021426 printf(" %d", n_cur);
21427 printf(" %d", n_content);
21428 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429 }
21430 }
21431 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021433
Daniel Veillard42595322004-11-08 10:52:06 +000021434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021435}
21436
21437
21438static int
21439test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021441
21442#ifdef LIBXML_TREE_ENABLED
21443 int mem_base;
21444 xmlNodePtr cur; /* the node being modified */
21445 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021446 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021447 int n_content;
21448 int len; /* the size of @content */
21449 int n_len;
21450
21451 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21452 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21453 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21454 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021455 cur = gen_xmlNodePtr(n_cur, 0);
21456 content = gen_const_xmlChar_ptr(n_content, 1);
21457 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021458
William M. Brackf13f77f2004-11-12 16:03:48 +000021459 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021461 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021462 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021463 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021464 xmlResetLastError();
21465 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021466 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021468 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021469 printf(" %d", n_cur);
21470 printf(" %d", n_content);
21471 printf(" %d", n_len);
21472 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021473 }
21474 }
21475 }
21476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021477 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021478#endif
21479
Daniel Veillard42595322004-11-08 10:52:06 +000021480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021481}
21482
21483
21484static int
21485test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021487
21488#ifdef LIBXML_TREE_ENABLED
21489 int mem_base;
21490 xmlNodePtr cur; /* the node being changed */
21491 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021492 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021493 int n_lang;
21494
21495 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21496 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021498 cur = gen_xmlNodePtr(n_cur, 0);
21499 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021500
William M. Brackf13f77f2004-11-12 16:03:48 +000021501 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021502 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021503 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021504 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021505 xmlResetLastError();
21506 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021507 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021509 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021510 printf(" %d", n_cur);
21511 printf(" %d", n_lang);
21512 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513 }
21514 }
21515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021516 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021517#endif
21518
Daniel Veillard42595322004-11-08 10:52:06 +000021519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021520}
21521
21522
21523static int
21524test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021526
21527#ifdef LIBXML_TREE_ENABLED
21528 int mem_base;
21529 xmlNodePtr cur; /* the node being changed */
21530 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021531 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021532 int n_name;
21533
21534 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21535 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21536 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021537 cur = gen_xmlNodePtr(n_cur, 0);
21538 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021539
William M. Brackf13f77f2004-11-12 16:03:48 +000021540 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021541 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021542 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021543 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021544 xmlResetLastError();
21545 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021546 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021548 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021549 printf(" %d", n_cur);
21550 printf(" %d", n_name);
21551 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021552 }
21553 }
21554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021555 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021556#endif
21557
Daniel Veillard42595322004-11-08 10:52:06 +000021558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021559}
21560
21561
21562static int
21563test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021565
21566#ifdef LIBXML_TREE_ENABLED
21567 int mem_base;
21568 xmlNodePtr cur; /* the node being changed */
21569 int n_cur;
21570 int val; /* the xml:space value ("0": default, 1: "preserve") */
21571 int n_val;
21572
21573 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21574 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21575 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021576 cur = gen_xmlNodePtr(n_cur, 0);
21577 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021578
21579 xmlNodeSetSpacePreserve(cur, val);
21580 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021581 des_xmlNodePtr(n_cur, cur, 0);
21582 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021583 xmlResetLastError();
21584 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021585 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021587 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021588 printf(" %d", n_cur);
21589 printf(" %d", n_val);
21590 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591 }
21592 }
21593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021594 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021595#endif
21596
Daniel Veillard42595322004-11-08 10:52:06 +000021597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021598}
21599
21600
21601static int
21602test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021604
Daniel Veillarda521d282004-11-09 14:59:59 +000021605#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606 int mem_base;
21607 int ret_val;
21608 xmlDocPtr doc; /* the document */
21609 int n_doc;
21610 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21611 int n_tree;
21612
21613 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21614 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21615 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021616 doc = gen_xmlDocPtr(n_doc, 0);
21617 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021618
21619 ret_val = xmlReconciliateNs(doc, tree);
21620 desret_int(ret_val);
21621 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021622 des_xmlDocPtr(n_doc, doc, 0);
21623 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021624 xmlResetLastError();
21625 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021626 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021627 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021628 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021629 printf(" %d", n_doc);
21630 printf(" %d", n_tree);
21631 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021632 }
21633 }
21634 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021635 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021636#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021637
Daniel Veillard42595322004-11-08 10:52:06 +000021638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021639}
21640
21641
21642static int
21643test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021645
Daniel Veillardce244ad2004-11-05 10:03:46 +000021646#ifdef LIBXML_TREE_ENABLED
21647 int mem_base;
21648 int ret_val;
21649 xmlAttrPtr cur; /* an attribute */
21650 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021651
Daniel Veillardce244ad2004-11-05 10:03:46 +000021652 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21653 mem_base = xmlMemBlocks();
21654 cur = gen_xmlAttrPtr(n_cur, 0);
21655
21656 ret_val = xmlRemoveProp(cur);
21657 cur = NULL;
21658 desret_int(ret_val);
21659 call_tests++;
21660 des_xmlAttrPtr(n_cur, cur, 0);
21661 xmlResetLastError();
21662 if (mem_base != xmlMemBlocks()) {
21663 printf("Leak of %d blocks found in xmlRemoveProp",
21664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021665 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021666 printf(" %d", n_cur);
21667 printf("\n");
21668 }
21669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021670 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021671#endif
21672
Daniel Veillard42595322004-11-08 10:52:06 +000021673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021674}
21675
21676
21677static int
21678test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021680
21681#ifdef LIBXML_TREE_ENABLED
21682 int mem_base;
21683 xmlNodePtr ret_val;
21684 xmlNodePtr old; /* the old node */
21685 int n_old;
21686 xmlNodePtr cur; /* the node */
21687 int n_cur;
21688
21689 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021690 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021692 old = gen_xmlNodePtr(n_old, 0);
21693 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021694
21695 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021696 if (cur != NULL) {
21697 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021698 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021699 if (old != NULL) {
21700 xmlUnlinkNode(old);
21701 xmlFreeNode(old) ; old = NULL ; }
21702 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021703 desret_xmlNodePtr(ret_val);
21704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021705 des_xmlNodePtr(n_old, old, 0);
21706 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021707 xmlResetLastError();
21708 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021709 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021711 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021712 printf(" %d", n_old);
21713 printf(" %d", n_cur);
21714 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021715 }
21716 }
21717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021718 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021719#endif
21720
Daniel Veillard42595322004-11-08 10:52:06 +000021721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021722}
21723
21724
21725static int
21726test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021728
21729#ifdef LIBXML_OUTPUT_ENABLED
21730 int mem_base;
21731 int ret_val;
21732 const char * filename; /* the filename (or URL) */
21733 int n_filename;
21734 xmlDocPtr cur; /* the document */
21735 int n_cur;
21736
21737 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21738 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21739 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021740 filename = gen_fileoutput(n_filename, 0);
21741 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021742
21743 ret_val = xmlSaveFile(filename, cur);
21744 desret_int(ret_val);
21745 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021746 des_fileoutput(n_filename, filename, 0);
21747 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021748 xmlResetLastError();
21749 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021750 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021752 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021753 printf(" %d", n_filename);
21754 printf(" %d", n_cur);
21755 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021756 }
21757 }
21758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021759 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021760#endif
21761
Daniel Veillard42595322004-11-08 10:52:06 +000021762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021763}
21764
21765
21766static int
21767test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021769
21770#ifdef LIBXML_OUTPUT_ENABLED
21771 int mem_base;
21772 int ret_val;
21773 const char * filename; /* the filename (or URL) */
21774 int n_filename;
21775 xmlDocPtr cur; /* the document */
21776 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021777 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021778 int n_encoding;
21779
21780 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21781 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21782 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021784 filename = gen_fileoutput(n_filename, 0);
21785 cur = gen_xmlDocPtr(n_cur, 1);
21786 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021787
William M. Brackf13f77f2004-11-12 16:03:48 +000021788 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021789 desret_int(ret_val);
21790 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021791 des_fileoutput(n_filename, filename, 0);
21792 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021793 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021794 xmlResetLastError();
21795 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021796 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021798 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021799 printf(" %d", n_filename);
21800 printf(" %d", n_cur);
21801 printf(" %d", n_encoding);
21802 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021803 }
21804 }
21805 }
21806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021807 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021808#endif
21809
Daniel Veillard42595322004-11-08 10:52:06 +000021810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021811}
21812
21813
21814static int
21815test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021817
Daniel Veillard3d97e662004-11-04 10:49:00 +000021818#ifdef LIBXML_OUTPUT_ENABLED
21819 int mem_base;
21820 int ret_val;
21821 xmlOutputBufferPtr buf; /* an output I/O buffer */
21822 int n_buf;
21823 xmlDocPtr cur; /* the document */
21824 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021825 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021826 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021827
Daniel Veillard3d97e662004-11-04 10:49:00 +000021828 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21829 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21830 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21831 mem_base = xmlMemBlocks();
21832 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21833 cur = gen_xmlDocPtr(n_cur, 1);
21834 encoding = gen_const_char_ptr(n_encoding, 2);
21835
William M. Brackf13f77f2004-11-12 16:03:48 +000021836 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021837 buf = NULL;
21838 desret_int(ret_val);
21839 call_tests++;
21840 des_xmlOutputBufferPtr(n_buf, buf, 0);
21841 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021842 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021843 xmlResetLastError();
21844 if (mem_base != xmlMemBlocks()) {
21845 printf("Leak of %d blocks found in xmlSaveFileTo",
21846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021847 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021848 printf(" %d", n_buf);
21849 printf(" %d", n_cur);
21850 printf(" %d", n_encoding);
21851 printf("\n");
21852 }
21853 }
21854 }
21855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021856 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +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_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021866
21867#ifdef LIBXML_OUTPUT_ENABLED
21868 int mem_base;
21869 int ret_val;
21870 const char * filename; /* the filename (or URL) */
21871 int n_filename;
21872 xmlDocPtr cur; /* the document */
21873 int n_cur;
21874 int format; /* should formatting spaces been added */
21875 int n_format;
21876
21877 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21878 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21879 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21880 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021881 filename = gen_fileoutput(n_filename, 0);
21882 cur = gen_xmlDocPtr(n_cur, 1);
21883 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021884
21885 ret_val = xmlSaveFormatFile(filename, cur, format);
21886 desret_int(ret_val);
21887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021888 des_fileoutput(n_filename, filename, 0);
21889 des_xmlDocPtr(n_cur, cur, 1);
21890 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021891 xmlResetLastError();
21892 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021893 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021895 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021896 printf(" %d", n_filename);
21897 printf(" %d", n_cur);
21898 printf(" %d", n_format);
21899 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021900 }
21901 }
21902 }
21903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021904 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021905#endif
21906
Daniel Veillard42595322004-11-08 10:52:06 +000021907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021908}
21909
21910
21911static int
21912test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021914
21915#ifdef LIBXML_OUTPUT_ENABLED
21916 int mem_base;
21917 int ret_val;
21918 const char * filename; /* the filename or URL to output */
21919 int n_filename;
21920 xmlDocPtr cur; /* the document being saved */
21921 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021922 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021923 int n_encoding;
21924 int format; /* should formatting spaces be added. */
21925 int n_format;
21926
21927 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21928 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21929 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21930 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21931 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021932 filename = gen_fileoutput(n_filename, 0);
21933 cur = gen_xmlDocPtr(n_cur, 1);
21934 encoding = gen_const_char_ptr(n_encoding, 2);
21935 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021936
William M. Brackf13f77f2004-11-12 16:03:48 +000021937 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021938 desret_int(ret_val);
21939 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021940 des_fileoutput(n_filename, filename, 0);
21941 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021942 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021943 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021944 xmlResetLastError();
21945 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021946 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021948 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021949 printf(" %d", n_filename);
21950 printf(" %d", n_cur);
21951 printf(" %d", n_encoding);
21952 printf(" %d", n_format);
21953 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021954 }
21955 }
21956 }
21957 }
21958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021959 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021960#endif
21961
Daniel Veillard42595322004-11-08 10:52:06 +000021962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021963}
21964
21965
21966static int
21967test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021969
Daniel Veillard3d97e662004-11-04 10:49:00 +000021970#ifdef LIBXML_OUTPUT_ENABLED
21971 int mem_base;
21972 int ret_val;
21973 xmlOutputBufferPtr buf; /* an output I/O buffer */
21974 int n_buf;
21975 xmlDocPtr cur; /* the document */
21976 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021977 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021978 int n_encoding;
21979 int format; /* should formatting spaces been added */
21980 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021981
Daniel Veillard3d97e662004-11-04 10:49:00 +000021982 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21983 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21984 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21985 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21986 mem_base = xmlMemBlocks();
21987 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21988 cur = gen_xmlDocPtr(n_cur, 1);
21989 encoding = gen_const_char_ptr(n_encoding, 2);
21990 format = gen_int(n_format, 3);
21991
William M. Brackf13f77f2004-11-12 16:03:48 +000021992 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021993 buf = NULL;
21994 desret_int(ret_val);
21995 call_tests++;
21996 des_xmlOutputBufferPtr(n_buf, buf, 0);
21997 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021998 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021999 des_int(n_format, format, 3);
22000 xmlResetLastError();
22001 if (mem_base != xmlMemBlocks()) {
22002 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022004 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022005 printf(" %d", n_buf);
22006 printf(" %d", n_cur);
22007 printf(" %d", n_encoding);
22008 printf(" %d", n_format);
22009 printf("\n");
22010 }
22011 }
22012 }
22013 }
22014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022015 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022016#endif
22017
Daniel Veillard42595322004-11-08 10:52:06 +000022018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022019}
22020
22021
22022static int
22023test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022025
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022026 int mem_base;
22027 xmlNsPtr ret_val;
22028 xmlDocPtr doc; /* the document */
22029 int n_doc;
22030 xmlNodePtr node; /* the current node */
22031 int n_node;
22032 xmlChar * nameSpace; /* the namespace prefix */
22033 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022034
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022035 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22036 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22037 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22038 mem_base = xmlMemBlocks();
22039 doc = gen_xmlDocPtr(n_doc, 0);
22040 node = gen_xmlNodePtr(n_node, 1);
22041 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22042
William M. Brackf13f77f2004-11-12 16:03:48 +000022043 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022044 desret_xmlNsPtr(ret_val);
22045 call_tests++;
22046 des_xmlDocPtr(n_doc, doc, 0);
22047 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022048 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022049 xmlResetLastError();
22050 if (mem_base != xmlMemBlocks()) {
22051 printf("Leak of %d blocks found in xmlSearchNs",
22052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022053 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022054 printf(" %d", n_doc);
22055 printf(" %d", n_node);
22056 printf(" %d", n_nameSpace);
22057 printf("\n");
22058 }
22059 }
22060 }
22061 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022062 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022063
Daniel Veillard42595322004-11-08 10:52:06 +000022064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022065}
22066
22067
22068static int
22069test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022071
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022072 int mem_base;
22073 xmlNsPtr ret_val;
22074 xmlDocPtr doc; /* the document */
22075 int n_doc;
22076 xmlNodePtr node; /* the current node */
22077 int n_node;
22078 xmlChar * href; /* the namespace value */
22079 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022080
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022081 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22082 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22083 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22084 mem_base = xmlMemBlocks();
22085 doc = gen_xmlDocPtr(n_doc, 0);
22086 node = gen_xmlNodePtr(n_node, 1);
22087 href = gen_const_xmlChar_ptr(n_href, 2);
22088
William M. Brackf13f77f2004-11-12 16:03:48 +000022089 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022090 desret_xmlNsPtr(ret_val);
22091 call_tests++;
22092 des_xmlDocPtr(n_doc, doc, 0);
22093 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022094 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022095 xmlResetLastError();
22096 if (mem_base != xmlMemBlocks()) {
22097 printf("Leak of %d blocks found in xmlSearchNsByHref",
22098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022099 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022100 printf(" %d", n_doc);
22101 printf(" %d", n_node);
22102 printf(" %d", n_href);
22103 printf("\n");
22104 }
22105 }
22106 }
22107 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022109
Daniel Veillard42595322004-11-08 10:52:06 +000022110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022111}
22112
22113
22114static int
22115test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022117
Daniel Veillard57b25162004-11-06 14:50:18 +000022118 int mem_base;
22119 xmlBufferAllocationScheme scheme; /* allocation method to use */
22120 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022121
Daniel Veillard57b25162004-11-06 14:50:18 +000022122 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22123 mem_base = xmlMemBlocks();
22124 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22125
22126 xmlSetBufferAllocationScheme(scheme);
22127 call_tests++;
22128 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22129 xmlResetLastError();
22130 if (mem_base != xmlMemBlocks()) {
22131 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022133 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022134 printf(" %d", n_scheme);
22135 printf("\n");
22136 }
22137 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022138 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022139
Daniel Veillard42595322004-11-08 10:52:06 +000022140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022141}
22142
22143
22144static int
22145test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022147
22148 int mem_base;
22149 int mode; /* the compression ratio */
22150 int n_mode;
22151
22152 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022154 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022155
22156 xmlSetCompressMode(mode);
22157 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022158 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022159 xmlResetLastError();
22160 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022161 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022163 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022164 printf(" %d", n_mode);
22165 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022166 }
22167 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022168 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022169
Daniel Veillard42595322004-11-08 10:52:06 +000022170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022171}
22172
22173
22174static int
22175test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022177
22178 int mem_base;
22179 xmlDocPtr doc; /* the document */
22180 int n_doc;
22181 int mode; /* the compression ratio */
22182 int n_mode;
22183
22184 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22185 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22186 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022187 doc = gen_xmlDocPtr(n_doc, 0);
22188 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022189
22190 xmlSetDocCompressMode(doc, mode);
22191 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022192 des_xmlDocPtr(n_doc, doc, 0);
22193 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022194 xmlResetLastError();
22195 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022196 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022198 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022199 printf(" %d", n_doc);
22200 printf(" %d", n_mode);
22201 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022202 }
22203 }
22204 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022205 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022206
Daniel Veillard42595322004-11-08 10:52:06 +000022207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022208}
22209
22210
22211static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022212test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022214
Daniel Veillard27f20102004-11-05 11:50:11 +000022215 int mem_base;
22216 xmlNodePtr node; /* a node in the document */
22217 int n_node;
22218 xmlNsPtr ns; /* a namespace pointer */
22219 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022220
Daniel Veillard27f20102004-11-05 11:50:11 +000022221 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22222 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22223 mem_base = xmlMemBlocks();
22224 node = gen_xmlNodePtr(n_node, 0);
22225 ns = gen_xmlNsPtr(n_ns, 1);
22226
22227 xmlSetNs(node, ns);
22228 call_tests++;
22229 des_xmlNodePtr(n_node, node, 0);
22230 des_xmlNsPtr(n_ns, ns, 1);
22231 xmlResetLastError();
22232 if (mem_base != xmlMemBlocks()) {
22233 printf("Leak of %d blocks found in xmlSetNs",
22234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022235 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022236 printf(" %d", n_node);
22237 printf(" %d", n_ns);
22238 printf("\n");
22239 }
22240 }
22241 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022243
Daniel Veillard42595322004-11-08 10:52:06 +000022244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022245}
22246
22247
22248static int
22249test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022251
Daniel Veillard57b25162004-11-06 14:50:18 +000022252#ifdef LIBXML_TREE_ENABLED
22253 int mem_base;
22254 xmlAttrPtr ret_val;
22255 xmlNodePtr node; /* the node */
22256 int n_node;
22257 xmlNsPtr ns; /* the namespace definition */
22258 int n_ns;
22259 xmlChar * name; /* the attribute name */
22260 int n_name;
22261 xmlChar * value; /* the attribute value */
22262 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022263
Daniel Veillard57b25162004-11-06 14:50:18 +000022264 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22265 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22266 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22267 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22268 mem_base = xmlMemBlocks();
22269 node = gen_xmlNodePtr(n_node, 0);
22270 ns = gen_xmlNsPtr(n_ns, 1);
22271 name = gen_const_xmlChar_ptr(n_name, 2);
22272 value = gen_const_xmlChar_ptr(n_value, 3);
22273
William M. Brackf13f77f2004-11-12 16:03:48 +000022274 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022275 desret_xmlAttrPtr(ret_val);
22276 call_tests++;
22277 des_xmlNodePtr(n_node, node, 0);
22278 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022279 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22280 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022281 xmlResetLastError();
22282 if (mem_base != xmlMemBlocks()) {
22283 printf("Leak of %d blocks found in xmlSetNsProp",
22284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022285 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022286 printf(" %d", n_node);
22287 printf(" %d", n_ns);
22288 printf(" %d", n_name);
22289 printf(" %d", n_value);
22290 printf("\n");
22291 }
22292 }
22293 }
22294 }
22295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022296 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022297#endif
22298
Daniel Veillard42595322004-11-08 10:52:06 +000022299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022300}
22301
22302
22303static int
22304test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022306
Daniel Veillard57b25162004-11-06 14:50:18 +000022307#ifdef LIBXML_TREE_ENABLED
22308 int mem_base;
22309 xmlAttrPtr ret_val;
22310 xmlNodePtr node; /* the node */
22311 int n_node;
22312 xmlChar * name; /* the attribute name */
22313 int n_name;
22314 xmlChar * value; /* the attribute value */
22315 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022316
Daniel Veillard57b25162004-11-06 14:50:18 +000022317 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22318 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22319 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22320 mem_base = xmlMemBlocks();
22321 node = gen_xmlNodePtr(n_node, 0);
22322 name = gen_const_xmlChar_ptr(n_name, 1);
22323 value = gen_const_xmlChar_ptr(n_value, 2);
22324
William M. Brackf13f77f2004-11-12 16:03:48 +000022325 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022326 desret_xmlAttrPtr(ret_val);
22327 call_tests++;
22328 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022329 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22330 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022331 xmlResetLastError();
22332 if (mem_base != xmlMemBlocks()) {
22333 printf("Leak of %d blocks found in xmlSetProp",
22334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022335 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022336 printf(" %d", n_node);
22337 printf(" %d", n_name);
22338 printf(" %d", n_value);
22339 printf("\n");
22340 }
22341 }
22342 }
22343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022344 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022345#endif
22346
Daniel Veillard42595322004-11-08 10:52:06 +000022347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022348}
22349
22350
22351static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022352test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022354
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022355 int mem_base;
22356 xmlChar * ret_val;
22357 xmlChar * name; /* the full QName */
22358 int n_name;
22359 xmlChar ** prefix; /* a xmlChar ** */
22360 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022361
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022362 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22363 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22364 mem_base = xmlMemBlocks();
22365 name = gen_const_xmlChar_ptr(n_name, 0);
22366 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22367
William M. Brackf13f77f2004-11-12 16:03:48 +000022368 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022369 desret_xmlChar_ptr(ret_val);
22370 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022371 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022372 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22373 xmlResetLastError();
22374 if (mem_base != xmlMemBlocks()) {
22375 printf("Leak of %d blocks found in xmlSplitQName2",
22376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022377 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022378 printf(" %d", n_name);
22379 printf(" %d", n_prefix);
22380 printf("\n");
22381 }
22382 }
22383 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022384 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022385
Daniel Veillard42595322004-11-08 10:52:06 +000022386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022387}
22388
22389
22390static int
22391test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022393
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022394 int mem_base;
22395 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022396 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022397 int n_name;
22398 int * len; /* an int * */
22399 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022400
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022401 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22402 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22403 mem_base = xmlMemBlocks();
22404 name = gen_const_xmlChar_ptr(n_name, 0);
22405 len = gen_int_ptr(n_len, 1);
22406
William M. Brackf13f77f2004-11-12 16:03:48 +000022407 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022408 desret_const_xmlChar_ptr(ret_val);
22409 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022410 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022411 des_int_ptr(n_len, len, 1);
22412 xmlResetLastError();
22413 if (mem_base != xmlMemBlocks()) {
22414 printf("Leak of %d blocks found in xmlSplitQName3",
22415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022416 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022417 printf(" %d", n_name);
22418 printf(" %d", n_len);
22419 printf("\n");
22420 }
22421 }
22422 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022423 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022424
Daniel Veillard42595322004-11-08 10:52:06 +000022425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022426}
22427
22428
22429static int
22430test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022432
22433 int mem_base;
22434 xmlNodePtr ret_val;
22435 xmlDocPtr doc; /* the document */
22436 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022437 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022438 int n_value;
22439
22440 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22441 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22442 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022443 doc = gen_xmlDocPtr(n_doc, 0);
22444 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022445
William M. Brackf13f77f2004-11-12 16:03:48 +000022446 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022447 desret_xmlNodePtr(ret_val);
22448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022449 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022450 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022451 xmlResetLastError();
22452 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022453 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022455 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022456 printf(" %d", n_doc);
22457 printf(" %d", n_value);
22458 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022459 }
22460 }
22461 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022462 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022463
Daniel Veillard42595322004-11-08 10:52:06 +000022464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022465}
22466
22467
22468static int
22469test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022471
22472 int mem_base;
22473 xmlNodePtr ret_val;
22474 xmlDocPtr doc; /* the document */
22475 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022476 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022477 int n_value;
22478 int len; /* the length of the string value */
22479 int n_len;
22480
22481 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22482 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22483 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22484 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022485 doc = gen_xmlDocPtr(n_doc, 0);
22486 value = gen_const_xmlChar_ptr(n_value, 1);
22487 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022488
William M. Brackf13f77f2004-11-12 16:03:48 +000022489 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022490 desret_xmlNodePtr(ret_val);
22491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022492 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022493 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022494 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022495 xmlResetLastError();
22496 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022497 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022500 printf(" %d", n_doc);
22501 printf(" %d", n_value);
22502 printf(" %d", n_len);
22503 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022504 }
22505 }
22506 }
22507 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022508 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022509
Daniel Veillard42595322004-11-08 10:52:06 +000022510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022511}
22512
22513
22514static int
22515test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022517
22518 int mem_base;
22519 int ret_val;
22520 xmlNodePtr node; /* the node */
22521 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022522 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022523 int n_content;
22524 int len; /* @content length */
22525 int n_len;
22526
22527 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22528 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22529 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22530 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022531 node = gen_xmlNodePtr(n_node, 0);
22532 content = gen_const_xmlChar_ptr(n_content, 1);
22533 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022534
William M. Brackf13f77f2004-11-12 16:03:48 +000022535 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022536 desret_int(ret_val);
22537 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022538 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022539 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022540 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022541 xmlResetLastError();
22542 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022543 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022545 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022546 printf(" %d", n_node);
22547 printf(" %d", n_content);
22548 printf(" %d", n_len);
22549 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022550 }
22551 }
22552 }
22553 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022554 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022555
Daniel Veillard42595322004-11-08 10:52:06 +000022556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022557}
22558
22559
22560static int
22561test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022563
22564 int mem_base;
22565 xmlNodePtr ret_val;
22566 xmlNodePtr first; /* the first text node */
22567 int n_first;
22568 xmlNodePtr second; /* the second text node being merged */
22569 int n_second;
22570
Daniel Veillarda03e3652004-11-02 18:45:30 +000022571 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22572 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022573 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022574 first = gen_xmlNodePtr_in(n_first, 0);
22575 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022576
22577 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022578 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022579 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022580 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022581 desret_xmlNodePtr(ret_val);
22582 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022583 des_xmlNodePtr_in(n_first, first, 0);
22584 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022585 xmlResetLastError();
22586 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022587 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022589 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022590 printf(" %d", n_first);
22591 printf(" %d", n_second);
22592 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022593 }
22594 }
22595 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022596 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022597
Daniel Veillard42595322004-11-08 10:52:06 +000022598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022599}
22600
22601
22602static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022603test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022605
Daniel Veillard27f20102004-11-05 11:50:11 +000022606#ifdef LIBXML_TREE_ENABLED
22607 int mem_base;
22608 int ret_val;
22609 xmlNodePtr node; /* the node */
22610 int n_node;
22611 xmlNsPtr ns; /* the namespace definition */
22612 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022613 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022614 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022615
Daniel Veillard27f20102004-11-05 11:50:11 +000022616 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22617 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22618 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22619 mem_base = xmlMemBlocks();
22620 node = gen_xmlNodePtr(n_node, 0);
22621 ns = gen_xmlNsPtr(n_ns, 1);
22622 name = gen_const_xmlChar_ptr(n_name, 2);
22623
William M. Brackf13f77f2004-11-12 16:03:48 +000022624 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022625 desret_int(ret_val);
22626 call_tests++;
22627 des_xmlNodePtr(n_node, node, 0);
22628 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022629 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022630 xmlResetLastError();
22631 if (mem_base != xmlMemBlocks()) {
22632 printf("Leak of %d blocks found in xmlUnsetNsProp",
22633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022634 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022635 printf(" %d", n_node);
22636 printf(" %d", n_ns);
22637 printf(" %d", n_name);
22638 printf("\n");
22639 }
22640 }
22641 }
22642 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022643 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022644#endif
22645
Daniel Veillard42595322004-11-08 10:52:06 +000022646 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022647}
22648
22649
22650static int
22651test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022653
22654#ifdef LIBXML_TREE_ENABLED
22655 int mem_base;
22656 int ret_val;
22657 xmlNodePtr node; /* the node */
22658 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022659 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022660 int n_name;
22661
22662 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22663 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22664 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022665 node = gen_xmlNodePtr(n_node, 0);
22666 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022667
William M. Brackf13f77f2004-11-12 16:03:48 +000022668 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022669 desret_int(ret_val);
22670 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022671 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022672 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022673 xmlResetLastError();
22674 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022675 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022677 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022678 printf(" %d", n_node);
22679 printf(" %d", n_name);
22680 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022681 }
22682 }
22683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022684 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022685#endif
22686
Daniel Veillard42595322004-11-08 10:52:06 +000022687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022688}
22689
22690
22691static int
22692test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694
Daniel Veillarda521d282004-11-09 14:59:59 +000022695#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022696 int mem_base;
22697 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022698 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022699 int n_value;
22700 int space; /* allow spaces in front and end of the string */
22701 int n_space;
22702
22703 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22704 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022706 value = gen_const_xmlChar_ptr(n_value, 0);
22707 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022708
William M. Brackf13f77f2004-11-12 16:03:48 +000022709 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022710 desret_int(ret_val);
22711 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022712 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022713 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022714 xmlResetLastError();
22715 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022716 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022718 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022719 printf(" %d", n_value);
22720 printf(" %d", n_space);
22721 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022722 }
22723 }
22724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022725 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022726#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022727
Daniel Veillard42595322004-11-08 10:52:06 +000022728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022729}
22730
22731
22732static int
22733test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022735
Daniel Veillarda521d282004-11-09 14:59:59 +000022736#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022737 int mem_base;
22738 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022739 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022740 int n_value;
22741 int space; /* allow spaces in front and end of the string */
22742 int n_space;
22743
22744 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22745 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022747 value = gen_const_xmlChar_ptr(n_value, 0);
22748 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022749
William M. Brackf13f77f2004-11-12 16:03:48 +000022750 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022751 desret_int(ret_val);
22752 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022753 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022754 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022755 xmlResetLastError();
22756 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022757 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022759 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022760 printf(" %d", n_value);
22761 printf(" %d", n_space);
22762 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022763 }
22764 }
22765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022766 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022767#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022768
Daniel Veillard42595322004-11-08 10:52:06 +000022769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022770}
22771
22772
22773static int
22774test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022776
Daniel Veillarda521d282004-11-09 14:59:59 +000022777#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022778 int mem_base;
22779 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022780 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022781 int n_value;
22782 int space; /* allow spaces in front and end of the string */
22783 int n_space;
22784
22785 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22786 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22787 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022788 value = gen_const_xmlChar_ptr(n_value, 0);
22789 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022790
William M. Brackf13f77f2004-11-12 16:03:48 +000022791 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022792 desret_int(ret_val);
22793 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022794 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022795 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022796 xmlResetLastError();
22797 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022798 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022800 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022801 printf(" %d", n_value);
22802 printf(" %d", n_space);
22803 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022804 }
22805 }
22806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022807 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022808#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022809
Daniel Veillard42595322004-11-08 10:52:06 +000022810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022811}
22812
22813
22814static int
22815test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022817
Daniel Veillarda521d282004-11-09 14:59:59 +000022818#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022819 int mem_base;
22820 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022821 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822 int n_value;
22823 int space; /* allow spaces in front and end of the string */
22824 int n_space;
22825
22826 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22827 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22828 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022829 value = gen_const_xmlChar_ptr(n_value, 0);
22830 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022831
William M. Brackf13f77f2004-11-12 16:03:48 +000022832 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022833 desret_int(ret_val);
22834 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022835 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022836 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022837 xmlResetLastError();
22838 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022839 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022841 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022842 printf(" %d", n_value);
22843 printf(" %d", n_space);
22844 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022845 }
22846 }
22847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022848 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022849#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022850
Daniel Veillard42595322004-11-08 10:52:06 +000022851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022852}
22853
22854static int
22855test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022858 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022859 test_ret += test_xmlAddChild();
22860 test_ret += test_xmlAddChildList();
22861 test_ret += test_xmlAddNextSibling();
22862 test_ret += test_xmlAddPrevSibling();
22863 test_ret += test_xmlAddSibling();
22864 test_ret += test_xmlAttrSerializeTxtContent();
22865 test_ret += test_xmlBufferAdd();
22866 test_ret += test_xmlBufferAddHead();
22867 test_ret += test_xmlBufferCCat();
22868 test_ret += test_xmlBufferCat();
22869 test_ret += test_xmlBufferContent();
22870 test_ret += test_xmlBufferCreate();
22871 test_ret += test_xmlBufferCreateSize();
22872 test_ret += test_xmlBufferCreateStatic();
22873 test_ret += test_xmlBufferEmpty();
22874 test_ret += test_xmlBufferGrow();
22875 test_ret += test_xmlBufferLength();
22876 test_ret += test_xmlBufferResize();
22877 test_ret += test_xmlBufferSetAllocationScheme();
22878 test_ret += test_xmlBufferShrink();
22879 test_ret += test_xmlBufferWriteCHAR();
22880 test_ret += test_xmlBufferWriteChar();
22881 test_ret += test_xmlBufferWriteQuotedString();
22882 test_ret += test_xmlBuildQName();
22883 test_ret += test_xmlCopyDoc();
22884 test_ret += test_xmlCopyDtd();
22885 test_ret += test_xmlCopyNamespace();
22886 test_ret += test_xmlCopyNamespaceList();
22887 test_ret += test_xmlCopyNode();
22888 test_ret += test_xmlCopyNodeList();
22889 test_ret += test_xmlCopyProp();
22890 test_ret += test_xmlCopyPropList();
22891 test_ret += test_xmlCreateIntSubset();
22892 test_ret += test_xmlDocCopyNode();
22893 test_ret += test_xmlDocCopyNodeList();
22894 test_ret += test_xmlDocDump();
22895 test_ret += test_xmlDocDumpFormatMemory();
22896 test_ret += test_xmlDocDumpFormatMemoryEnc();
22897 test_ret += test_xmlDocDumpMemory();
22898 test_ret += test_xmlDocDumpMemoryEnc();
22899 test_ret += test_xmlDocFormatDump();
22900 test_ret += test_xmlDocGetRootElement();
22901 test_ret += test_xmlDocSetRootElement();
22902 test_ret += test_xmlElemDump();
22903 test_ret += test_xmlGetBufferAllocationScheme();
22904 test_ret += test_xmlGetCompressMode();
22905 test_ret += test_xmlGetDocCompressMode();
22906 test_ret += test_xmlGetIntSubset();
22907 test_ret += test_xmlGetLastChild();
22908 test_ret += test_xmlGetLineNo();
22909 test_ret += test_xmlGetNoNsProp();
22910 test_ret += test_xmlGetNodePath();
22911 test_ret += test_xmlGetNsList();
22912 test_ret += test_xmlGetNsProp();
22913 test_ret += test_xmlGetProp();
22914 test_ret += test_xmlHasNsProp();
22915 test_ret += test_xmlHasProp();
22916 test_ret += test_xmlIsBlankNode();
22917 test_ret += test_xmlIsXHTML();
22918 test_ret += test_xmlNewCDataBlock();
22919 test_ret += test_xmlNewCharRef();
22920 test_ret += test_xmlNewChild();
22921 test_ret += test_xmlNewComment();
22922 test_ret += test_xmlNewDoc();
22923 test_ret += test_xmlNewDocComment();
22924 test_ret += test_xmlNewDocFragment();
22925 test_ret += test_xmlNewDocNode();
22926 test_ret += test_xmlNewDocNodeEatName();
22927 test_ret += test_xmlNewDocPI();
22928 test_ret += test_xmlNewDocProp();
22929 test_ret += test_xmlNewDocRawNode();
22930 test_ret += test_xmlNewDocText();
22931 test_ret += test_xmlNewDocTextLen();
22932 test_ret += test_xmlNewDtd();
22933 test_ret += test_xmlNewNode();
22934 test_ret += test_xmlNewNodeEatName();
22935 test_ret += test_xmlNewNs();
22936 test_ret += test_xmlNewNsProp();
22937 test_ret += test_xmlNewNsPropEatName();
22938 test_ret += test_xmlNewPI();
22939 test_ret += test_xmlNewProp();
22940 test_ret += test_xmlNewReference();
22941 test_ret += test_xmlNewText();
22942 test_ret += test_xmlNewTextChild();
22943 test_ret += test_xmlNewTextLen();
22944 test_ret += test_xmlNodeAddContent();
22945 test_ret += test_xmlNodeAddContentLen();
22946 test_ret += test_xmlNodeBufGetContent();
22947 test_ret += test_xmlNodeDump();
22948 test_ret += test_xmlNodeDumpOutput();
22949 test_ret += test_xmlNodeGetBase();
22950 test_ret += test_xmlNodeGetContent();
22951 test_ret += test_xmlNodeGetLang();
22952 test_ret += test_xmlNodeGetSpacePreserve();
22953 test_ret += test_xmlNodeIsText();
22954 test_ret += test_xmlNodeListGetRawString();
22955 test_ret += test_xmlNodeListGetString();
22956 test_ret += test_xmlNodeSetBase();
22957 test_ret += test_xmlNodeSetContent();
22958 test_ret += test_xmlNodeSetContentLen();
22959 test_ret += test_xmlNodeSetLang();
22960 test_ret += test_xmlNodeSetName();
22961 test_ret += test_xmlNodeSetSpacePreserve();
22962 test_ret += test_xmlReconciliateNs();
22963 test_ret += test_xmlRemoveProp();
22964 test_ret += test_xmlReplaceNode();
22965 test_ret += test_xmlSaveFile();
22966 test_ret += test_xmlSaveFileEnc();
22967 test_ret += test_xmlSaveFileTo();
22968 test_ret += test_xmlSaveFormatFile();
22969 test_ret += test_xmlSaveFormatFileEnc();
22970 test_ret += test_xmlSaveFormatFileTo();
22971 test_ret += test_xmlSearchNs();
22972 test_ret += test_xmlSearchNsByHref();
22973 test_ret += test_xmlSetBufferAllocationScheme();
22974 test_ret += test_xmlSetCompressMode();
22975 test_ret += test_xmlSetDocCompressMode();
22976 test_ret += test_xmlSetNs();
22977 test_ret += test_xmlSetNsProp();
22978 test_ret += test_xmlSetProp();
22979 test_ret += test_xmlSplitQName2();
22980 test_ret += test_xmlSplitQName3();
22981 test_ret += test_xmlStringGetNodeList();
22982 test_ret += test_xmlStringLenGetNodeList();
22983 test_ret += test_xmlTextConcat();
22984 test_ret += test_xmlTextMerge();
22985 test_ret += test_xmlUnsetNsProp();
22986 test_ret += test_xmlUnsetProp();
22987 test_ret += test_xmlValidateNCName();
22988 test_ret += test_xmlValidateNMToken();
22989 test_ret += test_xmlValidateName();
22990 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000022991
Daniel Veillard42595322004-11-08 10:52:06 +000022992 if (test_ret != 0)
22993 printf("Module tree: %d errors\n", test_ret);
22994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022995}
22996
22997static int
22998test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023000
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023001 int mem_base;
23002 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023003 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023004 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023005 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023006 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023007
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023008 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23009 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23010 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023011 URI = gen_const_xmlChar_ptr(n_URI, 0);
23012 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023013
William M. Brackf13f77f2004-11-12 16:03:48 +000023014 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023015 desret_xmlChar_ptr(ret_val);
23016 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023017 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23018 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023019 xmlResetLastError();
23020 if (mem_base != xmlMemBlocks()) {
23021 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023023 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023024 printf(" %d", n_URI);
23025 printf(" %d", n_base);
23026 printf("\n");
23027 }
23028 }
23029 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023031
Daniel Veillard42595322004-11-08 10:52:06 +000023032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023033}
23034
23035
23036static int
23037test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023039
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023040 int mem_base;
23041 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023042 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023043 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023044 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023045 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023046
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023047 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23048 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023050 URI = gen_const_xmlChar_ptr(n_URI, 0);
23051 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023052
William M. Brackf13f77f2004-11-12 16:03:48 +000023053 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023054 desret_xmlChar_ptr(ret_val);
23055 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023056 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23057 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023058 xmlResetLastError();
23059 if (mem_base != xmlMemBlocks()) {
23060 printf("Leak of %d blocks found in xmlBuildURI",
23061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023062 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023063 printf(" %d", n_URI);
23064 printf(" %d", n_base);
23065 printf("\n");
23066 }
23067 }
23068 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023069 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023070
Daniel Veillard42595322004-11-08 10:52:06 +000023071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023072}
23073
23074
23075static int
23076test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023078
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023079 int mem_base;
23080 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023081 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023082 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023083
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023084 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23085 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023086 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023087
William M. Brackf13f77f2004-11-12 16:03:48 +000023088 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023089 desret_xmlChar_ptr(ret_val);
23090 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023091 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023092 xmlResetLastError();
23093 if (mem_base != xmlMemBlocks()) {
23094 printf("Leak of %d blocks found in xmlCanonicPath",
23095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023096 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023097 printf(" %d", n_path);
23098 printf("\n");
23099 }
23100 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023101 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023102
Daniel Veillard42595322004-11-08 10:52:06 +000023103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023104}
23105
23106
23107static int
23108test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023110
23111
23112 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023114}
23115
23116
23117static int
23118test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023120
Daniel Veillardce682bc2004-11-05 17:22:25 +000023121 int mem_base;
23122 int ret_val;
23123 char * path; /* pointer to the path string */
23124 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023125
Daniel Veillardce682bc2004-11-05 17:22:25 +000023126 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23127 mem_base = xmlMemBlocks();
23128 path = gen_char_ptr(n_path, 0);
23129
23130 ret_val = xmlNormalizeURIPath(path);
23131 desret_int(ret_val);
23132 call_tests++;
23133 des_char_ptr(n_path, path, 0);
23134 xmlResetLastError();
23135 if (mem_base != xmlMemBlocks()) {
23136 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023138 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023139 printf(" %d", n_path);
23140 printf("\n");
23141 }
23142 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023143 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023144
Daniel Veillard42595322004-11-08 10:52:06 +000023145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023146}
23147
23148
23149static int
23150test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023152
23153
23154 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023156}
23157
23158
Daniel Veillardce682bc2004-11-05 17:22:25 +000023159#define gen_nb_xmlURIPtr 1
23160static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23161 return(NULL);
23162}
23163static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23164}
23165
Daniel Veillardd93f6252004-11-02 15:53:51 +000023166static int
23167test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023169
Daniel Veillardce682bc2004-11-05 17:22:25 +000023170 int mem_base;
23171 int ret_val;
23172 xmlURIPtr uri; /* pointer to an URI structure */
23173 int n_uri;
23174 char * str; /* the string to analyze */
23175 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023176
Daniel Veillardce682bc2004-11-05 17:22:25 +000023177 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23178 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23179 mem_base = xmlMemBlocks();
23180 uri = gen_xmlURIPtr(n_uri, 0);
23181 str = gen_const_char_ptr(n_str, 1);
23182
William M. Brackf13f77f2004-11-12 16:03:48 +000023183 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023184 desret_int(ret_val);
23185 call_tests++;
23186 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023187 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023188 xmlResetLastError();
23189 if (mem_base != xmlMemBlocks()) {
23190 printf("Leak of %d blocks found in xmlParseURIReference",
23191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023192 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023193 printf(" %d", n_uri);
23194 printf(" %d", n_str);
23195 printf("\n");
23196 }
23197 }
23198 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023199 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023200
Daniel Veillard42595322004-11-08 10:52:06 +000023201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023202}
23203
23204
23205static int
23206test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023208
Daniel Veillardce682bc2004-11-05 17:22:25 +000023209 int mem_base;
23210 FILE * stream; /* a FILE* for the output */
23211 int n_stream;
23212 xmlURIPtr uri; /* pointer to an xmlURI */
23213 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023214
Daniel Veillardce682bc2004-11-05 17:22:25 +000023215 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23216 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23217 mem_base = xmlMemBlocks();
23218 stream = gen_FILE_ptr(n_stream, 0);
23219 uri = gen_xmlURIPtr(n_uri, 1);
23220
23221 xmlPrintURI(stream, uri);
23222 call_tests++;
23223 des_FILE_ptr(n_stream, stream, 0);
23224 des_xmlURIPtr(n_uri, uri, 1);
23225 xmlResetLastError();
23226 if (mem_base != xmlMemBlocks()) {
23227 printf("Leak of %d blocks found in xmlPrintURI",
23228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023229 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023230 printf(" %d", n_stream);
23231 printf(" %d", n_uri);
23232 printf("\n");
23233 }
23234 }
23235 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023236 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023237
Daniel Veillard42595322004-11-08 10:52:06 +000023238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023239}
23240
23241
23242static int
23243test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023245
Daniel Veillardce682bc2004-11-05 17:22:25 +000023246 int mem_base;
23247 xmlChar * ret_val;
23248 xmlURIPtr uri; /* pointer to an xmlURI */
23249 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023250
Daniel Veillardce682bc2004-11-05 17:22:25 +000023251 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23252 mem_base = xmlMemBlocks();
23253 uri = gen_xmlURIPtr(n_uri, 0);
23254
23255 ret_val = xmlSaveUri(uri);
23256 desret_xmlChar_ptr(ret_val);
23257 call_tests++;
23258 des_xmlURIPtr(n_uri, uri, 0);
23259 xmlResetLastError();
23260 if (mem_base != xmlMemBlocks()) {
23261 printf("Leak of %d blocks found in xmlSaveUri",
23262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023263 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023264 printf(" %d", n_uri);
23265 printf("\n");
23266 }
23267 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023268 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023269
Daniel Veillard42595322004-11-08 10:52:06 +000023270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023271}
23272
23273
23274static int
23275test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023277
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023278 int mem_base;
23279 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023280 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023281 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023282
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023283 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23284 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023285 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023286
William M. Brackf13f77f2004-11-12 16:03:48 +000023287 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023288 desret_xmlChar_ptr(ret_val);
23289 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023290 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023291 xmlResetLastError();
23292 if (mem_base != xmlMemBlocks()) {
23293 printf("Leak of %d blocks found in xmlURIEscape",
23294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023295 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023296 printf(" %d", n_str);
23297 printf("\n");
23298 }
23299 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023300 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023301
Daniel Veillard42595322004-11-08 10:52:06 +000023302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023303}
23304
23305
23306static int
23307test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023309
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023310 int mem_base;
23311 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023312 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023313 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023314 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023315 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023316
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023317 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23318 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023320 str = gen_const_xmlChar_ptr(n_str, 0);
23321 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023322
William M. Brackf13f77f2004-11-12 16:03:48 +000023323 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023324 desret_xmlChar_ptr(ret_val);
23325 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023326 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23327 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023328 xmlResetLastError();
23329 if (mem_base != xmlMemBlocks()) {
23330 printf("Leak of %d blocks found in xmlURIEscapeStr",
23331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023332 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023333 printf(" %d", n_str);
23334 printf(" %d", n_list);
23335 printf("\n");
23336 }
23337 }
23338 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023340
Daniel Veillard42595322004-11-08 10:52:06 +000023341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023342}
23343
23344
23345static int
23346test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023348
23349
23350 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023352}
23353
23354static int
23355test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023357
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023358 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023359 test_ret += test_xmlBuildRelativeURI();
23360 test_ret += test_xmlBuildURI();
23361 test_ret += test_xmlCanonicPath();
23362 test_ret += test_xmlCreateURI();
23363 test_ret += test_xmlNormalizeURIPath();
23364 test_ret += test_xmlParseURI();
23365 test_ret += test_xmlParseURIReference();
23366 test_ret += test_xmlPrintURI();
23367 test_ret += test_xmlSaveUri();
23368 test_ret += test_xmlURIEscape();
23369 test_ret += test_xmlURIEscapeStr();
23370 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023371
Daniel Veillard42595322004-11-08 10:52:06 +000023372 if (test_ret != 0)
23373 printf("Module uri: %d errors\n", test_ret);
23374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023375}
23376
23377static int
23378test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023380
Daniel Veillard42595322004-11-08 10:52:06 +000023381 int mem_base;
23382 xmlAttributePtr ret_val;
23383 xmlValidCtxtPtr ctxt; /* the validation context */
23384 int n_ctxt;
23385 xmlDtdPtr dtd; /* pointer to the DTD */
23386 int n_dtd;
23387 xmlChar * elem; /* the element name */
23388 int n_elem;
23389 xmlChar * name; /* the attribute name */
23390 int n_name;
23391 xmlChar * ns; /* the attribute namespace prefix */
23392 int n_ns;
23393 xmlAttributeType type; /* the attribute type */
23394 int n_type;
23395 xmlAttributeDefault def; /* the attribute default type */
23396 int n_def;
23397 xmlChar * defaultValue; /* the attribute default value */
23398 int n_defaultValue;
23399 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23400 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023401
Daniel Veillard42595322004-11-08 10:52:06 +000023402 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23403 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23404 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23405 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23406 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23407 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23408 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23409 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23410 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23411 mem_base = xmlMemBlocks();
23412 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23413 dtd = gen_xmlDtdPtr(n_dtd, 1);
23414 elem = gen_const_xmlChar_ptr(n_elem, 2);
23415 name = gen_const_xmlChar_ptr(n_name, 3);
23416 ns = gen_const_xmlChar_ptr(n_ns, 4);
23417 type = gen_xmlAttributeType(n_type, 5);
23418 def = gen_xmlAttributeDefault(n_def, 6);
23419 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23420 tree = gen_xmlEnumerationPtr(n_tree, 8);
23421
William M. Brackf13f77f2004-11-12 16:03:48 +000023422 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 +000023423 desret_xmlAttributePtr(ret_val);
23424 call_tests++;
23425 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23426 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023427 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23428 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23429 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023430 des_xmlAttributeType(n_type, type, 5);
23431 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023432 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023433 des_xmlEnumerationPtr(n_tree, tree, 8);
23434 xmlResetLastError();
23435 if (mem_base != xmlMemBlocks()) {
23436 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23437 xmlMemBlocks() - mem_base);
23438 test_ret++;
23439 printf(" %d", n_ctxt);
23440 printf(" %d", n_dtd);
23441 printf(" %d", n_elem);
23442 printf(" %d", n_name);
23443 printf(" %d", n_ns);
23444 printf(" %d", n_type);
23445 printf(" %d", n_def);
23446 printf(" %d", n_defaultValue);
23447 printf(" %d", n_tree);
23448 printf("\n");
23449 }
23450 }
23451 }
23452 }
23453 }
23454 }
23455 }
23456 }
23457 }
23458 }
Daniel Veillard42595322004-11-08 10:52:06 +000023459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023460
Daniel Veillard42595322004-11-08 10:52:06 +000023461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023462}
23463
23464
23465static int
23466test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023468
Daniel Veillard42595322004-11-08 10:52:06 +000023469 int mem_base;
23470 xmlElementPtr ret_val;
23471 xmlValidCtxtPtr ctxt; /* the validation context */
23472 int n_ctxt;
23473 xmlDtdPtr dtd; /* pointer to the DTD */
23474 int n_dtd;
23475 xmlChar * name; /* the entity name */
23476 int n_name;
23477 xmlElementTypeVal type; /* the element type */
23478 int n_type;
23479 xmlElementContentPtr content; /* the element content tree or NULL */
23480 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023481
Daniel Veillard42595322004-11-08 10:52:06 +000023482 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23483 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23484 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23485 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23486 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23487 mem_base = xmlMemBlocks();
23488 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23489 dtd = gen_xmlDtdPtr(n_dtd, 1);
23490 name = gen_const_xmlChar_ptr(n_name, 2);
23491 type = gen_xmlElementTypeVal(n_type, 3);
23492 content = gen_xmlElementContentPtr(n_content, 4);
23493
William M. Brackf13f77f2004-11-12 16:03:48 +000023494 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023495 desret_xmlElementPtr(ret_val);
23496 call_tests++;
23497 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23498 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023499 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023500 des_xmlElementTypeVal(n_type, type, 3);
23501 des_xmlElementContentPtr(n_content, content, 4);
23502 xmlResetLastError();
23503 if (mem_base != xmlMemBlocks()) {
23504 printf("Leak of %d blocks found in xmlAddElementDecl",
23505 xmlMemBlocks() - mem_base);
23506 test_ret++;
23507 printf(" %d", n_ctxt);
23508 printf(" %d", n_dtd);
23509 printf(" %d", n_name);
23510 printf(" %d", n_type);
23511 printf(" %d", n_content);
23512 printf("\n");
23513 }
23514 }
23515 }
23516 }
23517 }
23518 }
Daniel Veillard42595322004-11-08 10:52:06 +000023519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023520
Daniel Veillard42595322004-11-08 10:52:06 +000023521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023522}
23523
23524
23525static int
23526test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023528
23529
23530 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023532}
23533
23534
23535static int
23536test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023538
23539
23540 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023542}
23543
23544
23545static int
23546test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023548
23549
23550 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023552}
23553
23554
Daniel Veillardce682bc2004-11-05 17:22:25 +000023555#define gen_nb_xmlAttributeTablePtr 1
23556static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23557 return(NULL);
23558}
23559static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23560}
23561
Daniel Veillardd93f6252004-11-02 15:53:51 +000023562static int
23563test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023565
23566
23567 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023569}
23570
23571
23572static int
23573test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023575
William M. Brack094dd862004-11-14 14:28:34 +000023576 int mem_base;
23577 xmlElementContentPtr ret_val;
23578 xmlElementContentPtr cur; /* An element content pointer. */
23579 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023580
William M. Brack094dd862004-11-14 14:28:34 +000023581 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23582 mem_base = xmlMemBlocks();
23583 cur = gen_xmlElementContentPtr(n_cur, 0);
23584
23585 ret_val = xmlCopyElementContent(cur);
23586 desret_xmlElementContentPtr(ret_val);
23587 call_tests++;
23588 des_xmlElementContentPtr(n_cur, cur, 0);
23589 xmlResetLastError();
23590 if (mem_base != xmlMemBlocks()) {
23591 printf("Leak of %d blocks found in xmlCopyElementContent",
23592 xmlMemBlocks() - mem_base);
23593 test_ret++;
23594 printf(" %d", n_cur);
23595 printf("\n");
23596 }
23597 }
23598 function_tests++;
23599
Daniel Veillard42595322004-11-08 10:52:06 +000023600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023601}
23602
23603
Daniel Veillardce682bc2004-11-05 17:22:25 +000023604#define gen_nb_xmlElementTablePtr 1
23605static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23606 return(NULL);
23607}
23608static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23609}
23610
Daniel Veillardd93f6252004-11-02 15:53:51 +000023611static int
23612test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023614
23615
23616 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023618}
23619
23620
23621static int
23622test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023624
23625
23626 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023628}
23629
23630
Daniel Veillardce682bc2004-11-05 17:22:25 +000023631#define gen_nb_xmlNotationTablePtr 1
23632static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23633 return(NULL);
23634}
23635static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23636}
23637
Daniel Veillardd93f6252004-11-02 15:53:51 +000023638static int
23639test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023641
23642
23643 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023645}
23646
23647
23648static int
23649test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023651
23652
23653 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023655}
23656
23657
Daniel Veillardce682bc2004-11-05 17:22:25 +000023658#define gen_nb_xmlAttributePtr 1
23659static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23660 return(NULL);
23661}
23662static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23663}
23664
Daniel Veillardd93f6252004-11-02 15:53:51 +000023665static int
23666test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023668
Daniel Veillardce682bc2004-11-05 17:22:25 +000023669#ifdef LIBXML_OUTPUT_ENABLED
23670 int mem_base;
23671 xmlBufferPtr buf; /* the XML buffer output */
23672 int n_buf;
23673 xmlAttributePtr attr; /* An attribute declaration */
23674 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023675
Daniel Veillardce682bc2004-11-05 17:22:25 +000023676 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23677 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23678 mem_base = xmlMemBlocks();
23679 buf = gen_xmlBufferPtr(n_buf, 0);
23680 attr = gen_xmlAttributePtr(n_attr, 1);
23681
23682 xmlDumpAttributeDecl(buf, attr);
23683 call_tests++;
23684 des_xmlBufferPtr(n_buf, buf, 0);
23685 des_xmlAttributePtr(n_attr, attr, 1);
23686 xmlResetLastError();
23687 if (mem_base != xmlMemBlocks()) {
23688 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023690 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023691 printf(" %d", n_buf);
23692 printf(" %d", n_attr);
23693 printf("\n");
23694 }
23695 }
23696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023697 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023698#endif
23699
Daniel Veillard42595322004-11-08 10:52:06 +000023700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023701}
23702
23703
23704static int
23705test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023707
Daniel Veillardce682bc2004-11-05 17:22:25 +000023708#ifdef LIBXML_OUTPUT_ENABLED
23709 int mem_base;
23710 xmlBufferPtr buf; /* the XML buffer output */
23711 int n_buf;
23712 xmlAttributeTablePtr table; /* An attribute table */
23713 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023714
Daniel Veillardce682bc2004-11-05 17:22:25 +000023715 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23716 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23717 mem_base = xmlMemBlocks();
23718 buf = gen_xmlBufferPtr(n_buf, 0);
23719 table = gen_xmlAttributeTablePtr(n_table, 1);
23720
23721 xmlDumpAttributeTable(buf, table);
23722 call_tests++;
23723 des_xmlBufferPtr(n_buf, buf, 0);
23724 des_xmlAttributeTablePtr(n_table, table, 1);
23725 xmlResetLastError();
23726 if (mem_base != xmlMemBlocks()) {
23727 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023729 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023730 printf(" %d", n_buf);
23731 printf(" %d", n_table);
23732 printf("\n");
23733 }
23734 }
23735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023736 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023737#endif
23738
Daniel Veillard42595322004-11-08 10:52:06 +000023739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023740}
23741
23742
Daniel Veillardce682bc2004-11-05 17:22:25 +000023743#define gen_nb_xmlElementPtr 1
23744static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23745 return(NULL);
23746}
23747static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23748}
23749
Daniel Veillardd93f6252004-11-02 15:53:51 +000023750static int
23751test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023753
Daniel Veillardce682bc2004-11-05 17:22:25 +000023754#ifdef LIBXML_OUTPUT_ENABLED
23755 int mem_base;
23756 xmlBufferPtr buf; /* the XML buffer output */
23757 int n_buf;
23758 xmlElementPtr elem; /* An element table */
23759 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023760
Daniel Veillardce682bc2004-11-05 17:22:25 +000023761 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23762 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23763 mem_base = xmlMemBlocks();
23764 buf = gen_xmlBufferPtr(n_buf, 0);
23765 elem = gen_xmlElementPtr(n_elem, 1);
23766
23767 xmlDumpElementDecl(buf, elem);
23768 call_tests++;
23769 des_xmlBufferPtr(n_buf, buf, 0);
23770 des_xmlElementPtr(n_elem, elem, 1);
23771 xmlResetLastError();
23772 if (mem_base != xmlMemBlocks()) {
23773 printf("Leak of %d blocks found in xmlDumpElementDecl",
23774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023775 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023776 printf(" %d", n_buf);
23777 printf(" %d", n_elem);
23778 printf("\n");
23779 }
23780 }
23781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023782 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023783#endif
23784
Daniel Veillard42595322004-11-08 10:52:06 +000023785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023786}
23787
23788
23789static int
23790test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023792
Daniel Veillardce682bc2004-11-05 17:22:25 +000023793#ifdef LIBXML_OUTPUT_ENABLED
23794 int mem_base;
23795 xmlBufferPtr buf; /* the XML buffer output */
23796 int n_buf;
23797 xmlElementTablePtr table; /* An element table */
23798 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023799
Daniel Veillardce682bc2004-11-05 17:22:25 +000023800 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23801 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23802 mem_base = xmlMemBlocks();
23803 buf = gen_xmlBufferPtr(n_buf, 0);
23804 table = gen_xmlElementTablePtr(n_table, 1);
23805
23806 xmlDumpElementTable(buf, table);
23807 call_tests++;
23808 des_xmlBufferPtr(n_buf, buf, 0);
23809 des_xmlElementTablePtr(n_table, table, 1);
23810 xmlResetLastError();
23811 if (mem_base != xmlMemBlocks()) {
23812 printf("Leak of %d blocks found in xmlDumpElementTable",
23813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023814 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023815 printf(" %d", n_buf);
23816 printf(" %d", n_table);
23817 printf("\n");
23818 }
23819 }
23820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023821 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023822#endif
23823
Daniel Veillard42595322004-11-08 10:52:06 +000023824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023825}
23826
23827
Daniel Veillardce682bc2004-11-05 17:22:25 +000023828#define gen_nb_xmlNotationPtr 1
23829static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23830 return(NULL);
23831}
23832static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23833}
23834
Daniel Veillardd93f6252004-11-02 15:53:51 +000023835static int
23836test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023838
Daniel Veillardce682bc2004-11-05 17:22:25 +000023839#ifdef LIBXML_OUTPUT_ENABLED
23840 int mem_base;
23841 xmlBufferPtr buf; /* the XML buffer output */
23842 int n_buf;
23843 xmlNotationPtr nota; /* A notation declaration */
23844 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023845
Daniel Veillardce682bc2004-11-05 17:22:25 +000023846 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23847 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23848 mem_base = xmlMemBlocks();
23849 buf = gen_xmlBufferPtr(n_buf, 0);
23850 nota = gen_xmlNotationPtr(n_nota, 1);
23851
23852 xmlDumpNotationDecl(buf, nota);
23853 call_tests++;
23854 des_xmlBufferPtr(n_buf, buf, 0);
23855 des_xmlNotationPtr(n_nota, nota, 1);
23856 xmlResetLastError();
23857 if (mem_base != xmlMemBlocks()) {
23858 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023860 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023861 printf(" %d", n_buf);
23862 printf(" %d", n_nota);
23863 printf("\n");
23864 }
23865 }
23866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023867 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023868#endif
23869
Daniel Veillard42595322004-11-08 10:52:06 +000023870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023871}
23872
23873
23874static int
23875test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023877
Daniel Veillardce682bc2004-11-05 17:22:25 +000023878#ifdef LIBXML_OUTPUT_ENABLED
23879 int mem_base;
23880 xmlBufferPtr buf; /* the XML buffer output */
23881 int n_buf;
23882 xmlNotationTablePtr table; /* A notation table */
23883 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023884
Daniel Veillardce682bc2004-11-05 17:22:25 +000023885 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23886 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23887 mem_base = xmlMemBlocks();
23888 buf = gen_xmlBufferPtr(n_buf, 0);
23889 table = gen_xmlNotationTablePtr(n_table, 1);
23890
23891 xmlDumpNotationTable(buf, table);
23892 call_tests++;
23893 des_xmlBufferPtr(n_buf, buf, 0);
23894 des_xmlNotationTablePtr(n_table, table, 1);
23895 xmlResetLastError();
23896 if (mem_base != xmlMemBlocks()) {
23897 printf("Leak of %d blocks found in xmlDumpNotationTable",
23898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023899 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023900 printf(" %d", n_buf);
23901 printf(" %d", n_table);
23902 printf("\n");
23903 }
23904 }
23905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023906 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023907#endif
23908
Daniel Veillard42595322004-11-08 10:52:06 +000023909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023910}
23911
23912
23913static int
23914test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023916
Daniel Veillard42595322004-11-08 10:52:06 +000023917 int mem_base;
23918 xmlAttributePtr ret_val;
23919 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23920 int n_dtd;
23921 xmlChar * elem; /* the element name */
23922 int n_elem;
23923 xmlChar * name; /* the attribute name */
23924 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023925
Daniel Veillard42595322004-11-08 10:52:06 +000023926 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23927 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23928 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23929 mem_base = xmlMemBlocks();
23930 dtd = gen_xmlDtdPtr(n_dtd, 0);
23931 elem = gen_const_xmlChar_ptr(n_elem, 1);
23932 name = gen_const_xmlChar_ptr(n_name, 2);
23933
William M. Brackf13f77f2004-11-12 16:03:48 +000023934 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023935 desret_xmlAttributePtr(ret_val);
23936 call_tests++;
23937 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023938 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
23939 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023940 xmlResetLastError();
23941 if (mem_base != xmlMemBlocks()) {
23942 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
23943 xmlMemBlocks() - mem_base);
23944 test_ret++;
23945 printf(" %d", n_dtd);
23946 printf(" %d", n_elem);
23947 printf(" %d", n_name);
23948 printf("\n");
23949 }
23950 }
23951 }
23952 }
Daniel Veillard42595322004-11-08 10:52:06 +000023953 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023954
Daniel Veillard42595322004-11-08 10:52:06 +000023955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023956}
23957
23958
23959static int
23960test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023962
Daniel Veillard42595322004-11-08 10:52:06 +000023963 int mem_base;
23964 xmlElementPtr ret_val;
23965 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23966 int n_dtd;
23967 xmlChar * name; /* the element name */
23968 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023969
Daniel Veillard42595322004-11-08 10:52:06 +000023970 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23971 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23972 mem_base = xmlMemBlocks();
23973 dtd = gen_xmlDtdPtr(n_dtd, 0);
23974 name = gen_const_xmlChar_ptr(n_name, 1);
23975
William M. Brackf13f77f2004-11-12 16:03:48 +000023976 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023977 desret_xmlElementPtr(ret_val);
23978 call_tests++;
23979 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023980 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000023981 xmlResetLastError();
23982 if (mem_base != xmlMemBlocks()) {
23983 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
23984 xmlMemBlocks() - mem_base);
23985 test_ret++;
23986 printf(" %d", n_dtd);
23987 printf(" %d", n_name);
23988 printf("\n");
23989 }
23990 }
23991 }
Daniel Veillard42595322004-11-08 10:52:06 +000023992 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023993
Daniel Veillard42595322004-11-08 10:52:06 +000023994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023995}
23996
23997
23998static int
23999test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024001
24002
24003 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024005}
24006
24007
24008static int
24009test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024011
Daniel Veillard42595322004-11-08 10:52:06 +000024012 int mem_base;
24013 xmlAttributePtr ret_val;
24014 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24015 int n_dtd;
24016 xmlChar * elem; /* the element name */
24017 int n_elem;
24018 xmlChar * name; /* the attribute name */
24019 int n_name;
24020 xmlChar * prefix; /* the attribute namespace prefix */
24021 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024022
Daniel Veillard42595322004-11-08 10:52:06 +000024023 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24024 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24025 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24026 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24027 mem_base = xmlMemBlocks();
24028 dtd = gen_xmlDtdPtr(n_dtd, 0);
24029 elem = gen_const_xmlChar_ptr(n_elem, 1);
24030 name = gen_const_xmlChar_ptr(n_name, 2);
24031 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24032
William M. Brackf13f77f2004-11-12 16:03:48 +000024033 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024034 desret_xmlAttributePtr(ret_val);
24035 call_tests++;
24036 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024037 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24038 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24039 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024040 xmlResetLastError();
24041 if (mem_base != xmlMemBlocks()) {
24042 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24043 xmlMemBlocks() - mem_base);
24044 test_ret++;
24045 printf(" %d", n_dtd);
24046 printf(" %d", n_elem);
24047 printf(" %d", n_name);
24048 printf(" %d", n_prefix);
24049 printf("\n");
24050 }
24051 }
24052 }
24053 }
24054 }
Daniel Veillard42595322004-11-08 10:52:06 +000024055 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024056
Daniel Veillard42595322004-11-08 10:52:06 +000024057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024058}
24059
24060
24061static int
24062test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024064
Daniel Veillard42595322004-11-08 10:52:06 +000024065 int mem_base;
24066 xmlElementPtr ret_val;
24067 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24068 int n_dtd;
24069 xmlChar * name; /* the element name */
24070 int n_name;
24071 xmlChar * prefix; /* the element namespace prefix */
24072 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024073
Daniel Veillard42595322004-11-08 10:52:06 +000024074 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24075 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24076 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24077 mem_base = xmlMemBlocks();
24078 dtd = gen_xmlDtdPtr(n_dtd, 0);
24079 name = gen_const_xmlChar_ptr(n_name, 1);
24080 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24081
William M. Brackf13f77f2004-11-12 16:03:48 +000024082 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024083 desret_xmlElementPtr(ret_val);
24084 call_tests++;
24085 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024086 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24087 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024088 xmlResetLastError();
24089 if (mem_base != xmlMemBlocks()) {
24090 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24091 xmlMemBlocks() - mem_base);
24092 test_ret++;
24093 printf(" %d", n_dtd);
24094 printf(" %d", n_name);
24095 printf(" %d", n_prefix);
24096 printf("\n");
24097 }
24098 }
24099 }
24100 }
Daniel Veillard42595322004-11-08 10:52:06 +000024101 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024102
Daniel Veillard42595322004-11-08 10:52:06 +000024103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024104}
24105
24106
24107static int
24108test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024110
Daniel Veillard57b25162004-11-06 14:50:18 +000024111 int mem_base;
24112 xmlAttrPtr ret_val;
24113 xmlDocPtr doc; /* pointer to the document */
24114 int n_doc;
24115 xmlChar * ID; /* the ID value */
24116 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024117
Daniel Veillard57b25162004-11-06 14:50:18 +000024118 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24119 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24120 mem_base = xmlMemBlocks();
24121 doc = gen_xmlDocPtr(n_doc, 0);
24122 ID = gen_const_xmlChar_ptr(n_ID, 1);
24123
William M. Brackf13f77f2004-11-12 16:03:48 +000024124 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024125 desret_xmlAttrPtr(ret_val);
24126 call_tests++;
24127 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024128 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024129 xmlResetLastError();
24130 if (mem_base != xmlMemBlocks()) {
24131 printf("Leak of %d blocks found in xmlGetID",
24132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024133 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024134 printf(" %d", n_doc);
24135 printf(" %d", n_ID);
24136 printf("\n");
24137 }
24138 }
24139 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024141
Daniel Veillard42595322004-11-08 10:52:06 +000024142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024143}
24144
24145
24146static int
24147test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024149
24150
24151 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024153}
24154
24155
24156static int
24157test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024159
Daniel Veillardce244ad2004-11-05 10:03:46 +000024160 int mem_base;
24161 int ret_val;
24162 xmlDocPtr doc; /* the document */
24163 int n_doc;
24164 xmlNodePtr elem; /* the element carrying the attribute */
24165 int n_elem;
24166 xmlAttrPtr attr; /* the attribute */
24167 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024168
Daniel Veillardce244ad2004-11-05 10:03:46 +000024169 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24170 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24171 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24172 mem_base = xmlMemBlocks();
24173 doc = gen_xmlDocPtr(n_doc, 0);
24174 elem = gen_xmlNodePtr(n_elem, 1);
24175 attr = gen_xmlAttrPtr(n_attr, 2);
24176
24177 ret_val = xmlIsID(doc, elem, attr);
24178 desret_int(ret_val);
24179 call_tests++;
24180 des_xmlDocPtr(n_doc, doc, 0);
24181 des_xmlNodePtr(n_elem, elem, 1);
24182 des_xmlAttrPtr(n_attr, attr, 2);
24183 xmlResetLastError();
24184 if (mem_base != xmlMemBlocks()) {
24185 printf("Leak of %d blocks found in xmlIsID",
24186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024187 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024188 printf(" %d", n_doc);
24189 printf(" %d", n_elem);
24190 printf(" %d", n_attr);
24191 printf("\n");
24192 }
24193 }
24194 }
24195 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024196 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024197
Daniel Veillard42595322004-11-08 10:52:06 +000024198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024199}
24200
24201
24202static int
24203test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024205
24206 int mem_base;
24207 int ret_val;
24208 xmlDocPtr doc; /* the document */
24209 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024210 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024211 int n_name;
24212
24213 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24214 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24215 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024216 doc = gen_xmlDocPtr(n_doc, 0);
24217 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024218
William M. Brackf13f77f2004-11-12 16:03:48 +000024219 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024220 desret_int(ret_val);
24221 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024222 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024223 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024224 xmlResetLastError();
24225 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024226 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024228 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024229 printf(" %d", n_doc);
24230 printf(" %d", n_name);
24231 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024232 }
24233 }
24234 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024235 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024236
Daniel Veillard42595322004-11-08 10:52:06 +000024237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024238}
24239
24240
24241static int
24242test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024244
Daniel Veillardce244ad2004-11-05 10:03:46 +000024245 int mem_base;
24246 int ret_val;
24247 xmlDocPtr doc; /* the document */
24248 int n_doc;
24249 xmlNodePtr elem; /* the element carrying the attribute */
24250 int n_elem;
24251 xmlAttrPtr attr; /* the attribute */
24252 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024253
Daniel Veillardce244ad2004-11-05 10:03:46 +000024254 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24255 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24256 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24257 mem_base = xmlMemBlocks();
24258 doc = gen_xmlDocPtr(n_doc, 0);
24259 elem = gen_xmlNodePtr(n_elem, 1);
24260 attr = gen_xmlAttrPtr(n_attr, 2);
24261
24262 ret_val = xmlIsRef(doc, elem, attr);
24263 desret_int(ret_val);
24264 call_tests++;
24265 des_xmlDocPtr(n_doc, doc, 0);
24266 des_xmlNodePtr(n_elem, elem, 1);
24267 des_xmlAttrPtr(n_attr, attr, 2);
24268 xmlResetLastError();
24269 if (mem_base != xmlMemBlocks()) {
24270 printf("Leak of %d blocks found in xmlIsRef",
24271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024272 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024273 printf(" %d", n_doc);
24274 printf(" %d", n_elem);
24275 printf(" %d", n_attr);
24276 printf("\n");
24277 }
24278 }
24279 }
24280 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024281 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024282
Daniel Veillard42595322004-11-08 10:52:06 +000024283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024284}
24285
24286
24287static int
24288test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024290
William M. Brack094dd862004-11-14 14:28:34 +000024291 int mem_base;
24292 xmlElementContentPtr ret_val;
24293 xmlChar * name; /* the subelement name or NULL */
24294 int n_name;
24295 xmlElementContentType type; /* the type of element content decl */
24296 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024297
William M. Brack094dd862004-11-14 14:28:34 +000024298 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24299 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24300 mem_base = xmlMemBlocks();
24301 name = gen_const_xmlChar_ptr(n_name, 0);
24302 type = gen_xmlElementContentType(n_type, 1);
24303
24304 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24305 desret_xmlElementContentPtr(ret_val);
24306 call_tests++;
24307 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24308 des_xmlElementContentType(n_type, type, 1);
24309 xmlResetLastError();
24310 if (mem_base != xmlMemBlocks()) {
24311 printf("Leak of %d blocks found in xmlNewElementContent",
24312 xmlMemBlocks() - mem_base);
24313 test_ret++;
24314 printf(" %d", n_name);
24315 printf(" %d", n_type);
24316 printf("\n");
24317 }
24318 }
24319 }
24320 function_tests++;
24321
Daniel Veillard42595322004-11-08 10:52:06 +000024322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024323}
24324
24325
24326static int
24327test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024329
24330
24331 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024333}
24334
24335
24336static int
24337test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024339
Daniel Veillardce244ad2004-11-05 10:03:46 +000024340 int mem_base;
24341 int ret_val;
24342 xmlDocPtr doc; /* the document */
24343 int n_doc;
24344 xmlAttrPtr attr; /* the attribute */
24345 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024346
Daniel Veillardce244ad2004-11-05 10:03:46 +000024347 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24348 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24349 mem_base = xmlMemBlocks();
24350 doc = gen_xmlDocPtr(n_doc, 0);
24351 attr = gen_xmlAttrPtr(n_attr, 1);
24352
24353 ret_val = xmlRemoveID(doc, attr);
24354 desret_int(ret_val);
24355 call_tests++;
24356 des_xmlDocPtr(n_doc, doc, 0);
24357 des_xmlAttrPtr(n_attr, attr, 1);
24358 xmlResetLastError();
24359 if (mem_base != xmlMemBlocks()) {
24360 printf("Leak of %d blocks found in xmlRemoveID",
24361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024362 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024363 printf(" %d", n_doc);
24364 printf(" %d", n_attr);
24365 printf("\n");
24366 }
24367 }
24368 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024369 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024370
Daniel Veillard42595322004-11-08 10:52:06 +000024371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024372}
24373
24374
24375static int
24376test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024378
Daniel Veillardce244ad2004-11-05 10:03:46 +000024379 int mem_base;
24380 int ret_val;
24381 xmlDocPtr doc; /* the document */
24382 int n_doc;
24383 xmlAttrPtr attr; /* the attribute */
24384 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024385
Daniel Veillardce244ad2004-11-05 10:03:46 +000024386 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24387 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24388 mem_base = xmlMemBlocks();
24389 doc = gen_xmlDocPtr(n_doc, 0);
24390 attr = gen_xmlAttrPtr(n_attr, 1);
24391
24392 ret_val = xmlRemoveRef(doc, attr);
24393 desret_int(ret_val);
24394 call_tests++;
24395 des_xmlDocPtr(n_doc, doc, 0);
24396 des_xmlAttrPtr(n_attr, attr, 1);
24397 xmlResetLastError();
24398 if (mem_base != xmlMemBlocks()) {
24399 printf("Leak of %d blocks found in xmlRemoveRef",
24400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024401 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024402 printf(" %d", n_doc);
24403 printf(" %d", n_attr);
24404 printf("\n");
24405 }
24406 }
24407 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024408 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024409
Daniel Veillard42595322004-11-08 10:52:06 +000024410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024411}
24412
24413
24414static int
24415test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024417
Daniel Veillardce682bc2004-11-05 17:22:25 +000024418 int mem_base;
24419 char * buf; /* an output buffer */
24420 int n_buf;
24421 int size; /* the buffer size */
24422 int n_size;
24423 xmlElementContentPtr content; /* An element table */
24424 int n_content;
24425 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24426 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024427
Daniel Veillardce682bc2004-11-05 17:22:25 +000024428 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24429 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24430 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24431 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24432 mem_base = xmlMemBlocks();
24433 buf = gen_char_ptr(n_buf, 0);
24434 size = gen_int(n_size, 1);
24435 content = gen_xmlElementContentPtr(n_content, 2);
24436 glob = gen_int(n_glob, 3);
24437
24438 xmlSnprintfElementContent(buf, size, content, glob);
24439 call_tests++;
24440 des_char_ptr(n_buf, buf, 0);
24441 des_int(n_size, size, 1);
24442 des_xmlElementContentPtr(n_content, content, 2);
24443 des_int(n_glob, glob, 3);
24444 xmlResetLastError();
24445 if (mem_base != xmlMemBlocks()) {
24446 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024448 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024449 printf(" %d", n_buf);
24450 printf(" %d", n_size);
24451 printf(" %d", n_content);
24452 printf(" %d", n_glob);
24453 printf("\n");
24454 }
24455 }
24456 }
24457 }
24458 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024460
Daniel Veillard42595322004-11-08 10:52:06 +000024461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024462}
24463
24464
24465static int
24466test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024468
Daniel Veillarda521d282004-11-09 14:59:59 +000024469#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024470 int mem_base;
24471 char * buf; /* an output buffer */
24472 int n_buf;
24473 xmlElementContentPtr content; /* An element table */
24474 int n_content;
24475 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24476 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024477
Daniel Veillardce682bc2004-11-05 17:22:25 +000024478 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24479 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24480 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24481 mem_base = xmlMemBlocks();
24482 buf = gen_char_ptr(n_buf, 0);
24483 content = gen_xmlElementContentPtr(n_content, 1);
24484 glob = gen_int(n_glob, 2);
24485
24486 xmlSprintfElementContent(buf, content, glob);
24487 call_tests++;
24488 des_char_ptr(n_buf, buf, 0);
24489 des_xmlElementContentPtr(n_content, content, 1);
24490 des_int(n_glob, glob, 2);
24491 xmlResetLastError();
24492 if (mem_base != xmlMemBlocks()) {
24493 printf("Leak of %d blocks found in xmlSprintfElementContent",
24494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024495 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024496 printf(" %d", n_buf);
24497 printf(" %d", n_content);
24498 printf(" %d", n_glob);
24499 printf("\n");
24500 }
24501 }
24502 }
24503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024504 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024505#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024506
Daniel Veillard42595322004-11-08 10:52:06 +000024507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024508}
24509
24510
24511static int
24512test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024514
Daniel Veillardce682bc2004-11-05 17:22:25 +000024515#ifdef LIBXML_REGEXP_ENABLED
24516 int mem_base;
24517 int ret_val;
24518 xmlValidCtxtPtr ctxt; /* a validation context */
24519 int n_ctxt;
24520 xmlElementPtr elem; /* an element declaration node */
24521 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024522
Daniel Veillardce682bc2004-11-05 17:22:25 +000024523 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24524 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24525 mem_base = xmlMemBlocks();
24526 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24527 elem = gen_xmlElementPtr(n_elem, 1);
24528
24529 ret_val = xmlValidBuildContentModel(ctxt, elem);
24530 desret_int(ret_val);
24531 call_tests++;
24532 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24533 des_xmlElementPtr(n_elem, elem, 1);
24534 xmlResetLastError();
24535 if (mem_base != xmlMemBlocks()) {
24536 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024538 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024539 printf(" %d", n_ctxt);
24540 printf(" %d", n_elem);
24541 printf("\n");
24542 }
24543 }
24544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024545 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024546#endif
24547
Daniel Veillard42595322004-11-08 10:52:06 +000024548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024549}
24550
24551
24552static int
24553test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024555
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024556#ifdef LIBXML_VALID_ENABLED
24557 int mem_base;
24558 xmlChar * ret_val;
24559 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24560 int n_ctxt;
24561 xmlDocPtr doc; /* the document */
24562 int n_doc;
24563 xmlNodePtr elem; /* the parent */
24564 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024565 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024566 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024567 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024568 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024569
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024570 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24571 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24572 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24573 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24574 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24575 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024576 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24577 doc = gen_xmlDocPtr(n_doc, 1);
24578 elem = gen_xmlNodePtr(n_elem, 2);
24579 name = gen_const_xmlChar_ptr(n_name, 3);
24580 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024581
William M. Brackf13f77f2004-11-12 16:03:48 +000024582 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024583 desret_xmlChar_ptr(ret_val);
24584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024585 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24586 des_xmlDocPtr(n_doc, doc, 1);
24587 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024588 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24589 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024590 xmlResetLastError();
24591 if (mem_base != xmlMemBlocks()) {
24592 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024594 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024595 printf(" %d", n_ctxt);
24596 printf(" %d", n_doc);
24597 printf(" %d", n_elem);
24598 printf(" %d", n_name);
24599 printf(" %d", n_value);
24600 printf("\n");
24601 }
24602 }
24603 }
24604 }
24605 }
24606 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024607 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024608#endif
24609
Daniel Veillard42595322004-11-08 10:52:06 +000024610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024611}
24612
24613
Daniel Veillardce682bc2004-11-05 17:22:25 +000024614#define gen_nb_xmlElementContent_ptr 1
24615static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24616 return(NULL);
24617}
24618static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24619}
24620
Daniel Veillardd93f6252004-11-02 15:53:51 +000024621static int
24622test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024624
Daniel Veillarda521d282004-11-09 14:59:59 +000024625#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024626 int mem_base;
24627 int ret_val;
24628 xmlElementContent * ctree; /* an element content tree */
24629 int n_ctree;
24630 xmlChar ** list; /* an array to store the list of child names */
24631 int n_list;
24632 int * len; /* a pointer to the number of element in the list */
24633 int n_len;
24634 int max; /* the size of the array */
24635 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024636
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024637 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24638 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24639 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24640 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24641 mem_base = xmlMemBlocks();
24642 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24643 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24644 len = gen_int_ptr(n_len, 2);
24645 max = gen_int(n_max, 3);
24646
William M. Brackf13f77f2004-11-12 16:03:48 +000024647 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024648 desret_int(ret_val);
24649 call_tests++;
24650 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024651 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024652 des_int_ptr(n_len, len, 2);
24653 des_int(n_max, max, 3);
24654 xmlResetLastError();
24655 if (mem_base != xmlMemBlocks()) {
24656 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024658 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024659 printf(" %d", n_ctree);
24660 printf(" %d", n_list);
24661 printf(" %d", n_len);
24662 printf(" %d", n_max);
24663 printf("\n");
24664 }
24665 }
24666 }
24667 }
24668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024669 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024670#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +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_xmlValidGetValidElements(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_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024681 int mem_base;
24682 int ret_val;
24683 xmlNode * prev; /* an element to insert after */
24684 int n_prev;
24685 xmlNode * next; /* an element to insert next */
24686 int n_next;
24687 xmlChar ** names; /* an array to store the list of child names */
24688 int n_names;
24689 int max; /* the size of the array */
24690 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024691
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024692 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24693 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24694 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24695 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24696 mem_base = xmlMemBlocks();
24697 prev = gen_xmlNodePtr(n_prev, 0);
24698 next = gen_xmlNodePtr(n_next, 1);
24699 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24700 max = gen_int(n_max, 3);
24701
William M. Brackf13f77f2004-11-12 16:03:48 +000024702 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024703 desret_int(ret_val);
24704 call_tests++;
24705 des_xmlNodePtr(n_prev, prev, 0);
24706 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024707 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024708 des_int(n_max, max, 3);
24709 xmlResetLastError();
24710 if (mem_base != xmlMemBlocks()) {
24711 printf("Leak of %d blocks found in xmlValidGetValidElements",
24712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024713 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024714 printf(" %d", n_prev);
24715 printf(" %d", n_next);
24716 printf(" %d", n_names);
24717 printf(" %d", n_max);
24718 printf("\n");
24719 }
24720 }
24721 }
24722 }
24723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024724 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024725#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024726
Daniel Veillard42595322004-11-08 10:52:06 +000024727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024728}
24729
24730
24731static int
24732test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024734
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024735#ifdef LIBXML_VALID_ENABLED
24736 int mem_base;
24737 xmlChar * ret_val;
24738 xmlDocPtr doc; /* the document */
24739 int n_doc;
24740 xmlNodePtr elem; /* the parent */
24741 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024742 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024743 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024744 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024745 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024746
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024747 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24748 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24749 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24750 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24751 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024752 doc = gen_xmlDocPtr(n_doc, 0);
24753 elem = gen_xmlNodePtr(n_elem, 1);
24754 name = gen_const_xmlChar_ptr(n_name, 2);
24755 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024756
William M. Brackf13f77f2004-11-12 16:03:48 +000024757 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024758 desret_xmlChar_ptr(ret_val);
24759 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024760 des_xmlDocPtr(n_doc, doc, 0);
24761 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024762 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24763 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024764 xmlResetLastError();
24765 if (mem_base != xmlMemBlocks()) {
24766 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024768 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024769 printf(" %d", n_doc);
24770 printf(" %d", n_elem);
24771 printf(" %d", n_name);
24772 printf(" %d", n_value);
24773 printf("\n");
24774 }
24775 }
24776 }
24777 }
24778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024779 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024780#endif
24781
Daniel Veillard42595322004-11-08 10:52:06 +000024782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024783}
24784
24785
24786static int
24787test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024789
Daniel Veillardce682bc2004-11-05 17:22:25 +000024790#ifdef LIBXML_VALID_ENABLED
24791 int mem_base;
24792 int ret_val;
24793 xmlValidCtxtPtr ctxt; /* the validation context */
24794 int n_ctxt;
24795 xmlDocPtr doc; /* a document instance */
24796 int n_doc;
24797 xmlAttributePtr attr; /* an attribute definition */
24798 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024799
Daniel Veillardce682bc2004-11-05 17:22:25 +000024800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24801 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24802 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24803 mem_base = xmlMemBlocks();
24804 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24805 doc = gen_xmlDocPtr(n_doc, 1);
24806 attr = gen_xmlAttributePtr(n_attr, 2);
24807
24808 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24809 desret_int(ret_val);
24810 call_tests++;
24811 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24812 des_xmlDocPtr(n_doc, doc, 1);
24813 des_xmlAttributePtr(n_attr, attr, 2);
24814 xmlResetLastError();
24815 if (mem_base != xmlMemBlocks()) {
24816 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024818 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024819 printf(" %d", n_ctxt);
24820 printf(" %d", n_doc);
24821 printf(" %d", n_attr);
24822 printf("\n");
24823 }
24824 }
24825 }
24826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024827 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024828#endif
24829
Daniel Veillard42595322004-11-08 10:52:06 +000024830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024831}
24832
24833
24834static int
24835test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024837
Daniel Veillard57b25162004-11-06 14:50:18 +000024838#ifdef LIBXML_VALID_ENABLED
24839 int mem_base;
24840 int ret_val;
24841 xmlAttributeType type; /* an attribute type */
24842 int n_type;
24843 xmlChar * value; /* an attribute value */
24844 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024845
Daniel Veillard57b25162004-11-06 14:50:18 +000024846 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24847 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24848 mem_base = xmlMemBlocks();
24849 type = gen_xmlAttributeType(n_type, 0);
24850 value = gen_const_xmlChar_ptr(n_value, 1);
24851
William M. Brackf13f77f2004-11-12 16:03:48 +000024852 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000024853 desret_int(ret_val);
24854 call_tests++;
24855 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024856 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024857 xmlResetLastError();
24858 if (mem_base != xmlMemBlocks()) {
24859 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024861 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024862 printf(" %d", n_type);
24863 printf(" %d", n_value);
24864 printf("\n");
24865 }
24866 }
24867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024868 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024869#endif
24870
Daniel Veillard42595322004-11-08 10:52:06 +000024871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024872}
24873
24874
24875static int
24876test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024878
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024879#ifdef LIBXML_VALID_ENABLED
24880 int mem_base;
24881 int ret_val;
24882 xmlValidCtxtPtr ctxt; /* the validation context */
24883 int n_ctxt;
24884 xmlDocPtr doc; /* a document instance */
24885 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024886
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024887 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24888 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24889 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024890 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24891 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024892
24893 ret_val = xmlValidateDocument(ctxt, doc);
24894 desret_int(ret_val);
24895 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024896 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24897 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024898 xmlResetLastError();
24899 if (mem_base != xmlMemBlocks()) {
24900 printf("Leak of %d blocks found in xmlValidateDocument",
24901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024902 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024903 printf(" %d", n_ctxt);
24904 printf(" %d", n_doc);
24905 printf("\n");
24906 }
24907 }
24908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024909 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024910#endif
24911
Daniel Veillard42595322004-11-08 10:52:06 +000024912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024913}
24914
24915
24916static int
24917test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024919
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024920#ifdef LIBXML_VALID_ENABLED
24921 int mem_base;
24922 int ret_val;
24923 xmlValidCtxtPtr ctxt; /* the validation context */
24924 int n_ctxt;
24925 xmlDocPtr doc; /* a document instance */
24926 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024927
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024928 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24929 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024931 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24932 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024933
24934 ret_val = xmlValidateDocumentFinal(ctxt, doc);
24935 desret_int(ret_val);
24936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024937 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24938 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024939 xmlResetLastError();
24940 if (mem_base != xmlMemBlocks()) {
24941 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
24942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024943 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024944 printf(" %d", n_ctxt);
24945 printf(" %d", n_doc);
24946 printf("\n");
24947 }
24948 }
24949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024950 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024951#endif
24952
Daniel Veillard42595322004-11-08 10:52:06 +000024953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024954}
24955
24956
24957static int
24958test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024960
Daniel Veillard27f20102004-11-05 11:50:11 +000024961#ifdef LIBXML_VALID_ENABLED
24962 int mem_base;
24963 int ret_val;
24964 xmlValidCtxtPtr ctxt; /* the validation context */
24965 int n_ctxt;
24966 xmlDocPtr doc; /* a document instance */
24967 int n_doc;
24968 xmlDtdPtr dtd; /* a dtd instance */
24969 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024970
Daniel Veillard27f20102004-11-05 11:50:11 +000024971 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24972 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24973 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24974 mem_base = xmlMemBlocks();
24975 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24976 doc = gen_xmlDocPtr(n_doc, 1);
24977 dtd = gen_xmlDtdPtr(n_dtd, 2);
24978
24979 ret_val = xmlValidateDtd(ctxt, doc, dtd);
24980 desret_int(ret_val);
24981 call_tests++;
24982 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24983 des_xmlDocPtr(n_doc, doc, 1);
24984 des_xmlDtdPtr(n_dtd, dtd, 2);
24985 xmlResetLastError();
24986 if (mem_base != xmlMemBlocks()) {
24987 printf("Leak of %d blocks found in xmlValidateDtd",
24988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024989 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000024990 printf(" %d", n_ctxt);
24991 printf(" %d", n_doc);
24992 printf(" %d", n_dtd);
24993 printf("\n");
24994 }
24995 }
24996 }
24997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024998 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000024999#endif
25000
Daniel Veillard42595322004-11-08 10:52:06 +000025001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025002}
25003
25004
25005static int
25006test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025008
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025009#ifdef LIBXML_VALID_ENABLED
25010 int mem_base;
25011 int ret_val;
25012 xmlValidCtxtPtr ctxt; /* the validation context */
25013 int n_ctxt;
25014 xmlDocPtr doc; /* a document instance */
25015 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025016
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025017 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25018 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025020 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25021 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025022
25023 ret_val = xmlValidateDtdFinal(ctxt, doc);
25024 desret_int(ret_val);
25025 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025026 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25027 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025028 xmlResetLastError();
25029 if (mem_base != xmlMemBlocks()) {
25030 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025032 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025033 printf(" %d", n_ctxt);
25034 printf(" %d", n_doc);
25035 printf("\n");
25036 }
25037 }
25038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025039 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025040#endif
25041
Daniel Veillard42595322004-11-08 10:52:06 +000025042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025043}
25044
25045
25046static int
25047test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025049
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025050#ifdef LIBXML_VALID_ENABLED
25051 int mem_base;
25052 int ret_val;
25053 xmlValidCtxtPtr ctxt; /* the validation context */
25054 int n_ctxt;
25055 xmlDocPtr doc; /* a document instance */
25056 int n_doc;
25057 xmlNodePtr elem; /* an element instance */
25058 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025059
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025060 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25061 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25062 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25063 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025064 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25065 doc = gen_xmlDocPtr(n_doc, 1);
25066 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025067
25068 ret_val = xmlValidateElement(ctxt, doc, elem);
25069 desret_int(ret_val);
25070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025071 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25072 des_xmlDocPtr(n_doc, doc, 1);
25073 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025074 xmlResetLastError();
25075 if (mem_base != xmlMemBlocks()) {
25076 printf("Leak of %d blocks found in xmlValidateElement",
25077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025078 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025079 printf(" %d", n_ctxt);
25080 printf(" %d", n_doc);
25081 printf(" %d", n_elem);
25082 printf("\n");
25083 }
25084 }
25085 }
25086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025087 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025088#endif
25089
Daniel Veillard42595322004-11-08 10:52:06 +000025090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025091}
25092
25093
25094static int
25095test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025097
Daniel Veillardce682bc2004-11-05 17:22:25 +000025098#ifdef LIBXML_VALID_ENABLED
25099 int mem_base;
25100 int ret_val;
25101 xmlValidCtxtPtr ctxt; /* the validation context */
25102 int n_ctxt;
25103 xmlDocPtr doc; /* a document instance */
25104 int n_doc;
25105 xmlElementPtr elem; /* an element definition */
25106 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025107
Daniel Veillardce682bc2004-11-05 17:22:25 +000025108 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25109 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25110 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25111 mem_base = xmlMemBlocks();
25112 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25113 doc = gen_xmlDocPtr(n_doc, 1);
25114 elem = gen_xmlElementPtr(n_elem, 2);
25115
25116 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25117 desret_int(ret_val);
25118 call_tests++;
25119 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25120 des_xmlDocPtr(n_doc, doc, 1);
25121 des_xmlElementPtr(n_elem, elem, 2);
25122 xmlResetLastError();
25123 if (mem_base != xmlMemBlocks()) {
25124 printf("Leak of %d blocks found in xmlValidateElementDecl",
25125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025126 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025127 printf(" %d", n_ctxt);
25128 printf(" %d", n_doc);
25129 printf(" %d", n_elem);
25130 printf("\n");
25131 }
25132 }
25133 }
25134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025135 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025136#endif
25137
Daniel Veillard42595322004-11-08 10:52:06 +000025138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025139}
25140
25141
25142static int
25143test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025145
25146#ifdef LIBXML_VALID_ENABLED
25147 int mem_base;
25148 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025149 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025150 int n_value;
25151
25152 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025154 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025155
William M. Brackf13f77f2004-11-12 16:03:48 +000025156 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025157 desret_int(ret_val);
25158 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025159 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025160 xmlResetLastError();
25161 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025162 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025164 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025165 printf(" %d", n_value);
25166 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025167 }
25168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025169 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025170#endif
25171
Daniel Veillard42595322004-11-08 10:52:06 +000025172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025173}
25174
25175
25176static int
25177test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025179
25180#ifdef LIBXML_VALID_ENABLED
25181 int mem_base;
25182 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025183 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025184 int n_value;
25185
25186 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025188 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025189
William M. Brackf13f77f2004-11-12 16:03:48 +000025190 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025191 desret_int(ret_val);
25192 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025193 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025194 xmlResetLastError();
25195 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025196 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025198 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025199 printf(" %d", n_value);
25200 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025201 }
25202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025203 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025204#endif
25205
Daniel Veillard42595322004-11-08 10:52:06 +000025206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025207}
25208
25209
25210static int
25211test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025213
25214#ifdef LIBXML_VALID_ENABLED
25215 int mem_base;
25216 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025217 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025218 int n_value;
25219
25220 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025222 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025223
William M. Brackf13f77f2004-11-12 16:03:48 +000025224 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025225 desret_int(ret_val);
25226 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025227 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025228 xmlResetLastError();
25229 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025230 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025232 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025233 printf(" %d", n_value);
25234 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025235 }
25236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025237 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025238#endif
25239
Daniel Veillard42595322004-11-08 10:52:06 +000025240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025241}
25242
25243
25244static int
25245test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025247
25248#ifdef LIBXML_VALID_ENABLED
25249 int mem_base;
25250 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025251 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025252 int n_value;
25253
25254 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25255 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025256 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025257
William M. Brackf13f77f2004-11-12 16:03:48 +000025258 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025259 desret_int(ret_val);
25260 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025261 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025262 xmlResetLastError();
25263 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025264 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025266 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025267 printf(" %d", n_value);
25268 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025269 }
25270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025271 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025272#endif
25273
Daniel Veillard42595322004-11-08 10:52:06 +000025274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025275}
25276
25277
25278static int
25279test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025281
Daniel Veillardce682bc2004-11-05 17:22:25 +000025282#ifdef LIBXML_VALID_ENABLED
25283 int mem_base;
25284 int ret_val;
25285 xmlValidCtxtPtr ctxt; /* the validation context */
25286 int n_ctxt;
25287 xmlDocPtr doc; /* a document instance */
25288 int n_doc;
25289 xmlNotationPtr nota; /* a notation definition */
25290 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025291
Daniel Veillardce682bc2004-11-05 17:22:25 +000025292 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25293 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25294 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25295 mem_base = xmlMemBlocks();
25296 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25297 doc = gen_xmlDocPtr(n_doc, 1);
25298 nota = gen_xmlNotationPtr(n_nota, 2);
25299
25300 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25301 desret_int(ret_val);
25302 call_tests++;
25303 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25304 des_xmlDocPtr(n_doc, doc, 1);
25305 des_xmlNotationPtr(n_nota, nota, 2);
25306 xmlResetLastError();
25307 if (mem_base != xmlMemBlocks()) {
25308 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025310 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025311 printf(" %d", n_ctxt);
25312 printf(" %d", n_doc);
25313 printf(" %d", n_nota);
25314 printf("\n");
25315 }
25316 }
25317 }
25318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025319 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025320#endif
25321
Daniel Veillard42595322004-11-08 10:52:06 +000025322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025323}
25324
25325
25326static int
25327test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025329
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025330#ifdef LIBXML_VALID_ENABLED
25331 int mem_base;
25332 int ret_val;
25333 xmlValidCtxtPtr ctxt; /* the validation context */
25334 int n_ctxt;
25335 xmlDocPtr doc; /* the document */
25336 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025337 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025338 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025339
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025340 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25341 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25342 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25343 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025344 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25345 doc = gen_xmlDocPtr(n_doc, 1);
25346 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025347
William M. Brackf13f77f2004-11-12 16:03:48 +000025348 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025349 desret_int(ret_val);
25350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025351 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25352 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025353 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025354 xmlResetLastError();
25355 if (mem_base != xmlMemBlocks()) {
25356 printf("Leak of %d blocks found in xmlValidateNotationUse",
25357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025358 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025359 printf(" %d", n_ctxt);
25360 printf(" %d", n_doc);
25361 printf(" %d", n_notationName);
25362 printf("\n");
25363 }
25364 }
25365 }
25366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025367 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025368#endif
25369
Daniel Veillard42595322004-11-08 10:52:06 +000025370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025371}
25372
25373
25374static int
25375test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025377
Daniel Veillardce244ad2004-11-05 10:03:46 +000025378#ifdef LIBXML_VALID_ENABLED
25379 int mem_base;
25380 int ret_val;
25381 xmlValidCtxtPtr ctxt; /* the validation context */
25382 int n_ctxt;
25383 xmlDocPtr doc; /* a document instance */
25384 int n_doc;
25385 xmlNodePtr elem; /* an element instance */
25386 int n_elem;
25387 xmlAttrPtr attr; /* an attribute instance */
25388 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025389 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025390 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025391
Daniel Veillardce244ad2004-11-05 10:03:46 +000025392 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25393 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25394 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25395 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25396 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25397 mem_base = xmlMemBlocks();
25398 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25399 doc = gen_xmlDocPtr(n_doc, 1);
25400 elem = gen_xmlNodePtr(n_elem, 2);
25401 attr = gen_xmlAttrPtr(n_attr, 3);
25402 value = gen_const_xmlChar_ptr(n_value, 4);
25403
William M. Brackf13f77f2004-11-12 16:03:48 +000025404 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025405 desret_int(ret_val);
25406 call_tests++;
25407 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25408 des_xmlDocPtr(n_doc, doc, 1);
25409 des_xmlNodePtr(n_elem, elem, 2);
25410 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025411 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025412 xmlResetLastError();
25413 if (mem_base != xmlMemBlocks()) {
25414 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025416 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025417 printf(" %d", n_ctxt);
25418 printf(" %d", n_doc);
25419 printf(" %d", n_elem);
25420 printf(" %d", n_attr);
25421 printf(" %d", n_value);
25422 printf("\n");
25423 }
25424 }
25425 }
25426 }
25427 }
25428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025429 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025430#endif
25431
Daniel Veillard42595322004-11-08 10:52:06 +000025432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025433}
25434
25435
25436static int
25437test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025439
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025440#ifdef LIBXML_VALID_ENABLED
25441 int mem_base;
25442 int ret_val;
25443 xmlValidCtxtPtr ctxt; /* the validation context */
25444 int n_ctxt;
25445 xmlDocPtr doc; /* a document instance */
25446 int n_doc;
25447 xmlNodePtr elem; /* an element instance */
25448 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025449
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025450 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25451 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25452 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025454 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25455 doc = gen_xmlDocPtr(n_doc, 1);
25456 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025457
25458 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25459 desret_int(ret_val);
25460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025461 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25462 des_xmlDocPtr(n_doc, doc, 1);
25463 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025464 xmlResetLastError();
25465 if (mem_base != xmlMemBlocks()) {
25466 printf("Leak of %d blocks found in xmlValidateOneElement",
25467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025468 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025469 printf(" %d", n_ctxt);
25470 printf(" %d", n_doc);
25471 printf(" %d", n_elem);
25472 printf("\n");
25473 }
25474 }
25475 }
25476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025477 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025478#endif
25479
Daniel Veillard42595322004-11-08 10:52:06 +000025480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025481}
25482
25483
25484static int
25485test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025487
Daniel Veillard27f20102004-11-05 11:50:11 +000025488#ifdef LIBXML_VALID_ENABLED
25489 int mem_base;
25490 int ret_val;
25491 xmlValidCtxtPtr ctxt; /* the validation context */
25492 int n_ctxt;
25493 xmlDocPtr doc; /* a document instance */
25494 int n_doc;
25495 xmlNodePtr elem; /* an element instance */
25496 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025497 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025498 int n_prefix;
25499 xmlNsPtr ns; /* an namespace declaration instance */
25500 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025501 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025502 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025503
Daniel Veillard27f20102004-11-05 11:50:11 +000025504 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25505 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25506 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25507 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25508 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25509 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25510 mem_base = xmlMemBlocks();
25511 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25512 doc = gen_xmlDocPtr(n_doc, 1);
25513 elem = gen_xmlNodePtr(n_elem, 2);
25514 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25515 ns = gen_xmlNsPtr(n_ns, 4);
25516 value = gen_const_xmlChar_ptr(n_value, 5);
25517
William M. Brackf13f77f2004-11-12 16:03:48 +000025518 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025519 desret_int(ret_val);
25520 call_tests++;
25521 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25522 des_xmlDocPtr(n_doc, doc, 1);
25523 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025524 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025525 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025526 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025527 xmlResetLastError();
25528 if (mem_base != xmlMemBlocks()) {
25529 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025531 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025532 printf(" %d", n_ctxt);
25533 printf(" %d", n_doc);
25534 printf(" %d", n_elem);
25535 printf(" %d", n_prefix);
25536 printf(" %d", n_ns);
25537 printf(" %d", n_value);
25538 printf("\n");
25539 }
25540 }
25541 }
25542 }
25543 }
25544 }
25545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025546 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025547#endif
25548
Daniel Veillard42595322004-11-08 10:52:06 +000025549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025550}
25551
25552
25553static int
25554test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025556
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025557#ifdef LIBXML_REGEXP_ENABLED
25558 int mem_base;
25559 int ret_val;
25560 xmlValidCtxtPtr ctxt; /* the validation context */
25561 int n_ctxt;
25562 xmlDocPtr doc; /* a document instance */
25563 int n_doc;
25564 xmlNodePtr elem; /* an element instance */
25565 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025566 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025567 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025568
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025569 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25570 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25571 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25572 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25573 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025574 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25575 doc = gen_xmlDocPtr(n_doc, 1);
25576 elem = gen_xmlNodePtr(n_elem, 2);
25577 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025578
William M. Brackf13f77f2004-11-12 16:03:48 +000025579 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025580 desret_int(ret_val);
25581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025582 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25583 des_xmlDocPtr(n_doc, doc, 1);
25584 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025585 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025586 xmlResetLastError();
25587 if (mem_base != xmlMemBlocks()) {
25588 printf("Leak of %d blocks found in xmlValidatePopElement",
25589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025590 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025591 printf(" %d", n_ctxt);
25592 printf(" %d", n_doc);
25593 printf(" %d", n_elem);
25594 printf(" %d", n_qname);
25595 printf("\n");
25596 }
25597 }
25598 }
25599 }
25600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025601 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025602#endif
25603
Daniel Veillard42595322004-11-08 10:52:06 +000025604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025605}
25606
25607
25608static int
25609test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025611
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025612#ifdef LIBXML_REGEXP_ENABLED
25613 int mem_base;
25614 int ret_val;
25615 xmlValidCtxtPtr ctxt; /* the validation context */
25616 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025617 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025618 int n_data;
25619 int len; /* the lenght of the data */
25620 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025621
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25623 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25624 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25625 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025626 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25627 data = gen_const_xmlChar_ptr(n_data, 1);
25628 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025629
William M. Brackf13f77f2004-11-12 16:03:48 +000025630 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025631 desret_int(ret_val);
25632 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025633 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025634 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025635 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025636 xmlResetLastError();
25637 if (mem_base != xmlMemBlocks()) {
25638 printf("Leak of %d blocks found in xmlValidatePushCData",
25639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025640 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025641 printf(" %d", n_ctxt);
25642 printf(" %d", n_data);
25643 printf(" %d", n_len);
25644 printf("\n");
25645 }
25646 }
25647 }
25648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025649 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025650#endif
25651
Daniel Veillard42595322004-11-08 10:52:06 +000025652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025653}
25654
25655
25656static int
25657test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025659
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025660#ifdef LIBXML_REGEXP_ENABLED
25661 int mem_base;
25662 int ret_val;
25663 xmlValidCtxtPtr ctxt; /* the validation context */
25664 int n_ctxt;
25665 xmlDocPtr doc; /* a document instance */
25666 int n_doc;
25667 xmlNodePtr elem; /* an element instance */
25668 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025669 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025670 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025671
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025672 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25673 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25674 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25675 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25676 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025677 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25678 doc = gen_xmlDocPtr(n_doc, 1);
25679 elem = gen_xmlNodePtr(n_elem, 2);
25680 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025681
William M. Brackf13f77f2004-11-12 16:03:48 +000025682 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025683 desret_int(ret_val);
25684 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025685 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25686 des_xmlDocPtr(n_doc, doc, 1);
25687 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025688 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025689 xmlResetLastError();
25690 if (mem_base != xmlMemBlocks()) {
25691 printf("Leak of %d blocks found in xmlValidatePushElement",
25692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025693 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025694 printf(" %d", n_ctxt);
25695 printf(" %d", n_doc);
25696 printf(" %d", n_elem);
25697 printf(" %d", n_qname);
25698 printf("\n");
25699 }
25700 }
25701 }
25702 }
25703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025704 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025705#endif
25706
Daniel Veillard42595322004-11-08 10:52:06 +000025707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025708}
25709
25710
25711static int
25712test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025714
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025715#ifdef LIBXML_VALID_ENABLED
25716 int mem_base;
25717 int ret_val;
25718 xmlValidCtxtPtr ctxt; /* the validation context */
25719 int n_ctxt;
25720 xmlDocPtr doc; /* a document instance */
25721 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025722
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025723 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25724 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25725 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025726 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25727 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025728
25729 ret_val = xmlValidateRoot(ctxt, doc);
25730 desret_int(ret_val);
25731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025732 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25733 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025734 xmlResetLastError();
25735 if (mem_base != xmlMemBlocks()) {
25736 printf("Leak of %d blocks found in xmlValidateRoot",
25737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025738 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025739 printf(" %d", n_ctxt);
25740 printf(" %d", n_doc);
25741 printf("\n");
25742 }
25743 }
25744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025745 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025746#endif
25747
Daniel Veillard42595322004-11-08 10:52:06 +000025748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025749}
25750
25751static int
25752test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025754
William M. Brack094dd862004-11-14 14:28:34 +000025755 if (quiet == 0) printf("Testing valid : 48 of 67 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025756 test_ret += test_xmlAddAttributeDecl();
25757 test_ret += test_xmlAddElementDecl();
25758 test_ret += test_xmlAddID();
25759 test_ret += test_xmlAddNotationDecl();
25760 test_ret += test_xmlAddRef();
25761 test_ret += test_xmlCopyAttributeTable();
25762 test_ret += test_xmlCopyElementContent();
25763 test_ret += test_xmlCopyElementTable();
25764 test_ret += test_xmlCopyEnumeration();
25765 test_ret += test_xmlCopyNotationTable();
25766 test_ret += test_xmlCreateEnumeration();
25767 test_ret += test_xmlDumpAttributeDecl();
25768 test_ret += test_xmlDumpAttributeTable();
25769 test_ret += test_xmlDumpElementDecl();
25770 test_ret += test_xmlDumpElementTable();
25771 test_ret += test_xmlDumpNotationDecl();
25772 test_ret += test_xmlDumpNotationTable();
25773 test_ret += test_xmlGetDtdAttrDesc();
25774 test_ret += test_xmlGetDtdElementDesc();
25775 test_ret += test_xmlGetDtdNotationDesc();
25776 test_ret += test_xmlGetDtdQAttrDesc();
25777 test_ret += test_xmlGetDtdQElementDesc();
25778 test_ret += test_xmlGetID();
25779 test_ret += test_xmlGetRefs();
25780 test_ret += test_xmlIsID();
25781 test_ret += test_xmlIsMixedElement();
25782 test_ret += test_xmlIsRef();
25783 test_ret += test_xmlNewElementContent();
25784 test_ret += test_xmlNewValidCtxt();
25785 test_ret += test_xmlRemoveID();
25786 test_ret += test_xmlRemoveRef();
25787 test_ret += test_xmlSnprintfElementContent();
25788 test_ret += test_xmlSprintfElementContent();
25789 test_ret += test_xmlValidBuildContentModel();
25790 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25791 test_ret += test_xmlValidGetPotentialChildren();
25792 test_ret += test_xmlValidGetValidElements();
25793 test_ret += test_xmlValidNormalizeAttributeValue();
25794 test_ret += test_xmlValidateAttributeDecl();
25795 test_ret += test_xmlValidateAttributeValue();
25796 test_ret += test_xmlValidateDocument();
25797 test_ret += test_xmlValidateDocumentFinal();
25798 test_ret += test_xmlValidateDtd();
25799 test_ret += test_xmlValidateDtdFinal();
25800 test_ret += test_xmlValidateElement();
25801 test_ret += test_xmlValidateElementDecl();
25802 test_ret += test_xmlValidateNameValue();
25803 test_ret += test_xmlValidateNamesValue();
25804 test_ret += test_xmlValidateNmtokenValue();
25805 test_ret += test_xmlValidateNmtokensValue();
25806 test_ret += test_xmlValidateNotationDecl();
25807 test_ret += test_xmlValidateNotationUse();
25808 test_ret += test_xmlValidateOneAttribute();
25809 test_ret += test_xmlValidateOneElement();
25810 test_ret += test_xmlValidateOneNamespace();
25811 test_ret += test_xmlValidatePopElement();
25812 test_ret += test_xmlValidatePushCData();
25813 test_ret += test_xmlValidatePushElement();
25814 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025815
Daniel Veillard42595322004-11-08 10:52:06 +000025816 if (test_ret != 0)
25817 printf("Module valid: %d errors\n", test_ret);
25818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025819}
25820
25821static int
25822test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025824
25825
25826 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025828}
25829
25830
25831static int
25832test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025834
25835#ifdef LIBXML_XINCLUDE_ENABLED
25836 int mem_base;
25837 int ret_val;
25838 xmlDocPtr doc; /* an XML document */
25839 int n_doc;
25840
25841 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25842 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025843 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025844
25845 ret_val = xmlXIncludeProcess(doc);
25846 desret_int(ret_val);
25847 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025848 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025849 xmlResetLastError();
25850 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025851 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025853 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025854 printf(" %d", n_doc);
25855 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025856 }
25857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025858 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025859#endif
25860
Daniel Veillard42595322004-11-08 10:52:06 +000025861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025862}
25863
25864
25865static int
25866test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025868
25869#ifdef LIBXML_XINCLUDE_ENABLED
25870 int mem_base;
25871 int ret_val;
25872 xmlDocPtr doc; /* an XML document */
25873 int n_doc;
25874 int flags; /* a set of xmlParserOption used for parsing XML includes */
25875 int n_flags;
25876
25877 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25878 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025880 doc = gen_xmlDocPtr(n_doc, 0);
25881 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025882
25883 ret_val = xmlXIncludeProcessFlags(doc, flags);
25884 desret_int(ret_val);
25885 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025886 des_xmlDocPtr(n_doc, doc, 0);
25887 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025888 xmlResetLastError();
25889 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025890 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025892 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025893 printf(" %d", n_doc);
25894 printf(" %d", n_flags);
25895 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025896 }
25897 }
25898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025899 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025900#endif
25901
Daniel Veillard42595322004-11-08 10:52:06 +000025902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025903}
25904
Daniel Veillarda521d282004-11-09 14:59:59 +000025905#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000025906
Daniel Veillardce682bc2004-11-05 17:22:25 +000025907#define gen_nb_xmlXIncludeCtxtPtr 1
25908static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25909 return(NULL);
25910}
25911static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25912}
Daniel Veillarda521d282004-11-09 14:59:59 +000025913#endif
25914
Daniel Veillardce682bc2004-11-05 17:22:25 +000025915
Daniel Veillardd93f6252004-11-02 15:53:51 +000025916static int
25917test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025919
Daniel Veillardce682bc2004-11-05 17:22:25 +000025920#ifdef LIBXML_XINCLUDE_ENABLED
25921 int mem_base;
25922 int ret_val;
25923 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
25924 int n_ctxt;
25925 xmlNodePtr node; /* a node in an XML document */
25926 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025927
Daniel Veillardce682bc2004-11-05 17:22:25 +000025928 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25929 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
25930 mem_base = xmlMemBlocks();
25931 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25932 node = gen_xmlNodePtr(n_node, 1);
25933
25934 ret_val = xmlXIncludeProcessNode(ctxt, node);
25935 desret_int(ret_val);
25936 call_tests++;
25937 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25938 des_xmlNodePtr(n_node, node, 1);
25939 xmlResetLastError();
25940 if (mem_base != xmlMemBlocks()) {
25941 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
25942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025943 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025944 printf(" %d", n_ctxt);
25945 printf(" %d", n_node);
25946 printf("\n");
25947 }
25948 }
25949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025950 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025951#endif
25952
Daniel Veillard42595322004-11-08 10:52:06 +000025953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025954}
25955
25956
25957static int
25958test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025960
25961#ifdef LIBXML_XINCLUDE_ENABLED
25962 int mem_base;
25963 int ret_val;
25964 xmlNodePtr tree; /* a node in an XML document */
25965 int n_tree;
25966
25967 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25968 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025969 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025970
25971 ret_val = xmlXIncludeProcessTree(tree);
25972 desret_int(ret_val);
25973 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025974 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025975 xmlResetLastError();
25976 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025977 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025979 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025980 printf(" %d", n_tree);
25981 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025982 }
25983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025984 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025985#endif
25986
Daniel Veillard42595322004-11-08 10:52:06 +000025987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025988}
25989
25990
25991static int
25992test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025994
25995#ifdef LIBXML_XINCLUDE_ENABLED
25996 int mem_base;
25997 int ret_val;
25998 xmlNodePtr tree; /* a node in an XML document */
25999 int n_tree;
26000 int flags; /* a set of xmlParserOption used for parsing XML includes */
26001 int n_flags;
26002
26003 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26004 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026006 tree = gen_xmlNodePtr(n_tree, 0);
26007 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026008
26009 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26010 desret_int(ret_val);
26011 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026012 des_xmlNodePtr(n_tree, tree, 0);
26013 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026014 xmlResetLastError();
26015 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026016 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026018 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026019 printf(" %d", n_tree);
26020 printf(" %d", n_flags);
26021 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026022 }
26023 }
26024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026025 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026026#endif
26027
Daniel Veillard42595322004-11-08 10:52:06 +000026028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026029}
26030
26031
26032static int
26033test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026035
Daniel Veillardce682bc2004-11-05 17:22:25 +000026036#ifdef LIBXML_XINCLUDE_ENABLED
26037 int mem_base;
26038 int ret_val;
26039 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26040 int n_ctxt;
26041 int flags; /* a set of xmlParserOption used for parsing XML includes */
26042 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026043
Daniel Veillardce682bc2004-11-05 17:22:25 +000026044 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26045 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26046 mem_base = xmlMemBlocks();
26047 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26048 flags = gen_int(n_flags, 1);
26049
26050 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26051 desret_int(ret_val);
26052 call_tests++;
26053 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26054 des_int(n_flags, flags, 1);
26055 xmlResetLastError();
26056 if (mem_base != xmlMemBlocks()) {
26057 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026059 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026060 printf(" %d", n_ctxt);
26061 printf(" %d", n_flags);
26062 printf("\n");
26063 }
26064 }
26065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026066 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026067#endif
26068
Daniel Veillard42595322004-11-08 10:52:06 +000026069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026070}
26071
26072static int
26073test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026075
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026076 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026077 test_ret += test_xmlXIncludeNewContext();
26078 test_ret += test_xmlXIncludeProcess();
26079 test_ret += test_xmlXIncludeProcessFlags();
26080 test_ret += test_xmlXIncludeProcessNode();
26081 test_ret += test_xmlXIncludeProcessTree();
26082 test_ret += test_xmlXIncludeProcessTreeFlags();
26083 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026084
Daniel Veillard42595322004-11-08 10:52:06 +000026085 if (test_ret != 0)
26086 printf("Module xinclude: %d errors\n", test_ret);
26087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026088}
26089
26090static int
26091test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026093
Daniel Veillard3d95c732004-11-06 22:25:14 +000026094#ifdef LIBXML_OUTPUT_ENABLED
26095 int mem_base;
26096 xmlOutputBufferPtr ret_val;
26097 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26098 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026099
Daniel Veillard3d95c732004-11-06 22:25:14 +000026100 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26101 mem_base = xmlMemBlocks();
26102 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26103
26104 ret_val = xmlAllocOutputBuffer(encoder);
26105 desret_xmlOutputBufferPtr(ret_val);
26106 call_tests++;
26107 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26108 xmlResetLastError();
26109 if (mem_base != xmlMemBlocks()) {
26110 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026112 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026113 printf(" %d", n_encoder);
26114 printf("\n");
26115 }
26116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026117 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026118#endif
26119
Daniel Veillard42595322004-11-08 10:52:06 +000026120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026121}
26122
26123
26124static int
26125test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026127
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026128 int mem_base;
26129 xmlParserInputBufferPtr ret_val;
26130 xmlCharEncoding enc; /* the charset encoding if known */
26131 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026132
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026133 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26134 mem_base = xmlMemBlocks();
26135 enc = gen_xmlCharEncoding(n_enc, 0);
26136
26137 ret_val = xmlAllocParserInputBuffer(enc);
26138 desret_xmlParserInputBufferPtr(ret_val);
26139 call_tests++;
26140 des_xmlCharEncoding(n_enc, enc, 0);
26141 xmlResetLastError();
26142 if (mem_base != xmlMemBlocks()) {
26143 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026145 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026146 printf(" %d", n_enc);
26147 printf("\n");
26148 }
26149 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026150 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026151
Daniel Veillard42595322004-11-08 10:52:06 +000026152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026153}
26154
26155
26156static int
26157test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026159
26160 int mem_base;
26161 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026162 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026163 int n_path;
26164
26165 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026167 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026168
William M. Brackf13f77f2004-11-12 16:03:48 +000026169 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026170 desret_int(ret_val);
26171 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026172 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026173 xmlResetLastError();
26174 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026175 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026177 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026178 printf(" %d", n_path);
26179 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026180 }
26181 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026182 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026183
Daniel Veillard42595322004-11-08 10:52:06 +000026184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026185}
26186
26187
26188static int
26189test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026191
Daniel Veillard42595322004-11-08 10:52:06 +000026192 int mem_base;
26193 xmlParserInputPtr ret_val;
26194 xmlParserCtxtPtr ctxt; /* an XML parser context */
26195 int n_ctxt;
26196 xmlParserInputPtr ret; /* an XML parser input */
26197 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026198
Daniel Veillard42595322004-11-08 10:52:06 +000026199 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26200 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26201 mem_base = xmlMemBlocks();
26202 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26203 ret = gen_xmlParserInputPtr(n_ret, 1);
26204
26205 ret_val = xmlCheckHTTPInput(ctxt, ret);
26206 desret_xmlParserInputPtr(ret_val);
26207 call_tests++;
26208 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26209 des_xmlParserInputPtr(n_ret, ret, 1);
26210 xmlResetLastError();
26211 if (mem_base != xmlMemBlocks()) {
26212 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26213 xmlMemBlocks() - mem_base);
26214 test_ret++;
26215 printf(" %d", n_ctxt);
26216 printf(" %d", n_ret);
26217 printf("\n");
26218 }
26219 }
26220 }
Daniel Veillard42595322004-11-08 10:52:06 +000026221 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026222
Daniel Veillard42595322004-11-08 10:52:06 +000026223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026224}
26225
26226
26227static int
26228test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026230
26231 int mem_base;
26232
26233 mem_base = xmlMemBlocks();
26234
26235 xmlCleanupInputCallbacks();
26236 call_tests++;
26237 xmlResetLastError();
26238 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026239 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026241 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026242 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026243 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026244 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026245
Daniel Veillard42595322004-11-08 10:52:06 +000026246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026247}
26248
26249
26250static int
26251test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026253
26254#ifdef LIBXML_OUTPUT_ENABLED
26255 int mem_base;
26256
26257 mem_base = xmlMemBlocks();
26258
26259 xmlCleanupOutputCallbacks();
26260 call_tests++;
26261 xmlResetLastError();
26262 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026263 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026265 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026266 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026268 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026269#endif
26270
Daniel Veillard42595322004-11-08 10:52:06 +000026271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026272}
26273
26274
26275static int
26276test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026278
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026279 int mem_base;
26280 int ret_val;
26281 void * context; /* the I/O context */
26282 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026283
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026284 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26285 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026286 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026287
26288 ret_val = xmlFileClose(context);
26289 desret_int(ret_val);
26290 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026291 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026292 xmlResetLastError();
26293 if (mem_base != xmlMemBlocks()) {
26294 printf("Leak of %d blocks found in xmlFileClose",
26295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026296 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026297 printf(" %d", n_context);
26298 printf("\n");
26299 }
26300 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026301 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026302
Daniel Veillard42595322004-11-08 10:52:06 +000026303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026304}
26305
26306
26307static int
26308test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026310
26311 int mem_base;
26312 int ret_val;
26313 const char * filename; /* the URI for matching */
26314 int n_filename;
26315
26316 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26317 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026318 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026319
26320 ret_val = xmlFileMatch(filename);
26321 desret_int(ret_val);
26322 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026323 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026324 xmlResetLastError();
26325 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026326 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026328 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026329 printf(" %d", n_filename);
26330 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026331 }
26332 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026333 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026334
Daniel Veillard42595322004-11-08 10:52:06 +000026335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026336}
26337
26338
26339static int
26340test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026342
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026343 int mem_base;
26344 void * ret_val;
26345 const char * filename; /* the URI for matching */
26346 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026347
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026348 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26349 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026350 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026351
26352 ret_val = xmlFileOpen(filename);
26353 desret_void_ptr(ret_val);
26354 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026355 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026356 xmlResetLastError();
26357 if (mem_base != xmlMemBlocks()) {
26358 printf("Leak of %d blocks found in xmlFileOpen",
26359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026360 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026361 printf(" %d", n_filename);
26362 printf("\n");
26363 }
26364 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026365 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026366
Daniel Veillard42595322004-11-08 10:52:06 +000026367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026368}
26369
26370
26371static int
26372test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374
Daniel Veillardce682bc2004-11-05 17:22:25 +000026375 int mem_base;
26376 int ret_val;
26377 void * context; /* the I/O context */
26378 int n_context;
26379 char * buffer; /* where to drop data */
26380 int n_buffer;
26381 int len; /* number of bytes to write */
26382 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026383
Daniel Veillardce682bc2004-11-05 17:22:25 +000026384 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26385 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26386 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26387 mem_base = xmlMemBlocks();
26388 context = gen_void_ptr(n_context, 0);
26389 buffer = gen_char_ptr(n_buffer, 1);
26390 len = gen_int(n_len, 2);
26391
26392 ret_val = xmlFileRead(context, buffer, len);
26393 desret_int(ret_val);
26394 call_tests++;
26395 des_void_ptr(n_context, context, 0);
26396 des_char_ptr(n_buffer, buffer, 1);
26397 des_int(n_len, len, 2);
26398 xmlResetLastError();
26399 if (mem_base != xmlMemBlocks()) {
26400 printf("Leak of %d blocks found in xmlFileRead",
26401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026402 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026403 printf(" %d", n_context);
26404 printf(" %d", n_buffer);
26405 printf(" %d", n_len);
26406 printf("\n");
26407 }
26408 }
26409 }
26410 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026412
Daniel Veillard42595322004-11-08 10:52:06 +000026413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026414}
26415
26416
26417static int
26418test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026420
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026421#ifdef LIBXML_FTP_ENABLED
26422 int mem_base;
26423 int ret_val;
26424 void * context; /* the I/O context */
26425 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026426
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026427 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026429 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026430
26431 ret_val = xmlIOFTPClose(context);
26432 desret_int(ret_val);
26433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026434 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026435 xmlResetLastError();
26436 if (mem_base != xmlMemBlocks()) {
26437 printf("Leak of %d blocks found in xmlIOFTPClose",
26438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026439 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026440 printf(" %d", n_context);
26441 printf("\n");
26442 }
26443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026444 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026445#endif
26446
Daniel Veillard42595322004-11-08 10:52:06 +000026447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026448}
26449
26450
26451static int
26452test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026454
26455#ifdef LIBXML_FTP_ENABLED
26456 int mem_base;
26457 int ret_val;
26458 const char * filename; /* the URI for matching */
26459 int n_filename;
26460
26461 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026463 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026464
26465 ret_val = xmlIOFTPMatch(filename);
26466 desret_int(ret_val);
26467 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026468 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026469 xmlResetLastError();
26470 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026471 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026473 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026474 printf(" %d", n_filename);
26475 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026476 }
26477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026478 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026479#endif
26480
Daniel Veillard42595322004-11-08 10:52:06 +000026481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026482}
26483
26484
26485static int
26486test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026488
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026489#ifdef LIBXML_FTP_ENABLED
26490 int mem_base;
26491 void * ret_val;
26492 const char * filename; /* the URI for matching */
26493 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026494
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026495 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26496 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026497 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026498
26499 ret_val = xmlIOFTPOpen(filename);
26500 desret_void_ptr(ret_val);
26501 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026502 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026503 xmlResetLastError();
26504 if (mem_base != xmlMemBlocks()) {
26505 printf("Leak of %d blocks found in xmlIOFTPOpen",
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_filename);
26509 printf("\n");
26510 }
26511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026512 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026513#endif
26514
Daniel Veillard42595322004-11-08 10:52:06 +000026515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026516}
26517
26518
26519static int
26520test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026522
Daniel Veillardce682bc2004-11-05 17:22:25 +000026523#ifdef LIBXML_FTP_ENABLED
26524 int mem_base;
26525 int ret_val;
26526 void * context; /* the I/O context */
26527 int n_context;
26528 char * buffer; /* where to drop data */
26529 int n_buffer;
26530 int len; /* number of bytes to write */
26531 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026532
Daniel Veillardce682bc2004-11-05 17:22:25 +000026533 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26534 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26535 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26536 mem_base = xmlMemBlocks();
26537 context = gen_void_ptr(n_context, 0);
26538 buffer = gen_char_ptr(n_buffer, 1);
26539 len = gen_int(n_len, 2);
26540
26541 ret_val = xmlIOFTPRead(context, buffer, len);
26542 desret_int(ret_val);
26543 call_tests++;
26544 des_void_ptr(n_context, context, 0);
26545 des_char_ptr(n_buffer, buffer, 1);
26546 des_int(n_len, len, 2);
26547 xmlResetLastError();
26548 if (mem_base != xmlMemBlocks()) {
26549 printf("Leak of %d blocks found in xmlIOFTPRead",
26550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026551 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026552 printf(" %d", n_context);
26553 printf(" %d", n_buffer);
26554 printf(" %d", n_len);
26555 printf("\n");
26556 }
26557 }
26558 }
26559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026560 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026561#endif
26562
Daniel Veillard42595322004-11-08 10:52:06 +000026563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026564}
26565
26566
26567static int
26568test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026570
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026571#ifdef LIBXML_HTTP_ENABLED
26572 int mem_base;
26573 int ret_val;
26574 void * context; /* the I/O context */
26575 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026576
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026577 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026579 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026580
26581 ret_val = xmlIOHTTPClose(context);
26582 desret_int(ret_val);
26583 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026584 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026585 xmlResetLastError();
26586 if (mem_base != xmlMemBlocks()) {
26587 printf("Leak of %d blocks found in xmlIOHTTPClose",
26588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026589 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026590 printf(" %d", n_context);
26591 printf("\n");
26592 }
26593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026594 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026595#endif
26596
Daniel Veillard42595322004-11-08 10:52:06 +000026597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026598}
26599
26600
26601static int
26602test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026604
26605#ifdef LIBXML_HTTP_ENABLED
26606 int mem_base;
26607 int ret_val;
26608 const char * filename; /* the URI for matching */
26609 int n_filename;
26610
26611 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26612 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026613 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026614
26615 ret_val = xmlIOHTTPMatch(filename);
26616 desret_int(ret_val);
26617 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026618 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026619 xmlResetLastError();
26620 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026621 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026623 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026624 printf(" %d", n_filename);
26625 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026626 }
26627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026628 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026629#endif
26630
Daniel Veillard42595322004-11-08 10:52:06 +000026631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026632}
26633
26634
26635static int
26636test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026638
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026639#ifdef LIBXML_HTTP_ENABLED
26640 int mem_base;
26641 void * ret_val;
26642 const char * filename; /* the URI for matching */
26643 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026644
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026645 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26646 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026647 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026648
26649 ret_val = xmlIOHTTPOpen(filename);
26650 desret_void_ptr(ret_val);
26651 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026652 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026653 xmlResetLastError();
26654 if (mem_base != xmlMemBlocks()) {
26655 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026657 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026658 printf(" %d", n_filename);
26659 printf("\n");
26660 }
26661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026662 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026663#endif
26664
Daniel Veillard42595322004-11-08 10:52:06 +000026665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026666}
26667
26668
26669static int
26670test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026672
26673
26674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026676}
26677
26678
26679static int
26680test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026682
Daniel Veillardce682bc2004-11-05 17:22:25 +000026683#ifdef LIBXML_HTTP_ENABLED
26684 int mem_base;
26685 int ret_val;
26686 void * context; /* the I/O context */
26687 int n_context;
26688 char * buffer; /* where to drop data */
26689 int n_buffer;
26690 int len; /* number of bytes to write */
26691 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026692
Daniel Veillardce682bc2004-11-05 17:22:25 +000026693 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26694 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26695 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26696 mem_base = xmlMemBlocks();
26697 context = gen_void_ptr(n_context, 0);
26698 buffer = gen_char_ptr(n_buffer, 1);
26699 len = gen_int(n_len, 2);
26700
26701 ret_val = xmlIOHTTPRead(context, buffer, len);
26702 desret_int(ret_val);
26703 call_tests++;
26704 des_void_ptr(n_context, context, 0);
26705 des_char_ptr(n_buffer, buffer, 1);
26706 des_int(n_len, len, 2);
26707 xmlResetLastError();
26708 if (mem_base != xmlMemBlocks()) {
26709 printf("Leak of %d blocks found in xmlIOHTTPRead",
26710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026711 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026712 printf(" %d", n_context);
26713 printf(" %d", n_buffer);
26714 printf(" %d", n_len);
26715 printf("\n");
26716 }
26717 }
26718 }
26719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026720 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026721#endif
26722
Daniel Veillard42595322004-11-08 10:52:06 +000026723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026724}
26725
26726
26727static int
26728test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026730
Daniel Veillard42595322004-11-08 10:52:06 +000026731 int mem_base;
26732 xmlParserInputPtr ret_val;
26733 const char * URL; /* the URL for the entity to load */
26734 int n_URL;
26735 char * ID; /* the System ID for the entity to load */
26736 int n_ID;
26737 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26738 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026739
Daniel Veillard42595322004-11-08 10:52:06 +000026740 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26741 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26742 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26743 mem_base = xmlMemBlocks();
26744 URL = gen_filepath(n_URL, 0);
26745 ID = gen_const_char_ptr(n_ID, 1);
26746 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26747
William M. Brackf13f77f2004-11-12 16:03:48 +000026748 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026749 desret_xmlParserInputPtr(ret_val);
26750 call_tests++;
26751 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026752 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026753 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26754 xmlResetLastError();
26755 if (mem_base != xmlMemBlocks()) {
26756 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26757 xmlMemBlocks() - mem_base);
26758 test_ret++;
26759 printf(" %d", n_URL);
26760 printf(" %d", n_ID);
26761 printf(" %d", n_ctxt);
26762 printf("\n");
26763 }
26764 }
26765 }
26766 }
Daniel Veillard42595322004-11-08 10:52:06 +000026767 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026768
Daniel Veillard42595322004-11-08 10:52:06 +000026769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026770}
26771
26772
26773static int
26774test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026776
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026777 int mem_base;
26778 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026779 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026780 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026781
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026782 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026784 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026785
William M. Brackf13f77f2004-11-12 16:03:48 +000026786 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026787 desret_xmlChar_ptr(ret_val);
26788 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026789 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026790 xmlResetLastError();
26791 if (mem_base != xmlMemBlocks()) {
26792 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026794 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026795 printf(" %d", n_path);
26796 printf("\n");
26797 }
26798 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026799 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026800
Daniel Veillard42595322004-11-08 10:52:06 +000026801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026802}
26803
26804
26805static int
26806test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808
Daniel Veillard3d95c732004-11-06 22:25:14 +000026809#ifdef LIBXML_OUTPUT_ENABLED
26810 int mem_base;
26811 xmlOutputBufferPtr ret_val;
26812 int fd; /* a file descriptor number */
26813 int n_fd;
26814 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26815 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026816
Daniel Veillard3d95c732004-11-06 22:25:14 +000026817 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26818 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26819 mem_base = xmlMemBlocks();
26820 fd = gen_int(n_fd, 0);
26821 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26822
26823 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26824 desret_xmlOutputBufferPtr(ret_val);
26825 call_tests++;
26826 des_int(n_fd, fd, 0);
26827 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26828 xmlResetLastError();
26829 if (mem_base != xmlMemBlocks()) {
26830 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026832 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026833 printf(" %d", n_fd);
26834 printf(" %d", n_encoder);
26835 printf("\n");
26836 }
26837 }
26838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026839 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +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_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026849
Daniel Veillard3d95c732004-11-06 22:25:14 +000026850#ifdef LIBXML_OUTPUT_ENABLED
26851 int mem_base;
26852 xmlOutputBufferPtr ret_val;
26853 FILE * file; /* a FILE* */
26854 int n_file;
26855 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26856 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026857
Daniel Veillard3d95c732004-11-06 22:25:14 +000026858 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26859 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26860 mem_base = xmlMemBlocks();
26861 file = gen_FILE_ptr(n_file, 0);
26862 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26863
26864 ret_val = xmlOutputBufferCreateFile(file, encoder);
26865 desret_xmlOutputBufferPtr(ret_val);
26866 call_tests++;
26867 des_FILE_ptr(n_file, file, 0);
26868 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26869 xmlResetLastError();
26870 if (mem_base != xmlMemBlocks()) {
26871 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026873 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026874 printf(" %d", n_file);
26875 printf(" %d", n_encoder);
26876 printf("\n");
26877 }
26878 }
26879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026880 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026881#endif
26882
Daniel Veillard42595322004-11-08 10:52:06 +000026883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026884}
26885
26886
26887static int
26888test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026890
Daniel Veillard3d95c732004-11-06 22:25:14 +000026891#ifdef LIBXML_OUTPUT_ENABLED
26892 int mem_base;
26893 xmlOutputBufferPtr ret_val;
26894 const char * URI; /* a C string containing the URI or filename */
26895 int n_URI;
26896 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26897 int n_encoder;
26898 int compression; /* the compression ration (0 none, 9 max). */
26899 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026900
Daniel Veillard42595322004-11-08 10:52:06 +000026901 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000026902 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26903 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
26904 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026905 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026906 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26907 compression = gen_int(n_compression, 2);
26908
26909 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
26910 desret_xmlOutputBufferPtr(ret_val);
26911 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026912 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026913 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26914 des_int(n_compression, compression, 2);
26915 xmlResetLastError();
26916 if (mem_base != xmlMemBlocks()) {
26917 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
26918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026919 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026920 printf(" %d", n_URI);
26921 printf(" %d", n_encoder);
26922 printf(" %d", n_compression);
26923 printf("\n");
26924 }
26925 }
26926 }
26927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026928 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026929#endif
26930
Daniel Veillard42595322004-11-08 10:52:06 +000026931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026932}
26933
26934
26935static int
26936test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026938
Daniel Veillard3d97e662004-11-04 10:49:00 +000026939#ifdef LIBXML_OUTPUT_ENABLED
26940 int mem_base;
26941 int ret_val;
26942 xmlOutputBufferPtr out; /* a buffered output */
26943 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026944
Daniel Veillard3d97e662004-11-04 10:49:00 +000026945 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26946 mem_base = xmlMemBlocks();
26947 out = gen_xmlOutputBufferPtr(n_out, 0);
26948
26949 ret_val = xmlOutputBufferFlush(out);
26950 desret_int(ret_val);
26951 call_tests++;
26952 des_xmlOutputBufferPtr(n_out, out, 0);
26953 xmlResetLastError();
26954 if (mem_base != xmlMemBlocks()) {
26955 printf("Leak of %d blocks found in xmlOutputBufferFlush",
26956 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026957 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026958 printf(" %d", n_out);
26959 printf("\n");
26960 }
26961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026962 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026963#endif
26964
Daniel Veillard42595322004-11-08 10:52:06 +000026965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026966}
26967
26968
26969static int
26970test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026972
Daniel Veillard3d97e662004-11-04 10:49:00 +000026973#ifdef LIBXML_OUTPUT_ENABLED
26974 int mem_base;
26975 int ret_val;
26976 xmlOutputBufferPtr out; /* a buffered parser output */
26977 int n_out;
26978 int len; /* the size in bytes of the array. */
26979 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026980 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000026981 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026982
Daniel Veillard3d97e662004-11-04 10:49:00 +000026983 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26984 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26985 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
26986 mem_base = xmlMemBlocks();
26987 out = gen_xmlOutputBufferPtr(n_out, 0);
26988 len = gen_int(n_len, 1);
26989 buf = gen_const_char_ptr(n_buf, 2);
26990
William M. Brackf13f77f2004-11-12 16:03:48 +000026991 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000026992 desret_int(ret_val);
26993 call_tests++;
26994 des_xmlOutputBufferPtr(n_out, out, 0);
26995 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000026996 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000026997 xmlResetLastError();
26998 if (mem_base != xmlMemBlocks()) {
26999 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027001 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027002 printf(" %d", n_out);
27003 printf(" %d", n_len);
27004 printf(" %d", n_buf);
27005 printf("\n");
27006 }
27007 }
27008 }
27009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027010 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027011#endif
27012
Daniel Veillard42595322004-11-08 10:52:06 +000027013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027014}
27015
27016
27017static int
27018test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027020
27021
27022 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027024}
27025
27026
27027static int
27028test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027030
Daniel Veillard3d97e662004-11-04 10:49:00 +000027031#ifdef LIBXML_OUTPUT_ENABLED
27032 int mem_base;
27033 int ret_val;
27034 xmlOutputBufferPtr out; /* a buffered parser output */
27035 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027036 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027037 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027038
Daniel Veillard3d97e662004-11-04 10:49:00 +000027039 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27040 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27041 mem_base = xmlMemBlocks();
27042 out = gen_xmlOutputBufferPtr(n_out, 0);
27043 str = gen_const_char_ptr(n_str, 1);
27044
William M. Brackf13f77f2004-11-12 16:03:48 +000027045 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027046 desret_int(ret_val);
27047 call_tests++;
27048 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027049 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027050 xmlResetLastError();
27051 if (mem_base != xmlMemBlocks()) {
27052 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027054 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027055 printf(" %d", n_out);
27056 printf(" %d", n_str);
27057 printf("\n");
27058 }
27059 }
27060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027061 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027062#endif
27063
Daniel Veillard42595322004-11-08 10:52:06 +000027064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027065}
27066
27067
27068static int
27069test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027071
27072
27073 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027075}
27076
27077
27078static int
27079test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027081
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027082 int mem_base;
27083 xmlParserInputBufferPtr ret_val;
27084 int fd; /* a file descriptor number */
27085 int n_fd;
27086 xmlCharEncoding enc; /* the charset encoding if known */
27087 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027088
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027089 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27090 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27091 mem_base = xmlMemBlocks();
27092 fd = gen_int(n_fd, 0);
27093 enc = gen_xmlCharEncoding(n_enc, 1);
27094 if (fd >= 0) fd = -1;
27095
27096 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27097 desret_xmlParserInputBufferPtr(ret_val);
27098 call_tests++;
27099 des_int(n_fd, fd, 0);
27100 des_xmlCharEncoding(n_enc, enc, 1);
27101 xmlResetLastError();
27102 if (mem_base != xmlMemBlocks()) {
27103 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027105 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027106 printf(" %d", n_fd);
27107 printf(" %d", n_enc);
27108 printf("\n");
27109 }
27110 }
27111 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027112 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027113
Daniel Veillard42595322004-11-08 10:52:06 +000027114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027115}
27116
27117
27118static int
27119test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027121
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027122 int mem_base;
27123 xmlParserInputBufferPtr ret_val;
27124 FILE * file; /* a FILE* */
27125 int n_file;
27126 xmlCharEncoding enc; /* the charset encoding if known */
27127 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027128
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027129 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27130 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27131 mem_base = xmlMemBlocks();
27132 file = gen_FILE_ptr(n_file, 0);
27133 enc = gen_xmlCharEncoding(n_enc, 1);
27134
27135 ret_val = xmlParserInputBufferCreateFile(file, enc);
27136 desret_xmlParserInputBufferPtr(ret_val);
27137 call_tests++;
27138 des_FILE_ptr(n_file, file, 0);
27139 des_xmlCharEncoding(n_enc, enc, 1);
27140 xmlResetLastError();
27141 if (mem_base != xmlMemBlocks()) {
27142 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027144 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027145 printf(" %d", n_file);
27146 printf(" %d", n_enc);
27147 printf("\n");
27148 }
27149 }
27150 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027151 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027152
Daniel Veillard42595322004-11-08 10:52:06 +000027153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027154}
27155
27156
27157static int
27158test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027160
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027161 int mem_base;
27162 xmlParserInputBufferPtr ret_val;
27163 const char * URI; /* a C string containing the URI or filename */
27164 int n_URI;
27165 xmlCharEncoding enc; /* the charset encoding if known */
27166 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027167
Daniel Veillard42595322004-11-08 10:52:06 +000027168 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027169 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27170 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027171 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027172 enc = gen_xmlCharEncoding(n_enc, 1);
27173
27174 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27175 desret_xmlParserInputBufferPtr(ret_val);
27176 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027177 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027178 des_xmlCharEncoding(n_enc, enc, 1);
27179 xmlResetLastError();
27180 if (mem_base != xmlMemBlocks()) {
27181 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027183 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027184 printf(" %d", n_URI);
27185 printf(" %d", n_enc);
27186 printf("\n");
27187 }
27188 }
27189 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027190 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027191
Daniel Veillard42595322004-11-08 10:52:06 +000027192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027193}
27194
27195
27196static int
27197test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027199
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027200 int mem_base;
27201 xmlParserInputBufferPtr ret_val;
27202 char * mem; /* the memory input */
27203 int n_mem;
27204 int size; /* the length of the memory block */
27205 int n_size;
27206 xmlCharEncoding enc; /* the charset encoding if known */
27207 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027208
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027209 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27210 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27211 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27212 mem_base = xmlMemBlocks();
27213 mem = gen_const_char_ptr(n_mem, 0);
27214 size = gen_int(n_size, 1);
27215 enc = gen_xmlCharEncoding(n_enc, 2);
27216
William M. Brackf13f77f2004-11-12 16:03:48 +000027217 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027218 desret_xmlParserInputBufferPtr(ret_val);
27219 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027220 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027221 des_int(n_size, size, 1);
27222 des_xmlCharEncoding(n_enc, enc, 2);
27223 xmlResetLastError();
27224 if (mem_base != xmlMemBlocks()) {
27225 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027227 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027228 printf(" %d", n_mem);
27229 printf(" %d", n_size);
27230 printf(" %d", n_enc);
27231 printf("\n");
27232 }
27233 }
27234 }
27235 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027236 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027237
Daniel Veillard42595322004-11-08 10:52:06 +000027238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027239}
27240
27241
27242static int
27243test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027245
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027246 int mem_base;
27247 xmlParserInputBufferPtr ret_val;
27248 char * mem; /* the memory input */
27249 int n_mem;
27250 int size; /* the length of the memory block */
27251 int n_size;
27252 xmlCharEncoding enc; /* the charset encoding if known */
27253 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027254
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027255 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27256 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27257 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27258 mem_base = xmlMemBlocks();
27259 mem = gen_const_char_ptr(n_mem, 0);
27260 size = gen_int(n_size, 1);
27261 enc = gen_xmlCharEncoding(n_enc, 2);
27262
William M. Brackf13f77f2004-11-12 16:03:48 +000027263 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027264 desret_xmlParserInputBufferPtr(ret_val);
27265 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027266 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027267 des_int(n_size, size, 1);
27268 des_xmlCharEncoding(n_enc, enc, 2);
27269 xmlResetLastError();
27270 if (mem_base != xmlMemBlocks()) {
27271 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027273 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027274 printf(" %d", n_mem);
27275 printf(" %d", n_size);
27276 printf(" %d", n_enc);
27277 printf("\n");
27278 }
27279 }
27280 }
27281 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027282 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027283
Daniel Veillard42595322004-11-08 10:52:06 +000027284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027285}
27286
27287
27288static int
27289test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027291
Daniel Veillard34099b42004-11-04 17:34:35 +000027292 int mem_base;
27293 int ret_val;
27294 xmlParserInputBufferPtr in; /* a buffered parser input */
27295 int n_in;
27296 int len; /* indicative value of the amount of chars to read */
27297 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027298
Daniel Veillard34099b42004-11-04 17:34:35 +000027299 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27300 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27301 mem_base = xmlMemBlocks();
27302 in = gen_xmlParserInputBufferPtr(n_in, 0);
27303 len = gen_int(n_len, 1);
27304
27305 ret_val = xmlParserInputBufferGrow(in, len);
27306 desret_int(ret_val);
27307 call_tests++;
27308 des_xmlParserInputBufferPtr(n_in, in, 0);
27309 des_int(n_len, len, 1);
27310 xmlResetLastError();
27311 if (mem_base != xmlMemBlocks()) {
27312 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027314 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027315 printf(" %d", n_in);
27316 printf(" %d", n_len);
27317 printf("\n");
27318 }
27319 }
27320 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027321 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027322
Daniel Veillard42595322004-11-08 10:52:06 +000027323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027324}
27325
27326
27327static int
27328test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027330
Daniel Veillard34099b42004-11-04 17:34:35 +000027331 int mem_base;
27332 int ret_val;
27333 xmlParserInputBufferPtr in; /* a buffered parser input */
27334 int n_in;
27335 int len; /* the size in bytes of the array. */
27336 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027337 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027338 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027339
Daniel Veillard34099b42004-11-04 17:34:35 +000027340 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27341 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27342 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27343 mem_base = xmlMemBlocks();
27344 in = gen_xmlParserInputBufferPtr(n_in, 0);
27345 len = gen_int(n_len, 1);
27346 buf = gen_const_char_ptr(n_buf, 2);
27347
William M. Brackf13f77f2004-11-12 16:03:48 +000027348 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027349 desret_int(ret_val);
27350 call_tests++;
27351 des_xmlParserInputBufferPtr(n_in, in, 0);
27352 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027353 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027354 xmlResetLastError();
27355 if (mem_base != xmlMemBlocks()) {
27356 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027358 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027359 printf(" %d", n_in);
27360 printf(" %d", n_len);
27361 printf(" %d", n_buf);
27362 printf("\n");
27363 }
27364 }
27365 }
27366 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027368
Daniel Veillard42595322004-11-08 10:52:06 +000027369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027370}
27371
27372
27373static int
27374test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027376
Daniel Veillard34099b42004-11-04 17:34:35 +000027377 int mem_base;
27378 int ret_val;
27379 xmlParserInputBufferPtr in; /* a buffered parser input */
27380 int n_in;
27381 int len; /* indicative value of the amount of chars to read */
27382 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027383
Daniel Veillard34099b42004-11-04 17:34:35 +000027384 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27385 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27386 mem_base = xmlMemBlocks();
27387 in = gen_xmlParserInputBufferPtr(n_in, 0);
27388 len = gen_int(n_len, 1);
27389
27390 ret_val = xmlParserInputBufferRead(in, len);
27391 desret_int(ret_val);
27392 call_tests++;
27393 des_xmlParserInputBufferPtr(n_in, in, 0);
27394 des_int(n_len, len, 1);
27395 xmlResetLastError();
27396 if (mem_base != xmlMemBlocks()) {
27397 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027399 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027400 printf(" %d", n_in);
27401 printf(" %d", n_len);
27402 printf("\n");
27403 }
27404 }
27405 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027407
Daniel Veillard42595322004-11-08 10:52:06 +000027408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027409}
27410
27411
27412static int
27413test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027415
27416 int mem_base;
27417 int ret_val;
27418
27419 mem_base = xmlMemBlocks();
27420
27421 ret_val = xmlPopInputCallbacks();
27422 desret_int(ret_val);
27423 call_tests++;
27424 xmlResetLastError();
27425 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027426 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027428 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027429 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027430 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027431 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027432
Daniel Veillard42595322004-11-08 10:52:06 +000027433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027434}
27435
27436
27437static int
27438test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027440
27441 int mem_base;
27442
27443 mem_base = xmlMemBlocks();
27444
27445 xmlRegisterDefaultInputCallbacks();
27446 call_tests++;
27447 xmlResetLastError();
27448 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027449 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027451 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027452 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027453 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027454 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027455
Daniel Veillard42595322004-11-08 10:52:06 +000027456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027457}
27458
27459
27460static int
27461test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027463
27464#ifdef LIBXML_OUTPUT_ENABLED
27465 int mem_base;
27466
27467 mem_base = xmlMemBlocks();
27468
27469 xmlRegisterDefaultOutputCallbacks();
27470 call_tests++;
27471 xmlResetLastError();
27472 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027473 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027475 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027476 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027478 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027479#endif
27480
Daniel Veillard42595322004-11-08 10:52:06 +000027481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027482}
27483
27484
27485static int
27486test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027488
27489#ifdef LIBXML_HTTP_ENABLED
27490 int mem_base;
27491
27492 mem_base = xmlMemBlocks();
27493
27494 xmlRegisterHTTPPostCallbacks();
27495 call_tests++;
27496 xmlResetLastError();
27497 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027498 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027500 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027501 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027503 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027504#endif
27505
Daniel Veillard42595322004-11-08 10:52:06 +000027506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027507}
27508
27509static int
27510test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027512
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027513 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027514 test_ret += test_xmlAllocOutputBuffer();
27515 test_ret += test_xmlAllocParserInputBuffer();
27516 test_ret += test_xmlCheckFilename();
27517 test_ret += test_xmlCheckHTTPInput();
27518 test_ret += test_xmlCleanupInputCallbacks();
27519 test_ret += test_xmlCleanupOutputCallbacks();
27520 test_ret += test_xmlFileClose();
27521 test_ret += test_xmlFileMatch();
27522 test_ret += test_xmlFileOpen();
27523 test_ret += test_xmlFileRead();
27524 test_ret += test_xmlIOFTPClose();
27525 test_ret += test_xmlIOFTPMatch();
27526 test_ret += test_xmlIOFTPOpen();
27527 test_ret += test_xmlIOFTPRead();
27528 test_ret += test_xmlIOHTTPClose();
27529 test_ret += test_xmlIOHTTPMatch();
27530 test_ret += test_xmlIOHTTPOpen();
27531 test_ret += test_xmlIOHTTPOpenW();
27532 test_ret += test_xmlIOHTTPRead();
27533 test_ret += test_xmlNoNetExternalEntityLoader();
27534 test_ret += test_xmlNormalizeWindowsPath();
27535 test_ret += test_xmlOutputBufferCreateFd();
27536 test_ret += test_xmlOutputBufferCreateFile();
27537 test_ret += test_xmlOutputBufferCreateFilename();
27538 test_ret += test_xmlOutputBufferFlush();
27539 test_ret += test_xmlOutputBufferWrite();
27540 test_ret += test_xmlOutputBufferWriteEscape();
27541 test_ret += test_xmlOutputBufferWriteString();
27542 test_ret += test_xmlParserGetDirectory();
27543 test_ret += test_xmlParserInputBufferCreateFd();
27544 test_ret += test_xmlParserInputBufferCreateFile();
27545 test_ret += test_xmlParserInputBufferCreateFilename();
27546 test_ret += test_xmlParserInputBufferCreateMem();
27547 test_ret += test_xmlParserInputBufferCreateStatic();
27548 test_ret += test_xmlParserInputBufferGrow();
27549 test_ret += test_xmlParserInputBufferPush();
27550 test_ret += test_xmlParserInputBufferRead();
27551 test_ret += test_xmlPopInputCallbacks();
27552 test_ret += test_xmlRegisterDefaultInputCallbacks();
27553 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27554 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027555
Daniel Veillard42595322004-11-08 10:52:06 +000027556 if (test_ret != 0)
27557 printf("Module xmlIO: %d errors\n", test_ret);
27558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027559}
Daniel Veillarda521d282004-11-09 14:59:59 +000027560#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027561
Daniel Veillarda82b1822004-11-08 16:24:57 +000027562#define gen_nb_xmlAutomataPtr 1
27563static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27564 return(NULL);
27565}
27566static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27567}
Daniel Veillarda521d282004-11-09 14:59:59 +000027568#endif
27569
Daniel Veillarda82b1822004-11-08 16:24:57 +000027570
27571static int
27572test_xmlAutomataCompile(void) {
27573 int test_ret = 0;
27574
27575
27576 /* missing type support */
27577 return(test_ret);
27578}
27579
27580
27581static int
27582test_xmlAutomataGetInitState(void) {
27583 int test_ret = 0;
27584
27585
27586 /* missing type support */
27587 return(test_ret);
27588}
27589
27590
27591static int
27592test_xmlAutomataIsDeterminist(void) {
27593 int test_ret = 0;
27594
27595#ifdef LIBXML_AUTOMATA_ENABLED
27596 int mem_base;
27597 int ret_val;
27598 xmlAutomataPtr am; /* an automata */
27599 int n_am;
27600
27601 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27602 mem_base = xmlMemBlocks();
27603 am = gen_xmlAutomataPtr(n_am, 0);
27604
27605 ret_val = xmlAutomataIsDeterminist(am);
27606 desret_int(ret_val);
27607 call_tests++;
27608 des_xmlAutomataPtr(n_am, am, 0);
27609 xmlResetLastError();
27610 if (mem_base != xmlMemBlocks()) {
27611 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27612 xmlMemBlocks() - mem_base);
27613 test_ret++;
27614 printf(" %d", n_am);
27615 printf("\n");
27616 }
27617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027618 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027619#endif
27620
Daniel Veillarda82b1822004-11-08 16:24:57 +000027621 return(test_ret);
27622}
27623
Daniel Veillarda521d282004-11-09 14:59:59 +000027624#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027625
27626#define gen_nb_xmlAutomataStatePtr 1
27627static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27628 return(NULL);
27629}
27630static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27631}
Daniel Veillarda521d282004-11-09 14:59:59 +000027632#endif
27633
Daniel Veillarda82b1822004-11-08 16:24:57 +000027634
27635static int
27636test_xmlAutomataNewAllTrans(void) {
27637 int test_ret = 0;
27638
27639
27640 /* missing type support */
27641 return(test_ret);
27642}
27643
27644
27645static int
27646test_xmlAutomataNewCountTrans(void) {
27647 int test_ret = 0;
27648
27649
27650 /* missing type support */
27651 return(test_ret);
27652}
27653
27654
27655static int
27656test_xmlAutomataNewCountTrans2(void) {
27657 int test_ret = 0;
27658
27659
27660 /* missing type support */
27661 return(test_ret);
27662}
27663
27664
27665static int
27666test_xmlAutomataNewCountedTrans(void) {
27667 int test_ret = 0;
27668
27669
27670 /* missing type support */
27671 return(test_ret);
27672}
27673
27674
27675static int
27676test_xmlAutomataNewCounter(void) {
27677 int test_ret = 0;
27678
27679#ifdef LIBXML_AUTOMATA_ENABLED
27680 int mem_base;
27681 int ret_val;
27682 xmlAutomataPtr am; /* an automata */
27683 int n_am;
27684 int min; /* the minimal value on the counter */
27685 int n_min;
27686 int max; /* the maximal value on the counter */
27687 int n_max;
27688
27689 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27690 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27691 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27692 mem_base = xmlMemBlocks();
27693 am = gen_xmlAutomataPtr(n_am, 0);
27694 min = gen_int(n_min, 1);
27695 max = gen_int(n_max, 2);
27696
27697 ret_val = xmlAutomataNewCounter(am, min, max);
27698 desret_int(ret_val);
27699 call_tests++;
27700 des_xmlAutomataPtr(n_am, am, 0);
27701 des_int(n_min, min, 1);
27702 des_int(n_max, max, 2);
27703 xmlResetLastError();
27704 if (mem_base != xmlMemBlocks()) {
27705 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27706 xmlMemBlocks() - mem_base);
27707 test_ret++;
27708 printf(" %d", n_am);
27709 printf(" %d", n_min);
27710 printf(" %d", n_max);
27711 printf("\n");
27712 }
27713 }
27714 }
27715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027716 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027717#endif
27718
Daniel Veillarda82b1822004-11-08 16:24:57 +000027719 return(test_ret);
27720}
27721
27722
27723static int
27724test_xmlAutomataNewCounterTrans(void) {
27725 int test_ret = 0;
27726
27727
27728 /* missing type support */
27729 return(test_ret);
27730}
27731
27732
27733static int
27734test_xmlAutomataNewEpsilon(void) {
27735 int test_ret = 0;
27736
27737
27738 /* missing type support */
27739 return(test_ret);
27740}
27741
27742
27743static int
27744test_xmlAutomataNewOnceTrans(void) {
27745 int test_ret = 0;
27746
27747
27748 /* missing type support */
27749 return(test_ret);
27750}
27751
27752
27753static int
27754test_xmlAutomataNewOnceTrans2(void) {
27755 int test_ret = 0;
27756
27757
27758 /* missing type support */
27759 return(test_ret);
27760}
27761
27762
27763static int
27764test_xmlAutomataNewState(void) {
27765 int test_ret = 0;
27766
27767
27768 /* missing type support */
27769 return(test_ret);
27770}
27771
27772
27773static int
27774test_xmlAutomataNewTransition(void) {
27775 int test_ret = 0;
27776
27777
27778 /* missing type support */
27779 return(test_ret);
27780}
27781
27782
27783static int
27784test_xmlAutomataNewTransition2(void) {
27785 int test_ret = 0;
27786
27787
27788 /* missing type support */
27789 return(test_ret);
27790}
27791
27792
27793static int
27794test_xmlAutomataSetFinalState(void) {
27795 int test_ret = 0;
27796
27797#ifdef LIBXML_AUTOMATA_ENABLED
27798 int mem_base;
27799 int ret_val;
27800 xmlAutomataPtr am; /* an automata */
27801 int n_am;
27802 xmlAutomataStatePtr state; /* a state in this automata */
27803 int n_state;
27804
27805 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27806 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27807 mem_base = xmlMemBlocks();
27808 am = gen_xmlAutomataPtr(n_am, 0);
27809 state = gen_xmlAutomataStatePtr(n_state, 1);
27810
27811 ret_val = xmlAutomataSetFinalState(am, state);
27812 desret_int(ret_val);
27813 call_tests++;
27814 des_xmlAutomataPtr(n_am, am, 0);
27815 des_xmlAutomataStatePtr(n_state, state, 1);
27816 xmlResetLastError();
27817 if (mem_base != xmlMemBlocks()) {
27818 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27819 xmlMemBlocks() - mem_base);
27820 test_ret++;
27821 printf(" %d", n_am);
27822 printf(" %d", n_state);
27823 printf("\n");
27824 }
27825 }
27826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027827 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027828#endif
27829
Daniel Veillarda82b1822004-11-08 16:24:57 +000027830 return(test_ret);
27831}
27832
27833
27834static int
27835test_xmlNewAutomata(void) {
27836 int test_ret = 0;
27837
27838
27839 /* missing type support */
27840 return(test_ret);
27841}
27842
27843static int
27844test_xmlautomata(void) {
27845 int test_ret = 0;
27846
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027847 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000027848 test_ret += test_xmlAutomataCompile();
27849 test_ret += test_xmlAutomataGetInitState();
27850 test_ret += test_xmlAutomataIsDeterminist();
27851 test_ret += test_xmlAutomataNewAllTrans();
27852 test_ret += test_xmlAutomataNewCountTrans();
27853 test_ret += test_xmlAutomataNewCountTrans2();
27854 test_ret += test_xmlAutomataNewCountedTrans();
27855 test_ret += test_xmlAutomataNewCounter();
27856 test_ret += test_xmlAutomataNewCounterTrans();
27857 test_ret += test_xmlAutomataNewEpsilon();
27858 test_ret += test_xmlAutomataNewOnceTrans();
27859 test_ret += test_xmlAutomataNewOnceTrans2();
27860 test_ret += test_xmlAutomataNewState();
27861 test_ret += test_xmlAutomataNewTransition();
27862 test_ret += test_xmlAutomataNewTransition2();
27863 test_ret += test_xmlAutomataSetFinalState();
27864 test_ret += test_xmlNewAutomata();
27865
27866 if (test_ret != 0)
27867 printf("Module xmlautomata: %d errors\n", test_ret);
27868 return(test_ret);
27869}
27870
Daniel Veillardce682bc2004-11-05 17:22:25 +000027871#define gen_nb_xmlGenericErrorFunc_ptr 1
27872static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27873 return(NULL);
27874}
27875static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27876}
27877
Daniel Veillardd93f6252004-11-02 15:53:51 +000027878static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027879test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027881
Daniel Veillardce682bc2004-11-05 17:22:25 +000027882 int mem_base;
27883 xmlGenericErrorFunc * handler; /* the handler */
27884 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027885
Daniel Veillardce682bc2004-11-05 17:22:25 +000027886 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27887 mem_base = xmlMemBlocks();
27888 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27889
27890 initGenericErrorDefaultFunc(handler);
27891 call_tests++;
27892 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27893 xmlResetLastError();
27894 if (mem_base != xmlMemBlocks()) {
27895 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
27896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027897 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027898 printf(" %d", n_handler);
27899 printf("\n");
27900 }
27901 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027902 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027903
Daniel Veillard42595322004-11-08 10:52:06 +000027904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027905}
27906
27907
Daniel Veillardce682bc2004-11-05 17:22:25 +000027908#define gen_nb_xmlErrorPtr 1
27909static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27910 return(NULL);
27911}
27912static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27913}
27914
Daniel Veillardd93f6252004-11-02 15:53:51 +000027915static int
27916test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027918
Daniel Veillardce682bc2004-11-05 17:22:25 +000027919 int mem_base;
27920 int ret_val;
27921 xmlErrorPtr from; /* a source error */
27922 int n_from;
27923 xmlErrorPtr to; /* a target error */
27924 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027925
Daniel Veillardce682bc2004-11-05 17:22:25 +000027926 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
27927 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
27928 mem_base = xmlMemBlocks();
27929 from = gen_xmlErrorPtr(n_from, 0);
27930 to = gen_xmlErrorPtr(n_to, 1);
27931
27932 ret_val = xmlCopyError(from, to);
27933 desret_int(ret_val);
27934 call_tests++;
27935 des_xmlErrorPtr(n_from, from, 0);
27936 des_xmlErrorPtr(n_to, to, 1);
27937 xmlResetLastError();
27938 if (mem_base != xmlMemBlocks()) {
27939 printf("Leak of %d blocks found in xmlCopyError",
27940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027941 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027942 printf(" %d", n_from);
27943 printf(" %d", n_to);
27944 printf("\n");
27945 }
27946 }
27947 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027948 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027949
Daniel Veillard42595322004-11-08 10:52:06 +000027950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027951}
27952
27953
27954static int
27955test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027957
27958
27959 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027961}
27962
27963
27964static int
27965test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027967
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027968 int mem_base;
27969 void * ctx; /* an XML parser context */
27970 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027971
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027972 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
27973 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027974 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027975
27976 xmlCtxtResetLastError(ctx);
27977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027978 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027979 xmlResetLastError();
27980 if (mem_base != xmlMemBlocks()) {
27981 printf("Leak of %d blocks found in xmlCtxtResetLastError",
27982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027983 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027984 printf(" %d", n_ctx);
27985 printf("\n");
27986 }
27987 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027988 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027989
Daniel Veillard42595322004-11-08 10:52:06 +000027990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027991}
27992
27993
27994static int
27995test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027997
27998
27999 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028001}
28002
28003
28004static int
28005test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028007
28008
28009 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028011}
28012
28013
28014static int
28015test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028017
Daniel Veillardce682bc2004-11-05 17:22:25 +000028018 int mem_base;
28019 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28020 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028021
Daniel Veillardce682bc2004-11-05 17:22:25 +000028022 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28023 mem_base = xmlMemBlocks();
28024 input = gen_xmlParserInputPtr(n_input, 0);
28025
28026 xmlParserPrintFileContext(input);
28027 call_tests++;
28028 des_xmlParserInputPtr(n_input, input, 0);
28029 xmlResetLastError();
28030 if (mem_base != xmlMemBlocks()) {
28031 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028033 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028034 printf(" %d", n_input);
28035 printf("\n");
28036 }
28037 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028039
Daniel Veillard42595322004-11-08 10:52:06 +000028040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028041}
28042
28043
28044static int
28045test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028047
Daniel Veillardce682bc2004-11-05 17:22:25 +000028048 int mem_base;
28049 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28050 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028051
Daniel Veillardce682bc2004-11-05 17:22:25 +000028052 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28053 mem_base = xmlMemBlocks();
28054 input = gen_xmlParserInputPtr(n_input, 0);
28055
28056 xmlParserPrintFileInfo(input);
28057 call_tests++;
28058 des_xmlParserInputPtr(n_input, input, 0);
28059 xmlResetLastError();
28060 if (mem_base != xmlMemBlocks()) {
28061 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028063 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028064 printf(" %d", n_input);
28065 printf("\n");
28066 }
28067 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028068 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028069
Daniel Veillard42595322004-11-08 10:52:06 +000028070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028071}
28072
28073
28074static int
28075test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028077
28078
28079 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028081}
28082
28083
28084static int
28085test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028087
28088
28089 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028091}
28092
28093
28094static int
28095test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028097
28098
28099 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028101}
28102
28103
28104static int
28105test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028107
Daniel Veillardce682bc2004-11-05 17:22:25 +000028108 int mem_base;
28109 xmlErrorPtr err; /* pointer to the error. */
28110 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028111
Daniel Veillardce682bc2004-11-05 17:22:25 +000028112 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28113 mem_base = xmlMemBlocks();
28114 err = gen_xmlErrorPtr(n_err, 0);
28115
28116 xmlResetError(err);
28117 call_tests++;
28118 des_xmlErrorPtr(n_err, err, 0);
28119 xmlResetLastError();
28120 if (mem_base != xmlMemBlocks()) {
28121 printf("Leak of %d blocks found in xmlResetError",
28122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028123 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028124 printf(" %d", n_err);
28125 printf("\n");
28126 }
28127 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028128 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028129
Daniel Veillard42595322004-11-08 10:52:06 +000028130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028131}
28132
28133
28134static int
28135test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028137
28138
28139
28140 xmlResetLastError();
28141 call_tests++;
28142 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028143 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028144
Daniel Veillard42595322004-11-08 10:52:06 +000028145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028146}
28147
28148
28149static int
28150test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028152
28153
28154 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028156}
28157
28158
28159static int
28160test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028162
28163
28164 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028166}
28167
28168static int
28169test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028171
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028172 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028173 test_ret += test_initGenericErrorDefaultFunc();
28174 test_ret += test_xmlCopyError();
28175 test_ret += test_xmlCtxtGetLastError();
28176 test_ret += test_xmlCtxtResetLastError();
28177 test_ret += test_xmlGetLastError();
28178 test_ret += test_xmlParserError();
28179 test_ret += test_xmlParserPrintFileContext();
28180 test_ret += test_xmlParserPrintFileInfo();
28181 test_ret += test_xmlParserValidityError();
28182 test_ret += test_xmlParserValidityWarning();
28183 test_ret += test_xmlParserWarning();
28184 test_ret += test_xmlResetError();
28185 test_ret += test_xmlResetLastError();
28186 test_ret += test_xmlSetGenericErrorFunc();
28187 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028188
Daniel Veillard42595322004-11-08 10:52:06 +000028189 if (test_ret != 0)
28190 printf("Module xmlerror: %d errors\n", test_ret);
28191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028192}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028193
28194static int
28195test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028197
Daniel Veillard34099b42004-11-04 17:34:35 +000028198#ifdef LIBXML_READER_ENABLED
28199 int mem_base;
28200 xmlTextReaderPtr ret_val;
28201 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28202 int n_input;
28203 const char * URI; /* the URI information for the source if available */
28204 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028205
Daniel Veillard34099b42004-11-04 17:34:35 +000028206 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28207 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28208 mem_base = xmlMemBlocks();
28209 input = gen_xmlParserInputBufferPtr(n_input, 0);
28210 URI = gen_filepath(n_URI, 1);
28211
28212 ret_val = xmlNewTextReader(input, URI);
28213 desret_xmlTextReaderPtr(ret_val);
28214 call_tests++;
28215 des_xmlParserInputBufferPtr(n_input, input, 0);
28216 des_filepath(n_URI, URI, 1);
28217 xmlResetLastError();
28218 if (mem_base != xmlMemBlocks()) {
28219 printf("Leak of %d blocks found in xmlNewTextReader",
28220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028221 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028222 printf(" %d", n_input);
28223 printf(" %d", n_URI);
28224 printf("\n");
28225 }
28226 }
28227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028228 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028229#endif
28230
Daniel Veillard42595322004-11-08 10:52:06 +000028231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028232}
28233
28234
28235static int
28236test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028238
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028239#ifdef LIBXML_READER_ENABLED
28240 int mem_base;
28241 xmlTextReaderPtr ret_val;
28242 const char * URI; /* the URI of the resource to process */
28243 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028244
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028245 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28246 mem_base = xmlMemBlocks();
28247 URI = gen_filepath(n_URI, 0);
28248
28249 ret_val = xmlNewTextReaderFilename(URI);
28250 desret_xmlTextReaderPtr(ret_val);
28251 call_tests++;
28252 des_filepath(n_URI, URI, 0);
28253 xmlResetLastError();
28254 if (mem_base != xmlMemBlocks()) {
28255 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028257 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028258 printf(" %d", n_URI);
28259 printf("\n");
28260 }
28261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028262 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028263#endif
28264
Daniel Veillard42595322004-11-08 10:52:06 +000028265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028266}
28267
28268
28269static int
28270test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028272
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028273#ifdef LIBXML_READER_ENABLED
28274 int mem_base;
28275 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028276 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028277 int n_cur;
28278 const char * URL; /* the base URL to use for the document */
28279 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028280 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028281 int n_encoding;
28282 int options; /* a combination of xmlParserOption */
28283 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028284
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028285 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28286 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28287 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028288 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028289 mem_base = xmlMemBlocks();
28290 cur = gen_const_xmlChar_ptr(n_cur, 0);
28291 URL = gen_filepath(n_URL, 1);
28292 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028293 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028294
William M. Brackf13f77f2004-11-12 16:03:48 +000028295 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028296 desret_xmlTextReaderPtr(ret_val);
28297 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028298 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028299 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028300 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028301 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028302 xmlResetLastError();
28303 if (mem_base != xmlMemBlocks()) {
28304 printf("Leak of %d blocks found in xmlReaderForDoc",
28305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028306 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028307 printf(" %d", n_cur);
28308 printf(" %d", n_URL);
28309 printf(" %d", n_encoding);
28310 printf(" %d", n_options);
28311 printf("\n");
28312 }
28313 }
28314 }
28315 }
28316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028317 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028318#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028319
Daniel Veillard42595322004-11-08 10:52:06 +000028320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028321}
28322
28323
28324static int
28325test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028327
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028328#ifdef LIBXML_READER_ENABLED
28329 int mem_base;
28330 xmlTextReaderPtr ret_val;
28331 const char * filename; /* a file or URL */
28332 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028333 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028334 int n_encoding;
28335 int options; /* a combination of xmlParserOption */
28336 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028337
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028338 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28339 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028340 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028341 mem_base = xmlMemBlocks();
28342 filename = gen_filepath(n_filename, 0);
28343 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028344 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028345
William M. Brackf13f77f2004-11-12 16:03:48 +000028346 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028347 desret_xmlTextReaderPtr(ret_val);
28348 call_tests++;
28349 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028350 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028351 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028352 xmlResetLastError();
28353 if (mem_base != xmlMemBlocks()) {
28354 printf("Leak of %d blocks found in xmlReaderForFile",
28355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028356 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028357 printf(" %d", n_filename);
28358 printf(" %d", n_encoding);
28359 printf(" %d", n_options);
28360 printf("\n");
28361 }
28362 }
28363 }
28364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028365 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028366#endif
28367
Daniel Veillard42595322004-11-08 10:52:06 +000028368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028369}
28370
28371
28372static int
28373test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028375
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028376#ifdef LIBXML_READER_ENABLED
28377 int mem_base;
28378 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028379 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028380 int n_buffer;
28381 int size; /* the size of the array */
28382 int n_size;
28383 const char * URL; /* the base URL to use for the document */
28384 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028385 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028386 int n_encoding;
28387 int options; /* a combination of xmlParserOption */
28388 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028389
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028390 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28391 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28392 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28393 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028394 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028395 mem_base = xmlMemBlocks();
28396 buffer = gen_const_char_ptr(n_buffer, 0);
28397 size = gen_int(n_size, 1);
28398 URL = gen_filepath(n_URL, 2);
28399 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028400 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028401
William M. Brackf13f77f2004-11-12 16:03:48 +000028402 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028403 desret_xmlTextReaderPtr(ret_val);
28404 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028405 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028406 des_int(n_size, size, 1);
28407 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028408 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028409 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028410 xmlResetLastError();
28411 if (mem_base != xmlMemBlocks()) {
28412 printf("Leak of %d blocks found in xmlReaderForMemory",
28413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028414 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028415 printf(" %d", n_buffer);
28416 printf(" %d", n_size);
28417 printf(" %d", n_URL);
28418 printf(" %d", n_encoding);
28419 printf(" %d", n_options);
28420 printf("\n");
28421 }
28422 }
28423 }
28424 }
28425 }
28426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028427 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028428#endif
28429
Daniel Veillard42595322004-11-08 10:52:06 +000028430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028431}
28432
28433
28434static int
28435test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028437
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028438#ifdef LIBXML_READER_ENABLED
28439 int mem_base;
28440 int ret_val;
28441 xmlTextReaderPtr reader; /* an XML reader */
28442 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028443 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028444 int n_cur;
28445 const char * URL; /* the base URL to use for the document */
28446 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028447 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028448 int n_encoding;
28449 int options; /* a combination of xmlParserOption */
28450 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028451
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028452 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28453 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28454 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28455 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028456 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028457 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028458 reader = gen_xmlTextReaderPtr(n_reader, 0);
28459 cur = gen_const_xmlChar_ptr(n_cur, 1);
28460 URL = gen_filepath(n_URL, 2);
28461 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028462 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028463
William M. Brackf13f77f2004-11-12 16:03:48 +000028464 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028465 desret_int(ret_val);
28466 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028467 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028468 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028469 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028470 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028471 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028472 xmlResetLastError();
28473 if (mem_base != xmlMemBlocks()) {
28474 printf("Leak of %d blocks found in xmlReaderNewDoc",
28475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028476 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028477 printf(" %d", n_reader);
28478 printf(" %d", n_cur);
28479 printf(" %d", n_URL);
28480 printf(" %d", n_encoding);
28481 printf(" %d", n_options);
28482 printf("\n");
28483 }
28484 }
28485 }
28486 }
28487 }
28488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028489 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028490#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028491
Daniel Veillard42595322004-11-08 10:52:06 +000028492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028493}
28494
28495
28496static int
28497test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028499
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028500#ifdef LIBXML_READER_ENABLED
28501 int mem_base;
28502 int ret_val;
28503 xmlTextReaderPtr reader; /* an XML reader */
28504 int n_reader;
28505 const char * filename; /* a file or URL */
28506 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028507 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028508 int n_encoding;
28509 int options; /* a combination of xmlParserOption */
28510 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028511
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028512 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28513 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28514 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028515 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028517 reader = gen_xmlTextReaderPtr(n_reader, 0);
28518 filename = gen_filepath(n_filename, 1);
28519 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028520 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028521
William M. Brackf13f77f2004-11-12 16:03:48 +000028522 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028523 desret_int(ret_val);
28524 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028525 des_xmlTextReaderPtr(n_reader, reader, 0);
28526 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028527 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028528 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028529 xmlResetLastError();
28530 if (mem_base != xmlMemBlocks()) {
28531 printf("Leak of %d blocks found in xmlReaderNewFile",
28532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028533 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028534 printf(" %d", n_reader);
28535 printf(" %d", n_filename);
28536 printf(" %d", n_encoding);
28537 printf(" %d", n_options);
28538 printf("\n");
28539 }
28540 }
28541 }
28542 }
28543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028544 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028545#endif
28546
Daniel Veillard42595322004-11-08 10:52:06 +000028547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028548}
28549
28550
28551static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028552test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028554
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028555#ifdef LIBXML_READER_ENABLED
28556 int mem_base;
28557 int ret_val;
28558 xmlTextReaderPtr reader; /* an XML reader */
28559 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028560 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028561 int n_buffer;
28562 int size; /* the size of the array */
28563 int n_size;
28564 const char * URL; /* the base URL to use for the document */
28565 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028566 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028567 int n_encoding;
28568 int options; /* a combination of xmlParserOption */
28569 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028570
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028571 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28572 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28573 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28574 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28575 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028576 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028577 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028578 reader = gen_xmlTextReaderPtr(n_reader, 0);
28579 buffer = gen_const_char_ptr(n_buffer, 1);
28580 size = gen_int(n_size, 2);
28581 URL = gen_filepath(n_URL, 3);
28582 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028583 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028584
William M. Brackf13f77f2004-11-12 16:03:48 +000028585 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028586 desret_int(ret_val);
28587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028588 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028589 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028590 des_int(n_size, size, 2);
28591 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028592 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028593 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028594 xmlResetLastError();
28595 if (mem_base != xmlMemBlocks()) {
28596 printf("Leak of %d blocks found in xmlReaderNewMemory",
28597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028598 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028599 printf(" %d", n_reader);
28600 printf(" %d", n_buffer);
28601 printf(" %d", n_size);
28602 printf(" %d", n_URL);
28603 printf(" %d", n_encoding);
28604 printf(" %d", n_options);
28605 printf("\n");
28606 }
28607 }
28608 }
28609 }
28610 }
28611 }
28612 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028613 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028614#endif
28615
Daniel Veillard42595322004-11-08 10:52:06 +000028616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028617}
28618
28619
28620static int
28621test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028623
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028624#ifdef LIBXML_READER_ENABLED
28625 int mem_base;
28626 int ret_val;
28627 xmlTextReaderPtr reader; /* an XML reader */
28628 int n_reader;
28629 xmlDocPtr doc; /* a preparsed document */
28630 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028631
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028632 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28633 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28634 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028635 reader = gen_xmlTextReaderPtr(n_reader, 0);
28636 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028637
28638 ret_val = xmlReaderNewWalker(reader, doc);
28639 desret_int(ret_val);
28640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028641 des_xmlTextReaderPtr(n_reader, reader, 0);
28642 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028643 xmlResetLastError();
28644 if (mem_base != xmlMemBlocks()) {
28645 printf("Leak of %d blocks found in xmlReaderNewWalker",
28646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028647 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028648 printf(" %d", n_reader);
28649 printf(" %d", n_doc);
28650 printf("\n");
28651 }
28652 }
28653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028654 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028655#endif
28656
Daniel Veillard42595322004-11-08 10:52:06 +000028657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028658}
28659
28660
28661static int
28662test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028664
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028665#ifdef LIBXML_READER_ENABLED
28666 int mem_base;
28667 xmlTextReaderPtr ret_val;
28668 xmlDocPtr doc; /* a preparsed document */
28669 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028670
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028671 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28672 mem_base = xmlMemBlocks();
28673 doc = gen_xmlDocPtr(n_doc, 0);
28674
28675 ret_val = xmlReaderWalker(doc);
28676 desret_xmlTextReaderPtr(ret_val);
28677 call_tests++;
28678 des_xmlDocPtr(n_doc, doc, 0);
28679 xmlResetLastError();
28680 if (mem_base != xmlMemBlocks()) {
28681 printf("Leak of %d blocks found in xmlReaderWalker",
28682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028683 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028684 printf(" %d", n_doc);
28685 printf("\n");
28686 }
28687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028688 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028689#endif
28690
Daniel Veillard42595322004-11-08 10:52:06 +000028691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028692}
28693
28694
28695static int
28696test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028698
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028699#ifdef LIBXML_READER_ENABLED
28700 int mem_base;
28701 int ret_val;
28702 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28703 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028704
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028705 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028707 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028708
28709 ret_val = xmlTextReaderAttributeCount(reader);
28710 desret_int(ret_val);
28711 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028712 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028713 xmlResetLastError();
28714 if (mem_base != xmlMemBlocks()) {
28715 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028717 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028718 printf(" %d", n_reader);
28719 printf("\n");
28720 }
28721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028722 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028723#endif
28724
Daniel Veillard42595322004-11-08 10:52:06 +000028725 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028726}
28727
28728
28729static int
28730test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028732
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028733#ifdef LIBXML_READER_ENABLED
28734 int mem_base;
28735 xmlChar * ret_val;
28736 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28737 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028738
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028739 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028741 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028742
28743 ret_val = xmlTextReaderBaseUri(reader);
28744 desret_xmlChar_ptr(ret_val);
28745 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028746 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028747 xmlResetLastError();
28748 if (mem_base != xmlMemBlocks()) {
28749 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028751 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028752 printf(" %d", n_reader);
28753 printf("\n");
28754 }
28755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028756 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028757#endif
28758
Daniel Veillard42595322004-11-08 10:52:06 +000028759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028760}
28761
28762
28763static int
28764test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028766
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028767#ifdef LIBXML_READER_ENABLED
28768 int mem_base;
28769 int ret_val;
28770 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28771 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028772
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028773 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028775 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028776
28777 ret_val = xmlTextReaderClose(reader);
28778 desret_int(ret_val);
28779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028780 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028781 xmlResetLastError();
28782 if (mem_base != xmlMemBlocks()) {
28783 printf("Leak of %d blocks found in xmlTextReaderClose",
28784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028785 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028786 printf(" %d", n_reader);
28787 printf("\n");
28788 }
28789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028790 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028791#endif
28792
Daniel Veillard42595322004-11-08 10:52:06 +000028793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028794}
28795
28796
28797static int
28798test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028800
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028801#ifdef LIBXML_READER_ENABLED
28802 int mem_base;
28803 const xmlChar * ret_val;
28804 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28805 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028806
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028807 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28808 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028809 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028810
28811 ret_val = xmlTextReaderConstBaseUri(reader);
28812 desret_const_xmlChar_ptr(ret_val);
28813 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028814 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028815 xmlResetLastError();
28816 if (mem_base != xmlMemBlocks()) {
28817 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028819 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028820 printf(" %d", n_reader);
28821 printf("\n");
28822 }
28823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028824 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +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_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028834
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028835#ifdef LIBXML_READER_ENABLED
28836 int mem_base;
28837 const xmlChar * ret_val;
28838 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28839 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028840
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028841 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28842 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028843 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028844
28845 ret_val = xmlTextReaderConstEncoding(reader);
28846 desret_const_xmlChar_ptr(ret_val);
28847 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028848 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028849 xmlResetLastError();
28850 if (mem_base != xmlMemBlocks()) {
28851 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028853 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028854 printf(" %d", n_reader);
28855 printf("\n");
28856 }
28857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028858 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028859#endif
28860
Daniel Veillard42595322004-11-08 10:52:06 +000028861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028862}
28863
28864
28865static int
28866test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028868
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028869#ifdef LIBXML_READER_ENABLED
28870 int mem_base;
28871 const xmlChar * ret_val;
28872 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28873 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028874
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028875 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28876 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028877 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028878
28879 ret_val = xmlTextReaderConstLocalName(reader);
28880 desret_const_xmlChar_ptr(ret_val);
28881 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028882 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028883 xmlResetLastError();
28884 if (mem_base != xmlMemBlocks()) {
28885 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
28886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028887 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028888 printf(" %d", n_reader);
28889 printf("\n");
28890 }
28891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028892 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028893#endif
28894
Daniel Veillard42595322004-11-08 10:52:06 +000028895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028896}
28897
28898
28899static int
28900test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028902
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028903#ifdef LIBXML_READER_ENABLED
28904 int mem_base;
28905 const xmlChar * ret_val;
28906 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28907 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028908
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028909 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28910 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028911 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028912
28913 ret_val = xmlTextReaderConstName(reader);
28914 desret_const_xmlChar_ptr(ret_val);
28915 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028916 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028917 xmlResetLastError();
28918 if (mem_base != xmlMemBlocks()) {
28919 printf("Leak of %d blocks found in xmlTextReaderConstName",
28920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028921 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028922 printf(" %d", n_reader);
28923 printf("\n");
28924 }
28925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028926 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028927#endif
28928
Daniel Veillard42595322004-11-08 10:52:06 +000028929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028930}
28931
28932
28933static int
28934test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028936
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028937#ifdef LIBXML_READER_ENABLED
28938 int mem_base;
28939 const xmlChar * ret_val;
28940 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28941 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028942
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028943 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028945 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028946
28947 ret_val = xmlTextReaderConstNamespaceUri(reader);
28948 desret_const_xmlChar_ptr(ret_val);
28949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028950 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028951 xmlResetLastError();
28952 if (mem_base != xmlMemBlocks()) {
28953 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
28954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028955 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028956 printf(" %d", n_reader);
28957 printf("\n");
28958 }
28959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028960 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028961#endif
28962
Daniel Veillard42595322004-11-08 10:52:06 +000028963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028964}
28965
28966
28967static int
28968test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028970
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028971#ifdef LIBXML_READER_ENABLED
28972 int mem_base;
28973 const xmlChar * ret_val;
28974 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28975 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028976
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028977 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28978 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028979 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028980
28981 ret_val = xmlTextReaderConstPrefix(reader);
28982 desret_const_xmlChar_ptr(ret_val);
28983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028984 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028985 xmlResetLastError();
28986 if (mem_base != xmlMemBlocks()) {
28987 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
28988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028989 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028990 printf(" %d", n_reader);
28991 printf("\n");
28992 }
28993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028994 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028995#endif
28996
Daniel Veillard42595322004-11-08 10:52:06 +000028997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028998}
28999
29000
29001static int
29002test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029004
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029005#ifdef LIBXML_READER_ENABLED
29006 int mem_base;
29007 const xmlChar * ret_val;
29008 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29009 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029010 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029011 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029012
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029013 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29014 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029016 reader = gen_xmlTextReaderPtr(n_reader, 0);
29017 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029018
William M. Brackf13f77f2004-11-12 16:03:48 +000029019 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029020 desret_const_xmlChar_ptr(ret_val);
29021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029022 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029023 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029024 xmlResetLastError();
29025 if (mem_base != xmlMemBlocks()) {
29026 printf("Leak of %d blocks found in xmlTextReaderConstString",
29027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029028 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029029 printf(" %d", n_reader);
29030 printf(" %d", n_str);
29031 printf("\n");
29032 }
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_xmlTextReaderConstValue(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 = xmlTextReaderConstValue(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 xmlTextReaderConstValue",
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_xmlTextReaderConstXmlLang(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 = xmlTextReaderConstXmlLang(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 xmlTextReaderConstXmlLang",
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_xmlTextReaderConstXmlVersion(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 = xmlTextReaderConstXmlVersion(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 xmlTextReaderConstXmlVersion",
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_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029147
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029148#ifdef LIBXML_READER_ENABLED
29149 int mem_base;
29150 xmlDocPtr ret_val;
29151 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29152 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029153
Daniel Veillarddd6d3002004-11-03 14:20:29 +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 Veillarddd6d3002004-11-03 14:20:29 +000029157
29158 ret_val = xmlTextReaderCurrentDoc(reader);
29159 desret_xmlDocPtr(ret_val);
29160 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029161 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029162 xmlResetLastError();
29163 if (mem_base != xmlMemBlocks()) {
29164 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029166 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029167 printf(" %d", n_reader);
29168 printf("\n");
29169 }
29170 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029171 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +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_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029181
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029182#ifdef LIBXML_READER_ENABLED
29183 int mem_base;
29184 xmlNodePtr ret_val;
29185 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29186 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029187
Daniel Veillarddd6d3002004-11-03 14:20:29 +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 Veillarddd6d3002004-11-03 14:20:29 +000029191
29192 ret_val = xmlTextReaderCurrentNode(reader);
29193 desret_xmlNodePtr(ret_val);
29194 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029195 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029196 xmlResetLastError();
29197 if (mem_base != xmlMemBlocks()) {
29198 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029200 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029201 printf(" %d", n_reader);
29202 printf("\n");
29203 }
29204 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029205 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +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_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029215
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029216#ifdef LIBXML_READER_ENABLED
29217 int mem_base;
29218 int ret_val;
29219 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29220 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029221
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029222 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029224 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029225
29226 ret_val = xmlTextReaderDepth(reader);
29227 desret_int(ret_val);
29228 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029229 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029230 xmlResetLastError();
29231 if (mem_base != xmlMemBlocks()) {
29232 printf("Leak of %d blocks found in xmlTextReaderDepth",
29233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029234 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029235 printf(" %d", n_reader);
29236 printf("\n");
29237 }
29238 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029239 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029240#endif
29241
Daniel Veillard42595322004-11-08 10:52:06 +000029242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029243}
29244
29245
29246static int
29247test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029249
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029250#ifdef LIBXML_READER_ENABLED
29251 int mem_base;
29252 xmlNodePtr ret_val;
29253 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29254 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029255
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029256 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029258 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029259
29260 ret_val = xmlTextReaderExpand(reader);
29261 desret_xmlNodePtr(ret_val);
29262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029263 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029264 xmlResetLastError();
29265 if (mem_base != xmlMemBlocks()) {
29266 printf("Leak of %d blocks found in xmlTextReaderExpand",
29267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029268 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029269 printf(" %d", n_reader);
29270 printf("\n");
29271 }
29272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029273 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029274#endif
29275
Daniel Veillard42595322004-11-08 10:52:06 +000029276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029277}
29278
29279
29280static int
29281test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029283
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029284#ifdef LIBXML_READER_ENABLED
29285 int mem_base;
29286 xmlChar * ret_val;
29287 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29288 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029289 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029290 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029291
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029292 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29293 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029295 reader = gen_xmlTextReaderPtr(n_reader, 0);
29296 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029297
William M. Brackf13f77f2004-11-12 16:03:48 +000029298 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029299 desret_xmlChar_ptr(ret_val);
29300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029301 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029302 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029303 xmlResetLastError();
29304 if (mem_base != xmlMemBlocks()) {
29305 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029307 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029308 printf(" %d", n_reader);
29309 printf(" %d", n_name);
29310 printf("\n");
29311 }
29312 }
29313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029314 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +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_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029324
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029325#ifdef LIBXML_READER_ENABLED
29326 int mem_base;
29327 xmlChar * ret_val;
29328 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29329 int n_reader;
29330 int no; /* the zero-based index of the attribute relative to the containing element */
29331 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029332
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029333 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29334 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29335 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029336 reader = gen_xmlTextReaderPtr(n_reader, 0);
29337 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029338
29339 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29340 desret_xmlChar_ptr(ret_val);
29341 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029342 des_xmlTextReaderPtr(n_reader, reader, 0);
29343 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029344 xmlResetLastError();
29345 if (mem_base != xmlMemBlocks()) {
29346 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029348 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029349 printf(" %d", n_reader);
29350 printf(" %d", n_no);
29351 printf("\n");
29352 }
29353 }
29354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029355 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029356#endif
29357
Daniel Veillard42595322004-11-08 10:52:06 +000029358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029359}
29360
29361
29362static int
29363test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029365
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029366#ifdef LIBXML_READER_ENABLED
29367 int mem_base;
29368 xmlChar * ret_val;
29369 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29370 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029371 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029372 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029373 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029374 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029375
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029376 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29377 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29378 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29379 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029380 reader = gen_xmlTextReaderPtr(n_reader, 0);
29381 localName = gen_const_xmlChar_ptr(n_localName, 1);
29382 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029383
William M. Brackf13f77f2004-11-12 16:03:48 +000029384 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029385 desret_xmlChar_ptr(ret_val);
29386 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029387 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029388 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29389 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029390 xmlResetLastError();
29391 if (mem_base != xmlMemBlocks()) {
29392 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029394 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029395 printf(" %d", n_reader);
29396 printf(" %d", n_localName);
29397 printf(" %d", n_namespaceURI);
29398 printf("\n");
29399 }
29400 }
29401 }
29402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029403 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029404#endif
29405
Daniel Veillard42595322004-11-08 10:52:06 +000029406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029407}
29408
Daniel Veillarda521d282004-11-09 14:59:59 +000029409#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029410
Daniel Veillardce682bc2004-11-05 17:22:25 +000029411#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29412static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29413 return(NULL);
29414}
29415static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29416}
Daniel Veillarda521d282004-11-09 14:59:59 +000029417#endif
29418
Daniel Veillardce682bc2004-11-05 17:22:25 +000029419
Daniel Veillardd93f6252004-11-02 15:53:51 +000029420static int
29421test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029422 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029423
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029424#ifdef LIBXML_READER_ENABLED
29425 int mem_base;
29426 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29427 int n_reader;
29428 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29429 int n_f;
29430 void ** arg; /* a user argument */
29431 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029432
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029433 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29434 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29435 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29436 mem_base = xmlMemBlocks();
29437 reader = gen_xmlTextReaderPtr(n_reader, 0);
29438 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29439 arg = gen_void_ptr_ptr(n_arg, 2);
29440
29441 xmlTextReaderGetErrorHandler(reader, f, arg);
29442 call_tests++;
29443 des_xmlTextReaderPtr(n_reader, reader, 0);
29444 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29445 des_void_ptr_ptr(n_arg, arg, 2);
29446 xmlResetLastError();
29447 if (mem_base != xmlMemBlocks()) {
29448 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029450 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029451 printf(" %d", n_reader);
29452 printf(" %d", n_f);
29453 printf(" %d", n_arg);
29454 printf("\n");
29455 }
29456 }
29457 }
29458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029459 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029460#endif
29461
Daniel Veillard42595322004-11-08 10:52:06 +000029462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029463}
29464
29465
29466static int
29467test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029469
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029470#ifdef LIBXML_READER_ENABLED
29471 int mem_base;
29472 int ret_val;
29473 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29474 int n_reader;
29475 int prop; /* the xmlParserProperties to get */
29476 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029477
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029478 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29479 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029481 reader = gen_xmlTextReaderPtr(n_reader, 0);
29482 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029483
29484 ret_val = xmlTextReaderGetParserProp(reader, prop);
29485 desret_int(ret_val);
29486 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029487 des_xmlTextReaderPtr(n_reader, reader, 0);
29488 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029489 xmlResetLastError();
29490 if (mem_base != xmlMemBlocks()) {
29491 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029493 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029494 printf(" %d", n_reader);
29495 printf(" %d", n_prop);
29496 printf("\n");
29497 }
29498 }
29499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029500 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029501#endif
29502
Daniel Veillard42595322004-11-08 10:52:06 +000029503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029504}
29505
29506
29507static int
29508test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029510
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029511#ifdef LIBXML_READER_ENABLED
29512 int mem_base;
29513 xmlParserInputBufferPtr ret_val;
29514 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29515 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029516
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029517 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29518 mem_base = xmlMemBlocks();
29519 reader = gen_xmlTextReaderPtr(n_reader, 0);
29520
29521 ret_val = xmlTextReaderGetRemainder(reader);
29522 desret_xmlParserInputBufferPtr(ret_val);
29523 call_tests++;
29524 des_xmlTextReaderPtr(n_reader, reader, 0);
29525 xmlResetLastError();
29526 if (mem_base != xmlMemBlocks()) {
29527 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029529 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029530 printf(" %d", n_reader);
29531 printf("\n");
29532 }
29533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029534 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029535#endif
29536
Daniel Veillard42595322004-11-08 10:52:06 +000029537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029538}
29539
29540
29541static int
29542test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029544
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029545#ifdef LIBXML_READER_ENABLED
29546 int mem_base;
29547 int ret_val;
29548 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29549 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029550
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029551 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29552 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029553 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029554
29555 ret_val = xmlTextReaderHasAttributes(reader);
29556 desret_int(ret_val);
29557 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029558 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029559 xmlResetLastError();
29560 if (mem_base != xmlMemBlocks()) {
29561 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029563 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029564 printf(" %d", n_reader);
29565 printf("\n");
29566 }
29567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029568 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029569#endif
29570
Daniel Veillard42595322004-11-08 10:52:06 +000029571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029572}
29573
29574
29575static int
29576test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029578
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029579#ifdef LIBXML_READER_ENABLED
29580 int mem_base;
29581 int ret_val;
29582 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29583 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029584
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029585 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029587 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029588
29589 ret_val = xmlTextReaderHasValue(reader);
29590 desret_int(ret_val);
29591 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029592 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029593 xmlResetLastError();
29594 if (mem_base != xmlMemBlocks()) {
29595 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029597 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029598 printf(" %d", n_reader);
29599 printf("\n");
29600 }
29601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029602 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029603#endif
29604
Daniel Veillard42595322004-11-08 10:52:06 +000029605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029606}
29607
29608
29609static int
29610test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029612
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029613#ifdef LIBXML_READER_ENABLED
29614 int mem_base;
29615 int ret_val;
29616 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29617 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029618
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029619 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29620 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029621 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029622
29623 ret_val = xmlTextReaderIsDefault(reader);
29624 desret_int(ret_val);
29625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029626 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029627 xmlResetLastError();
29628 if (mem_base != xmlMemBlocks()) {
29629 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029631 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029632 printf(" %d", n_reader);
29633 printf("\n");
29634 }
29635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029636 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029637#endif
29638
Daniel Veillard42595322004-11-08 10:52:06 +000029639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029640}
29641
29642
29643static int
29644test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029646
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029647#ifdef LIBXML_READER_ENABLED
29648 int mem_base;
29649 int ret_val;
29650 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29651 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029652
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029653 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29654 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029655 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029656
29657 ret_val = xmlTextReaderIsEmptyElement(reader);
29658 desret_int(ret_val);
29659 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029660 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029661 xmlResetLastError();
29662 if (mem_base != xmlMemBlocks()) {
29663 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029665 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029666 printf(" %d", n_reader);
29667 printf("\n");
29668 }
29669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029670 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +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_xmlTextReaderIsNamespaceDecl(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;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029686
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029687 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29688 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029689 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029690
29691 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29692 desret_int(ret_val);
29693 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029694 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029695 xmlResetLastError();
29696 if (mem_base != xmlMemBlocks()) {
29697 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029699 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029700 printf(" %d", n_reader);
29701 printf("\n");
29702 }
29703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029704 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029705#endif
29706
Daniel Veillard42595322004-11-08 10:52:06 +000029707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029708}
29709
29710
29711static int
29712test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029714
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029715#ifdef LIBXML_READER_ENABLED
29716 int mem_base;
29717 int ret_val;
29718 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29719 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029720
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029721 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029723 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029724
29725 ret_val = xmlTextReaderIsValid(reader);
29726 desret_int(ret_val);
29727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029728 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029729 xmlResetLastError();
29730 if (mem_base != xmlMemBlocks()) {
29731 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029733 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029734 printf(" %d", n_reader);
29735 printf("\n");
29736 }
29737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029738 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029739#endif
29740
Daniel Veillard42595322004-11-08 10:52:06 +000029741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029742}
29743
29744
29745static int
29746test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029748
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029749#ifdef LIBXML_READER_ENABLED
29750 int mem_base;
29751 xmlChar * ret_val;
29752 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29753 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029754
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029755 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29756 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029757 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029758
29759 ret_val = xmlTextReaderLocalName(reader);
29760 desret_xmlChar_ptr(ret_val);
29761 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029762 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029763 xmlResetLastError();
29764 if (mem_base != xmlMemBlocks()) {
29765 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029767 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029768 printf(" %d", n_reader);
29769 printf("\n");
29770 }
29771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029772 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029773#endif
29774
Daniel Veillard42595322004-11-08 10:52:06 +000029775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029776}
29777
Daniel Veillarda521d282004-11-09 14:59:59 +000029778#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029779
Daniel Veillardce682bc2004-11-05 17:22:25 +000029780#define gen_nb_xmlTextReaderLocatorPtr 1
29781static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29782 return(NULL);
29783}
29784static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29785}
Daniel Veillarda521d282004-11-09 14:59:59 +000029786#endif
29787
Daniel Veillardce682bc2004-11-05 17:22:25 +000029788
Daniel Veillardd93f6252004-11-02 15:53:51 +000029789static int
29790test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029792
Daniel Veillardce682bc2004-11-05 17:22:25 +000029793#ifdef LIBXML_READER_ENABLED
29794 int mem_base;
29795 xmlChar * ret_val;
29796 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29797 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029798
Daniel Veillardce682bc2004-11-05 17:22:25 +000029799 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29800 mem_base = xmlMemBlocks();
29801 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29802
29803 ret_val = xmlTextReaderLocatorBaseURI(locator);
29804 desret_xmlChar_ptr(ret_val);
29805 call_tests++;
29806 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29807 xmlResetLastError();
29808 if (mem_base != xmlMemBlocks()) {
29809 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
29810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029811 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029812 printf(" %d", n_locator);
29813 printf("\n");
29814 }
29815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029816 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029817#endif
29818
Daniel Veillard42595322004-11-08 10:52:06 +000029819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029820}
29821
29822
29823static int
29824test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029826
Daniel Veillardce682bc2004-11-05 17:22:25 +000029827#ifdef LIBXML_READER_ENABLED
29828 int mem_base;
29829 int ret_val;
29830 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29831 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029832
Daniel Veillardce682bc2004-11-05 17:22:25 +000029833 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29834 mem_base = xmlMemBlocks();
29835 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29836
29837 ret_val = xmlTextReaderLocatorLineNumber(locator);
29838 desret_int(ret_val);
29839 call_tests++;
29840 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29841 xmlResetLastError();
29842 if (mem_base != xmlMemBlocks()) {
29843 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
29844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029845 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029846 printf(" %d", n_locator);
29847 printf("\n");
29848 }
29849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029850 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029851#endif
29852
Daniel Veillard42595322004-11-08 10:52:06 +000029853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029854}
29855
29856
29857static int
29858test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029860
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029861#ifdef LIBXML_READER_ENABLED
29862 int mem_base;
29863 xmlChar * ret_val;
29864 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29865 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029866 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 +000029867 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029868
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029869 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29870 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
29871 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029872 reader = gen_xmlTextReaderPtr(n_reader, 0);
29873 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029874
William M. Brackf13f77f2004-11-12 16:03:48 +000029875 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029876 desret_xmlChar_ptr(ret_val);
29877 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029878 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029879 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029880 xmlResetLastError();
29881 if (mem_base != xmlMemBlocks()) {
29882 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
29883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029884 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029885 printf(" %d", n_reader);
29886 printf(" %d", n_prefix);
29887 printf("\n");
29888 }
29889 }
29890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029891 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892#endif
29893
Daniel Veillard42595322004-11-08 10:52:06 +000029894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029895}
29896
29897
29898static int
29899test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029901
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029902#ifdef LIBXML_READER_ENABLED
29903 int mem_base;
29904 int ret_val;
29905 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29906 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029907 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029908 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029909
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029910 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29911 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029913 reader = gen_xmlTextReaderPtr(n_reader, 0);
29914 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029915
William M. Brackf13f77f2004-11-12 16:03:48 +000029916 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029917 desret_int(ret_val);
29918 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029919 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029920 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029921 xmlResetLastError();
29922 if (mem_base != xmlMemBlocks()) {
29923 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
29924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029925 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926 printf(" %d", n_reader);
29927 printf(" %d", n_name);
29928 printf("\n");
29929 }
29930 }
29931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029932 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029933#endif
29934
Daniel Veillard42595322004-11-08 10:52:06 +000029935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029936}
29937
29938
29939static int
29940test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029942
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029943#ifdef LIBXML_READER_ENABLED
29944 int mem_base;
29945 int ret_val;
29946 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29947 int n_reader;
29948 int no; /* the zero-based index of the attribute relative to the containing element. */
29949 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029950
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029951 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29952 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29953 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029954 reader = gen_xmlTextReaderPtr(n_reader, 0);
29955 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029956
29957 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
29958 desret_int(ret_val);
29959 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029960 des_xmlTextReaderPtr(n_reader, reader, 0);
29961 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029962 xmlResetLastError();
29963 if (mem_base != xmlMemBlocks()) {
29964 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
29965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029966 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029967 printf(" %d", n_reader);
29968 printf(" %d", n_no);
29969 printf("\n");
29970 }
29971 }
29972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029973 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029974#endif
29975
Daniel Veillard42595322004-11-08 10:52:06 +000029976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029977}
29978
29979
29980static int
29981test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029983
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029984#ifdef LIBXML_READER_ENABLED
29985 int mem_base;
29986 int ret_val;
29987 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29988 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029989 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029990 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029991 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029992 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029993
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029994 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29995 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29996 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29997 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029998 reader = gen_xmlTextReaderPtr(n_reader, 0);
29999 localName = gen_const_xmlChar_ptr(n_localName, 1);
30000 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030001
William M. Brackf13f77f2004-11-12 16:03:48 +000030002 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030003 desret_int(ret_val);
30004 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030005 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030006 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30007 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030008 xmlResetLastError();
30009 if (mem_base != xmlMemBlocks()) {
30010 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030012 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030013 printf(" %d", n_reader);
30014 printf(" %d", n_localName);
30015 printf(" %d", n_namespaceURI);
30016 printf("\n");
30017 }
30018 }
30019 }
30020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030021 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030022#endif
30023
Daniel Veillard42595322004-11-08 10:52:06 +000030024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030025}
30026
30027
30028static int
30029test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030031
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030032#ifdef LIBXML_READER_ENABLED
30033 int mem_base;
30034 int ret_val;
30035 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30036 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030037
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030038 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030040 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030041
30042 ret_val = xmlTextReaderMoveToElement(reader);
30043 desret_int(ret_val);
30044 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030045 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030046 xmlResetLastError();
30047 if (mem_base != xmlMemBlocks()) {
30048 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030050 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030051 printf(" %d", n_reader);
30052 printf("\n");
30053 }
30054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030055 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030056#endif
30057
Daniel Veillard42595322004-11-08 10:52:06 +000030058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030059}
30060
30061
30062static int
30063test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030065
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030066#ifdef LIBXML_READER_ENABLED
30067 int mem_base;
30068 int ret_val;
30069 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30070 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030071
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030074 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030075
30076 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30077 desret_int(ret_val);
30078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030079 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080 xmlResetLastError();
30081 if (mem_base != xmlMemBlocks()) {
30082 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030084 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030085 printf(" %d", n_reader);
30086 printf("\n");
30087 }
30088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030089 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030090#endif
30091
Daniel Veillard42595322004-11-08 10:52:06 +000030092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030093}
30094
30095
30096static int
30097test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030099
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030100#ifdef LIBXML_READER_ENABLED
30101 int mem_base;
30102 int ret_val;
30103 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30104 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030105
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030106 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030108 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030109
30110 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30111 desret_int(ret_val);
30112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030113 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030114 xmlResetLastError();
30115 if (mem_base != xmlMemBlocks()) {
30116 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030118 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030119 printf(" %d", n_reader);
30120 printf("\n");
30121 }
30122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030123 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030124#endif
30125
Daniel Veillard42595322004-11-08 10:52:06 +000030126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030127}
30128
30129
30130static int
30131test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030133
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030134#ifdef LIBXML_READER_ENABLED
30135 int mem_base;
30136 xmlChar * ret_val;
30137 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30138 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030139
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030140 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030142 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030143
30144 ret_val = xmlTextReaderName(reader);
30145 desret_xmlChar_ptr(ret_val);
30146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030147 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030148 xmlResetLastError();
30149 if (mem_base != xmlMemBlocks()) {
30150 printf("Leak of %d blocks found in xmlTextReaderName",
30151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030152 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030153 printf(" %d", n_reader);
30154 printf("\n");
30155 }
30156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030157 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030158#endif
30159
Daniel Veillard42595322004-11-08 10:52:06 +000030160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030161}
30162
30163
30164static int
30165test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030167
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030168#ifdef LIBXML_READER_ENABLED
30169 int mem_base;
30170 xmlChar * ret_val;
30171 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30172 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030173
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030176 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030177
30178 ret_val = xmlTextReaderNamespaceUri(reader);
30179 desret_xmlChar_ptr(ret_val);
30180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030181 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030182 xmlResetLastError();
30183 if (mem_base != xmlMemBlocks()) {
30184 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030186 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030187 printf(" %d", n_reader);
30188 printf("\n");
30189 }
30190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030191 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030192#endif
30193
Daniel Veillard42595322004-11-08 10:52:06 +000030194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030195}
30196
30197
30198static int
30199test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030201
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030202#ifdef LIBXML_READER_ENABLED
30203 int mem_base;
30204 int ret_val;
30205 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30206 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030207
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030208 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030210 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030211
30212 ret_val = xmlTextReaderNext(reader);
30213 desret_int(ret_val);
30214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030215 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030216 xmlResetLastError();
30217 if (mem_base != xmlMemBlocks()) {
30218 printf("Leak of %d blocks found in xmlTextReaderNext",
30219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030220 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030221 printf(" %d", n_reader);
30222 printf("\n");
30223 }
30224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030225 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030226#endif
30227
Daniel Veillard42595322004-11-08 10:52:06 +000030228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030229}
30230
30231
30232static int
30233test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030235
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030236#ifdef LIBXML_READER_ENABLED
30237 int mem_base;
30238 int ret_val;
30239 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30240 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030241
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030242 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030244 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030245
30246 ret_val = xmlTextReaderNextSibling(reader);
30247 desret_int(ret_val);
30248 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030249 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250 xmlResetLastError();
30251 if (mem_base != xmlMemBlocks()) {
30252 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030254 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030255 printf(" %d", n_reader);
30256 printf("\n");
30257 }
30258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030259 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030260#endif
30261
Daniel Veillard42595322004-11-08 10:52:06 +000030262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030263}
30264
30265
30266static int
30267test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030269
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030270#ifdef LIBXML_READER_ENABLED
30271 int mem_base;
30272 int ret_val;
30273 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30274 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030275
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030276 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030278 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030279
30280 ret_val = xmlTextReaderNodeType(reader);
30281 desret_int(ret_val);
30282 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030283 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030284 xmlResetLastError();
30285 if (mem_base != xmlMemBlocks()) {
30286 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030288 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030289 printf(" %d", n_reader);
30290 printf("\n");
30291 }
30292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030293 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030294#endif
30295
Daniel Veillard42595322004-11-08 10:52:06 +000030296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030297}
30298
30299
30300static int
30301test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030303
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030304#ifdef LIBXML_READER_ENABLED
30305 int mem_base;
30306 int ret_val;
30307 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30308 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030309
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030310 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030312 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030313
30314 ret_val = xmlTextReaderNormalization(reader);
30315 desret_int(ret_val);
30316 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030317 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030318 xmlResetLastError();
30319 if (mem_base != xmlMemBlocks()) {
30320 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030322 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030323 printf(" %d", n_reader);
30324 printf("\n");
30325 }
30326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030327 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030328#endif
30329
Daniel Veillard42595322004-11-08 10:52:06 +000030330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030331}
30332
30333
30334static int
30335test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030337
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030338#ifdef LIBXML_READER_ENABLED
30339 int mem_base;
30340 xmlChar * ret_val;
30341 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30342 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030343
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030344 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30345 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030346 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030347
30348 ret_val = xmlTextReaderPrefix(reader);
30349 desret_xmlChar_ptr(ret_val);
30350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030351 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030352 xmlResetLastError();
30353 if (mem_base != xmlMemBlocks()) {
30354 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030356 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030357 printf(" %d", n_reader);
30358 printf("\n");
30359 }
30360 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030361 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030362#endif
30363
Daniel Veillard42595322004-11-08 10:52:06 +000030364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030365}
30366
30367
30368static int
30369test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030371
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030372#ifdef LIBXML_READER_ENABLED
30373 int mem_base;
30374 xmlNodePtr ret_val;
30375 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30376 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030377
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030378 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30379 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030380 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030381
30382 ret_val = xmlTextReaderPreserve(reader);
30383 desret_xmlNodePtr(ret_val);
30384 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030385 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030386 xmlResetLastError();
30387 if (mem_base != xmlMemBlocks()) {
30388 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030390 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030391 printf(" %d", n_reader);
30392 printf("\n");
30393 }
30394 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030395 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030396#endif
30397
Daniel Veillard42595322004-11-08 10:52:06 +000030398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030399}
30400
30401
30402static int
30403test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030405
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030406#ifdef LIBXML_READER_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030407#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030408 int mem_base;
30409 int ret_val;
30410 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30411 int n_reader;
30412 xmlChar * pattern; /* an XPath subset pattern */
30413 int n_pattern;
30414 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30415 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030416
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030417 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30418 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30419 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30420 mem_base = xmlMemBlocks();
30421 reader = gen_xmlTextReaderPtr(n_reader, 0);
30422 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30423 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30424
William M. Brackf13f77f2004-11-12 16:03:48 +000030425 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030426 desret_int(ret_val);
30427 call_tests++;
30428 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030429 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30430 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030431 xmlResetLastError();
30432 if (mem_base != xmlMemBlocks()) {
30433 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030435 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030436 printf(" %d", n_reader);
30437 printf(" %d", n_pattern);
30438 printf(" %d", n_namespaces);
30439 printf("\n");
30440 }
30441 }
30442 }
30443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030444 function_tests++;
30445#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030446#endif
30447
Daniel Veillard42595322004-11-08 10:52:06 +000030448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030449}
30450
30451
30452static int
30453test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030455
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030456#ifdef LIBXML_READER_ENABLED
30457 int mem_base;
30458 int ret_val;
30459 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30460 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030461
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030462 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30463 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030464 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030465
30466 ret_val = xmlTextReaderQuoteChar(reader);
30467 desret_int(ret_val);
30468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030469 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030470 xmlResetLastError();
30471 if (mem_base != xmlMemBlocks()) {
30472 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030474 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030475 printf(" %d", n_reader);
30476 printf("\n");
30477 }
30478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030479 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030480#endif
30481
Daniel Veillard42595322004-11-08 10:52:06 +000030482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030483}
30484
30485
30486static int
30487test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030489
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030490#ifdef LIBXML_READER_ENABLED
30491 int mem_base;
30492 int ret_val;
30493 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30494 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030495
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030496 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030498 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030499
30500 ret_val = xmlTextReaderRead(reader);
30501 desret_int(ret_val);
30502 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030503 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030504 xmlResetLastError();
30505 if (mem_base != xmlMemBlocks()) {
30506 printf("Leak of %d blocks found in xmlTextReaderRead",
30507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030508 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030509 printf(" %d", n_reader);
30510 printf("\n");
30511 }
30512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030513 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030514#endif
30515
Daniel Veillard42595322004-11-08 10:52:06 +000030516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030517}
30518
30519
30520static int
30521test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030523
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030524#ifdef LIBXML_READER_ENABLED
30525 int mem_base;
30526 int ret_val;
30527 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30528 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030529
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030530 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30531 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030532 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030533
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030534 ret_val = xmlTextReaderReadAttributeValue(reader);
30535 desret_int(ret_val);
30536 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030537 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030538 xmlResetLastError();
30539 if (mem_base != xmlMemBlocks()) {
30540 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030542 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030543 printf(" %d", n_reader);
30544 printf("\n");
30545 }
30546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030547 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030548#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030549
Daniel Veillard42595322004-11-08 10:52:06 +000030550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030551}
30552
30553
30554static int
30555test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030557
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030558#ifdef LIBXML_READER_ENABLED
30559 int mem_base;
30560 int ret_val;
30561 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30562 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030563
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030564 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030566 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030567
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030568 ret_val = xmlTextReaderReadState(reader);
30569 desret_int(ret_val);
30570 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030571 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030572 xmlResetLastError();
30573 if (mem_base != xmlMemBlocks()) {
30574 printf("Leak of %d blocks found in xmlTextReaderReadState",
30575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030576 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030577 printf(" %d", n_reader);
30578 printf("\n");
30579 }
30580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030581 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030582#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030583
Daniel Veillard42595322004-11-08 10:52:06 +000030584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030585}
30586
30587
30588static int
30589test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030591
Daniel Veillardce682bc2004-11-05 17:22:25 +000030592#ifdef LIBXML_READER_ENABLED
30593#ifdef LIBXML_SCHEMAS_ENABLED
30594 int mem_base;
30595 int ret_val;
30596 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30597 int n_reader;
30598 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30599 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030600
Daniel Veillardce682bc2004-11-05 17:22:25 +000030601 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30602 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30603 mem_base = xmlMemBlocks();
30604 reader = gen_xmlTextReaderPtr(n_reader, 0);
30605 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30606
30607 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30608 desret_int(ret_val);
30609 call_tests++;
30610 des_xmlTextReaderPtr(n_reader, reader, 0);
30611 des_xmlRelaxNGPtr(n_schema, schema, 1);
30612 xmlResetLastError();
30613 if (mem_base != xmlMemBlocks()) {
30614 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030616 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030617 printf(" %d", n_reader);
30618 printf(" %d", n_schema);
30619 printf("\n");
30620 }
30621 }
30622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030623 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030624#endif
30625#endif
30626
Daniel Veillard42595322004-11-08 10:52:06 +000030627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030628}
30629
30630
30631static int
30632test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030634
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030635#ifdef LIBXML_READER_ENABLED
30636#ifdef LIBXML_SCHEMAS_ENABLED
30637 int mem_base;
30638 int ret_val;
30639 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30640 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030641 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030642 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030643
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030644 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30645 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30646 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030647 reader = gen_xmlTextReaderPtr(n_reader, 0);
30648 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030649
William M. Brackf13f77f2004-11-12 16:03:48 +000030650 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030651 desret_int(ret_val);
30652 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030653 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030654 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030655 xmlResetLastError();
30656 if (mem_base != xmlMemBlocks()) {
30657 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030659 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030660 printf(" %d", n_reader);
30661 printf(" %d", n_rng);
30662 printf("\n");
30663 }
30664 }
30665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030666 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030667#endif
30668#endif
30669
Daniel Veillard42595322004-11-08 10:52:06 +000030670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030671}
30672
30673
30674static int
30675test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030677
30678
30679 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030681}
30682
30683
30684static int
30685test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030687
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030688#ifdef LIBXML_READER_ENABLED
30689 int mem_base;
30690 int ret_val;
30691 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30692 int n_reader;
30693 int prop; /* the xmlParserProperties to set */
30694 int n_prop;
30695 int value; /* usually 0 or 1 to (de)activate it */
30696 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030697
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030698 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30699 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30700 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030702 reader = gen_xmlTextReaderPtr(n_reader, 0);
30703 prop = gen_int(n_prop, 1);
30704 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030705
30706 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30707 desret_int(ret_val);
30708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030709 des_xmlTextReaderPtr(n_reader, reader, 0);
30710 des_int(n_prop, prop, 1);
30711 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030712 xmlResetLastError();
30713 if (mem_base != xmlMemBlocks()) {
30714 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030716 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030717 printf(" %d", n_reader);
30718 printf(" %d", n_prop);
30719 printf(" %d", n_value);
30720 printf("\n");
30721 }
30722 }
30723 }
30724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030725 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030726#endif
30727
Daniel Veillard42595322004-11-08 10:52:06 +000030728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030729}
30730
30731
30732static int
30733test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030735
30736
30737 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030739}
30740
30741
30742static int
30743test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030745
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030746#ifdef LIBXML_READER_ENABLED
30747 int mem_base;
30748 int ret_val;
30749 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30750 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030751
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030752 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030754 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030755
30756 ret_val = xmlTextReaderStandalone(reader);
30757 desret_int(ret_val);
30758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030759 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030760 xmlResetLastError();
30761 if (mem_base != xmlMemBlocks()) {
30762 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030764 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030765 printf(" %d", n_reader);
30766 printf("\n");
30767 }
30768 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030769 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030770#endif
30771
Daniel Veillard42595322004-11-08 10:52:06 +000030772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030773}
30774
30775
30776static int
30777test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030779
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030780#ifdef LIBXML_READER_ENABLED
30781 int mem_base;
30782 xmlChar * ret_val;
30783 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30784 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030785
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030786 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30787 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030788 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030789
30790 ret_val = xmlTextReaderValue(reader);
30791 desret_xmlChar_ptr(ret_val);
30792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030793 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030794 xmlResetLastError();
30795 if (mem_base != xmlMemBlocks()) {
30796 printf("Leak of %d blocks found in xmlTextReaderValue",
30797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030798 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030799 printf(" %d", n_reader);
30800 printf("\n");
30801 }
30802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030803 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030804#endif
30805
Daniel Veillard42595322004-11-08 10:52:06 +000030806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030807}
30808
30809
30810static int
30811test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030813
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030814#ifdef LIBXML_READER_ENABLED
30815 int mem_base;
30816 xmlChar * ret_val;
30817 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30818 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030819
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030820 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30821 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030822 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030823
30824 ret_val = xmlTextReaderXmlLang(reader);
30825 desret_xmlChar_ptr(ret_val);
30826 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030827 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030828 xmlResetLastError();
30829 if (mem_base != xmlMemBlocks()) {
30830 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
30831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030832 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030833 printf(" %d", n_reader);
30834 printf("\n");
30835 }
30836 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030837 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030838#endif
30839
Daniel Veillard42595322004-11-08 10:52:06 +000030840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030841}
30842
30843static int
30844test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030846
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030847 if (quiet == 0) printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000030848 test_ret += test_xmlNewTextReader();
30849 test_ret += test_xmlNewTextReaderFilename();
30850 test_ret += test_xmlReaderForDoc();
30851 test_ret += test_xmlReaderForFile();
30852 test_ret += test_xmlReaderForMemory();
30853 test_ret += test_xmlReaderNewDoc();
30854 test_ret += test_xmlReaderNewFile();
30855 test_ret += test_xmlReaderNewMemory();
30856 test_ret += test_xmlReaderNewWalker();
30857 test_ret += test_xmlReaderWalker();
30858 test_ret += test_xmlTextReaderAttributeCount();
30859 test_ret += test_xmlTextReaderBaseUri();
30860 test_ret += test_xmlTextReaderClose();
30861 test_ret += test_xmlTextReaderConstBaseUri();
30862 test_ret += test_xmlTextReaderConstEncoding();
30863 test_ret += test_xmlTextReaderConstLocalName();
30864 test_ret += test_xmlTextReaderConstName();
30865 test_ret += test_xmlTextReaderConstNamespaceUri();
30866 test_ret += test_xmlTextReaderConstPrefix();
30867 test_ret += test_xmlTextReaderConstString();
30868 test_ret += test_xmlTextReaderConstValue();
30869 test_ret += test_xmlTextReaderConstXmlLang();
30870 test_ret += test_xmlTextReaderConstXmlVersion();
30871 test_ret += test_xmlTextReaderCurrentDoc();
30872 test_ret += test_xmlTextReaderCurrentNode();
30873 test_ret += test_xmlTextReaderDepth();
30874 test_ret += test_xmlTextReaderExpand();
30875 test_ret += test_xmlTextReaderGetAttribute();
30876 test_ret += test_xmlTextReaderGetAttributeNo();
30877 test_ret += test_xmlTextReaderGetAttributeNs();
30878 test_ret += test_xmlTextReaderGetErrorHandler();
30879 test_ret += test_xmlTextReaderGetParserProp();
30880 test_ret += test_xmlTextReaderGetRemainder();
30881 test_ret += test_xmlTextReaderHasAttributes();
30882 test_ret += test_xmlTextReaderHasValue();
30883 test_ret += test_xmlTextReaderIsDefault();
30884 test_ret += test_xmlTextReaderIsEmptyElement();
30885 test_ret += test_xmlTextReaderIsNamespaceDecl();
30886 test_ret += test_xmlTextReaderIsValid();
30887 test_ret += test_xmlTextReaderLocalName();
30888 test_ret += test_xmlTextReaderLocatorBaseURI();
30889 test_ret += test_xmlTextReaderLocatorLineNumber();
30890 test_ret += test_xmlTextReaderLookupNamespace();
30891 test_ret += test_xmlTextReaderMoveToAttribute();
30892 test_ret += test_xmlTextReaderMoveToAttributeNo();
30893 test_ret += test_xmlTextReaderMoveToAttributeNs();
30894 test_ret += test_xmlTextReaderMoveToElement();
30895 test_ret += test_xmlTextReaderMoveToFirstAttribute();
30896 test_ret += test_xmlTextReaderMoveToNextAttribute();
30897 test_ret += test_xmlTextReaderName();
30898 test_ret += test_xmlTextReaderNamespaceUri();
30899 test_ret += test_xmlTextReaderNext();
30900 test_ret += test_xmlTextReaderNextSibling();
30901 test_ret += test_xmlTextReaderNodeType();
30902 test_ret += test_xmlTextReaderNormalization();
30903 test_ret += test_xmlTextReaderPrefix();
30904 test_ret += test_xmlTextReaderPreserve();
30905 test_ret += test_xmlTextReaderPreservePattern();
30906 test_ret += test_xmlTextReaderQuoteChar();
30907 test_ret += test_xmlTextReaderRead();
30908 test_ret += test_xmlTextReaderReadAttributeValue();
30909 test_ret += test_xmlTextReaderReadState();
30910 test_ret += test_xmlTextReaderRelaxNGSetSchema();
30911 test_ret += test_xmlTextReaderRelaxNGValidate();
30912 test_ret += test_xmlTextReaderSetErrorHandler();
30913 test_ret += test_xmlTextReaderSetParserProp();
30914 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
30915 test_ret += test_xmlTextReaderStandalone();
30916 test_ret += test_xmlTextReaderValue();
30917 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000030918
Daniel Veillard42595322004-11-08 10:52:06 +000030919 if (test_ret != 0)
30920 printf("Module xmlreader: %d errors\n", test_ret);
30921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030922}
Daniel Veillarda521d282004-11-09 14:59:59 +000030923#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030924
Daniel Veillarda82b1822004-11-08 16:24:57 +000030925#define gen_nb_xmlRegExecCtxtPtr 1
30926static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30927 return(NULL);
30928}
30929static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30930}
Daniel Veillarda521d282004-11-09 14:59:59 +000030931#endif
30932
Daniel Veillarda82b1822004-11-08 16:24:57 +000030933
30934static int
30935test_xmlRegExecPushString(void) {
30936 int test_ret = 0;
30937
30938#ifdef LIBXML_REGEXP_ENABLED
30939 int mem_base;
30940 int ret_val;
30941 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30942 int n_exec;
30943 xmlChar * value; /* a string token input */
30944 int n_value;
30945 void * data; /* data associated to the token to reuse in callbacks */
30946 int n_data;
30947
30948 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30949 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30950 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30951 mem_base = xmlMemBlocks();
30952 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30953 value = gen_const_xmlChar_ptr(n_value, 1);
30954 data = gen_userdata(n_data, 2);
30955
William M. Brackf13f77f2004-11-12 16:03:48 +000030956 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030957 desret_int(ret_val);
30958 call_tests++;
30959 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030960 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030961 des_userdata(n_data, data, 2);
30962 xmlResetLastError();
30963 if (mem_base != xmlMemBlocks()) {
30964 printf("Leak of %d blocks found in xmlRegExecPushString",
30965 xmlMemBlocks() - mem_base);
30966 test_ret++;
30967 printf(" %d", n_exec);
30968 printf(" %d", n_value);
30969 printf(" %d", n_data);
30970 printf("\n");
30971 }
30972 }
30973 }
30974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030975 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000030976#endif
30977
Daniel Veillarda82b1822004-11-08 16:24:57 +000030978 return(test_ret);
30979}
30980
30981
30982static int
30983test_xmlRegExecPushString2(void) {
30984 int test_ret = 0;
30985
30986#ifdef LIBXML_REGEXP_ENABLED
30987 int mem_base;
30988 int ret_val;
30989 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30990 int n_exec;
30991 xmlChar * value; /* the first string token input */
30992 int n_value;
30993 xmlChar * value2; /* the second string token input */
30994 int n_value2;
30995 void * data; /* data associated to the token to reuse in callbacks */
30996 int n_data;
30997
30998 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30999 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31000 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31001 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31002 mem_base = xmlMemBlocks();
31003 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31004 value = gen_const_xmlChar_ptr(n_value, 1);
31005 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31006 data = gen_userdata(n_data, 3);
31007
William M. Brackf13f77f2004-11-12 16:03:48 +000031008 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031009 desret_int(ret_val);
31010 call_tests++;
31011 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031012 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31013 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031014 des_userdata(n_data, data, 3);
31015 xmlResetLastError();
31016 if (mem_base != xmlMemBlocks()) {
31017 printf("Leak of %d blocks found in xmlRegExecPushString2",
31018 xmlMemBlocks() - mem_base);
31019 test_ret++;
31020 printf(" %d", n_exec);
31021 printf(" %d", n_value);
31022 printf(" %d", n_value2);
31023 printf(" %d", n_data);
31024 printf("\n");
31025 }
31026 }
31027 }
31028 }
31029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031030 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031031#endif
31032
Daniel Veillarda82b1822004-11-08 16:24:57 +000031033 return(test_ret);
31034}
31035
Daniel Veillarda521d282004-11-09 14:59:59 +000031036#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031037
31038#define gen_nb_xmlRegexpPtr 1
31039static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31040 return(NULL);
31041}
31042static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31043}
Daniel Veillarda521d282004-11-09 14:59:59 +000031044#endif
31045
Daniel Veillarda82b1822004-11-08 16:24:57 +000031046
31047static int
31048test_xmlRegNewExecCtxt(void) {
31049 int test_ret = 0;
31050
31051
31052 /* missing type support */
31053 return(test_ret);
31054}
31055
31056
31057static int
31058test_xmlRegexpCompile(void) {
31059 int test_ret = 0;
31060
31061
31062 /* missing type support */
31063 return(test_ret);
31064}
31065
31066
31067static int
31068test_xmlRegexpExec(void) {
31069 int test_ret = 0;
31070
31071#ifdef LIBXML_REGEXP_ENABLED
31072 int mem_base;
31073 int ret_val;
31074 xmlRegexpPtr comp; /* the compiled regular expression */
31075 int n_comp;
31076 xmlChar * content; /* the value to check against the regular expression */
31077 int n_content;
31078
31079 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31080 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31081 mem_base = xmlMemBlocks();
31082 comp = gen_xmlRegexpPtr(n_comp, 0);
31083 content = gen_const_xmlChar_ptr(n_content, 1);
31084
William M. Brackf13f77f2004-11-12 16:03:48 +000031085 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031086 desret_int(ret_val);
31087 call_tests++;
31088 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031089 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031090 xmlResetLastError();
31091 if (mem_base != xmlMemBlocks()) {
31092 printf("Leak of %d blocks found in xmlRegexpExec",
31093 xmlMemBlocks() - mem_base);
31094 test_ret++;
31095 printf(" %d", n_comp);
31096 printf(" %d", n_content);
31097 printf("\n");
31098 }
31099 }
31100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031101 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031102#endif
31103
Daniel Veillarda82b1822004-11-08 16:24:57 +000031104 return(test_ret);
31105}
31106
31107
31108static int
31109test_xmlRegexpIsDeterminist(void) {
31110 int test_ret = 0;
31111
31112#ifdef LIBXML_REGEXP_ENABLED
31113 int mem_base;
31114 int ret_val;
31115 xmlRegexpPtr comp; /* the compiled regular expression */
31116 int n_comp;
31117
31118 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31119 mem_base = xmlMemBlocks();
31120 comp = gen_xmlRegexpPtr(n_comp, 0);
31121
31122 ret_val = xmlRegexpIsDeterminist(comp);
31123 desret_int(ret_val);
31124 call_tests++;
31125 des_xmlRegexpPtr(n_comp, comp, 0);
31126 xmlResetLastError();
31127 if (mem_base != xmlMemBlocks()) {
31128 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31129 xmlMemBlocks() - mem_base);
31130 test_ret++;
31131 printf(" %d", n_comp);
31132 printf("\n");
31133 }
31134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031135 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031136#endif
31137
Daniel Veillarda82b1822004-11-08 16:24:57 +000031138 return(test_ret);
31139}
31140
31141
31142static int
31143test_xmlRegexpPrint(void) {
31144 int test_ret = 0;
31145
31146#ifdef LIBXML_REGEXP_ENABLED
31147 int mem_base;
31148 FILE * output; /* the file for the output debug */
31149 int n_output;
31150 xmlRegexpPtr regexp; /* the compiled regexp */
31151 int n_regexp;
31152
31153 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31154 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31155 mem_base = xmlMemBlocks();
31156 output = gen_FILE_ptr(n_output, 0);
31157 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31158
31159 xmlRegexpPrint(output, regexp);
31160 call_tests++;
31161 des_FILE_ptr(n_output, output, 0);
31162 des_xmlRegexpPtr(n_regexp, regexp, 1);
31163 xmlResetLastError();
31164 if (mem_base != xmlMemBlocks()) {
31165 printf("Leak of %d blocks found in xmlRegexpPrint",
31166 xmlMemBlocks() - mem_base);
31167 test_ret++;
31168 printf(" %d", n_output);
31169 printf(" %d", n_regexp);
31170 printf("\n");
31171 }
31172 }
31173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031174 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031175#endif
31176
Daniel Veillarda82b1822004-11-08 16:24:57 +000031177 return(test_ret);
31178}
31179
31180static int
31181test_xmlregexp(void) {
31182 int test_ret = 0;
31183
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031184 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031185 test_ret += test_xmlRegExecPushString();
31186 test_ret += test_xmlRegExecPushString2();
31187 test_ret += test_xmlRegNewExecCtxt();
31188 test_ret += test_xmlRegexpCompile();
31189 test_ret += test_xmlRegexpExec();
31190 test_ret += test_xmlRegexpIsDeterminist();
31191 test_ret += test_xmlRegexpPrint();
31192
31193 if (test_ret != 0)
31194 printf("Module xmlregexp: %d errors\n", test_ret);
31195 return(test_ret);
31196}
Daniel Veillarda521d282004-11-09 14:59:59 +000031197#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031198
Daniel Veillardce682bc2004-11-05 17:22:25 +000031199#define gen_nb_xmlSaveCtxtPtr 1
31200static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31201 return(NULL);
31202}
31203static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31204}
Daniel Veillarda521d282004-11-09 14:59:59 +000031205#endif
31206
Daniel Veillardce682bc2004-11-05 17:22:25 +000031207
Daniel Veillardd93f6252004-11-02 15:53:51 +000031208static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031209test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031211
Daniel Veillardce682bc2004-11-05 17:22:25 +000031212#ifdef LIBXML_OUTPUT_ENABLED
31213 int mem_base;
31214 int ret_val;
31215 xmlSaveCtxtPtr ctxt; /* a document saving context */
31216 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031217
Daniel Veillardce682bc2004-11-05 17:22:25 +000031218 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31219 mem_base = xmlMemBlocks();
31220 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31221
31222 ret_val = xmlSaveClose(ctxt);
31223 desret_int(ret_val);
31224 call_tests++;
31225 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31226 xmlResetLastError();
31227 if (mem_base != xmlMemBlocks()) {
31228 printf("Leak of %d blocks found in xmlSaveClose",
31229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031230 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031231 printf(" %d", n_ctxt);
31232 printf("\n");
31233 }
31234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031235 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031236#endif
31237
Daniel Veillard42595322004-11-08 10:52:06 +000031238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031239}
31240
31241
31242static int
31243test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031245
Daniel Veillardce682bc2004-11-05 17:22:25 +000031246#ifdef LIBXML_OUTPUT_ENABLED
31247 int mem_base;
31248 long ret_val;
31249 xmlSaveCtxtPtr ctxt; /* a document saving context */
31250 int n_ctxt;
31251 xmlDocPtr doc; /* a document */
31252 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031253
Daniel Veillardce682bc2004-11-05 17:22:25 +000031254 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31255 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31256 mem_base = xmlMemBlocks();
31257 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31258 doc = gen_xmlDocPtr(n_doc, 1);
31259
31260 ret_val = xmlSaveDoc(ctxt, doc);
31261 desret_long(ret_val);
31262 call_tests++;
31263 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31264 des_xmlDocPtr(n_doc, doc, 1);
31265 xmlResetLastError();
31266 if (mem_base != xmlMemBlocks()) {
31267 printf("Leak of %d blocks found in xmlSaveDoc",
31268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031269 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031270 printf(" %d", n_ctxt);
31271 printf(" %d", n_doc);
31272 printf("\n");
31273 }
31274 }
31275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031276 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031277#endif
31278
Daniel Veillard42595322004-11-08 10:52:06 +000031279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031280}
31281
31282
31283static int
31284test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031286
Daniel Veillardce682bc2004-11-05 17:22:25 +000031287#ifdef LIBXML_OUTPUT_ENABLED
31288 int mem_base;
31289 int ret_val;
31290 xmlSaveCtxtPtr ctxt; /* a document saving context */
31291 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031292
Daniel Veillardce682bc2004-11-05 17:22:25 +000031293 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31294 mem_base = xmlMemBlocks();
31295 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31296
31297 ret_val = xmlSaveFlush(ctxt);
31298 desret_int(ret_val);
31299 call_tests++;
31300 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31301 xmlResetLastError();
31302 if (mem_base != xmlMemBlocks()) {
31303 printf("Leak of %d blocks found in xmlSaveFlush",
31304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031305 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031306 printf(" %d", n_ctxt);
31307 printf("\n");
31308 }
31309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031310 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031311#endif
31312
Daniel Veillard42595322004-11-08 10:52:06 +000031313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031314}
31315
31316
31317static int
31318test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031320
31321
31322 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031324}
31325
31326
31327static int
31328test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031330
31331
31332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031334}
31335
31336
31337static int
31338test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031340
31341
31342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031344}
31345
31346
31347static int
31348test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031350
31351
31352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031354}
31355
31356
31357static int
31358test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031360
Daniel Veillardce682bc2004-11-05 17:22:25 +000031361#ifdef LIBXML_OUTPUT_ENABLED
31362 int mem_base;
31363 long ret_val;
31364 xmlSaveCtxtPtr ctxt; /* a document saving context */
31365 int n_ctxt;
31366 xmlNodePtr node; /* a document */
31367 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031368
Daniel Veillardce682bc2004-11-05 17:22:25 +000031369 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31370 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31371 mem_base = xmlMemBlocks();
31372 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31373 node = gen_xmlNodePtr(n_node, 1);
31374
31375 ret_val = xmlSaveTree(ctxt, node);
31376 desret_long(ret_val);
31377 call_tests++;
31378 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31379 des_xmlNodePtr(n_node, node, 1);
31380 xmlResetLastError();
31381 if (mem_base != xmlMemBlocks()) {
31382 printf("Leak of %d blocks found in xmlSaveTree",
31383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031384 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031385 printf(" %d", n_ctxt);
31386 printf(" %d", n_node);
31387 printf("\n");
31388 }
31389 }
31390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031391 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031392#endif
31393
Daniel Veillard42595322004-11-08 10:52:06 +000031394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031395}
31396
31397static int
31398test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031400
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031401 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031402 test_ret += test_xmlSaveClose();
31403 test_ret += test_xmlSaveDoc();
31404 test_ret += test_xmlSaveFlush();
31405 test_ret += test_xmlSaveSetAttrEscape();
31406 test_ret += test_xmlSaveSetEscape();
31407 test_ret += test_xmlSaveToFd();
31408 test_ret += test_xmlSaveToFilename();
31409 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031410
Daniel Veillard42595322004-11-08 10:52:06 +000031411 if (test_ret != 0)
31412 printf("Module xmlsave: %d errors\n", test_ret);
31413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031414}
Daniel Veillarda521d282004-11-09 14:59:59 +000031415#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031416
Daniel Veillardce682bc2004-11-05 17:22:25 +000031417#define gen_nb_xmlSchemaPtr 1
31418static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31419 return(NULL);
31420}
31421static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31422}
Daniel Veillarda521d282004-11-09 14:59:59 +000031423#endif
31424
Daniel Veillardce682bc2004-11-05 17:22:25 +000031425
Daniel Veillardd93f6252004-11-02 15:53:51 +000031426static int
31427test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031429
Daniel Veillardce682bc2004-11-05 17:22:25 +000031430#ifdef LIBXML_SCHEMAS_ENABLED
31431#ifdef LIBXML_OUTPUT_ENABLED
31432 int mem_base;
31433 FILE * output; /* the file output */
31434 int n_output;
31435 xmlSchemaPtr schema; /* a schema structure */
31436 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031437
Daniel Veillardce682bc2004-11-05 17:22:25 +000031438 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31439 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31440 mem_base = xmlMemBlocks();
31441 output = gen_FILE_ptr(n_output, 0);
31442 schema = gen_xmlSchemaPtr(n_schema, 1);
31443
31444 xmlSchemaDump(output, schema);
31445 call_tests++;
31446 des_FILE_ptr(n_output, output, 0);
31447 des_xmlSchemaPtr(n_schema, schema, 1);
31448 xmlResetLastError();
31449 if (mem_base != xmlMemBlocks()) {
31450 printf("Leak of %d blocks found in xmlSchemaDump",
31451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031452 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031453 printf(" %d", n_output);
31454 printf(" %d", n_schema);
31455 printf("\n");
31456 }
31457 }
31458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031459 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031460#endif
31461#endif
31462
Daniel Veillard42595322004-11-08 10:52:06 +000031463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031464}
31465
Daniel Veillarda521d282004-11-09 14:59:59 +000031466#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031467
Daniel Veillardce682bc2004-11-05 17:22:25 +000031468#define gen_nb_xmlSchemaParserCtxtPtr 1
31469static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31470 return(NULL);
31471}
31472static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31473}
Daniel Veillarda521d282004-11-09 14:59:59 +000031474#endif
31475
31476#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031477
31478#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31479static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31480 return(NULL);
31481}
31482static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31483}
Daniel Veillarda521d282004-11-09 14:59:59 +000031484#endif
31485
31486#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031487
31488#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31489static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31490 return(NULL);
31491}
31492static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31493}
Daniel Veillarda521d282004-11-09 14:59:59 +000031494#endif
31495
Daniel Veillardce682bc2004-11-05 17:22:25 +000031496
Daniel Veillardd93f6252004-11-02 15:53:51 +000031497static int
31498test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031500
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031501#ifdef LIBXML_SCHEMAS_ENABLED
31502 int mem_base;
31503 int ret_val;
31504 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31505 int n_ctxt;
31506 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31507 int n_err;
31508 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31509 int n_warn;
31510 void ** ctx; /* contextual data for the callbacks result */
31511 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031512
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031513 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31514 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31515 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31516 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31517 mem_base = xmlMemBlocks();
31518 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31519 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31520 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31521 ctx = gen_void_ptr_ptr(n_ctx, 3);
31522
31523 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31524 desret_int(ret_val);
31525 call_tests++;
31526 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31527 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31528 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31529 des_void_ptr_ptr(n_ctx, ctx, 3);
31530 xmlResetLastError();
31531 if (mem_base != xmlMemBlocks()) {
31532 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031534 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031535 printf(" %d", n_ctxt);
31536 printf(" %d", n_err);
31537 printf(" %d", n_warn);
31538 printf(" %d", n_ctx);
31539 printf("\n");
31540 }
31541 }
31542 }
31543 }
31544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031545 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031546#endif
31547
Daniel Veillard42595322004-11-08 10:52:06 +000031548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031549}
31550
Daniel Veillarda521d282004-11-09 14:59:59 +000031551#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031552
Daniel Veillardce682bc2004-11-05 17:22:25 +000031553#define gen_nb_xmlSchemaValidCtxtPtr 1
31554static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31555 return(NULL);
31556}
31557static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31558}
Daniel Veillarda521d282004-11-09 14:59:59 +000031559#endif
31560
Daniel Veillardce682bc2004-11-05 17:22:25 +000031561
Daniel Veillardd93f6252004-11-02 15:53:51 +000031562static int
31563test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031565
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031566#ifdef LIBXML_SCHEMAS_ENABLED
31567 int mem_base;
31568 int ret_val;
31569 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31570 int n_ctxt;
31571 xmlSchemaValidityErrorFunc * err; /* the error function result */
31572 int n_err;
31573 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31574 int n_warn;
31575 void ** ctx; /* the functions context result */
31576 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031577
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031578 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31579 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31580 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31581 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31582 mem_base = xmlMemBlocks();
31583 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31584 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31585 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31586 ctx = gen_void_ptr_ptr(n_ctx, 3);
31587
31588 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31589 desret_int(ret_val);
31590 call_tests++;
31591 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31592 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31593 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31594 des_void_ptr_ptr(n_ctx, ctx, 3);
31595 xmlResetLastError();
31596 if (mem_base != xmlMemBlocks()) {
31597 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031599 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031600 printf(" %d", n_ctxt);
31601 printf(" %d", n_err);
31602 printf(" %d", n_warn);
31603 printf(" %d", n_ctx);
31604 printf("\n");
31605 }
31606 }
31607 }
31608 }
31609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031610 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031611#endif
31612
Daniel Veillard42595322004-11-08 10:52:06 +000031613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031614}
31615
31616
31617static int
31618test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031620
Daniel Veillard42595322004-11-08 10:52:06 +000031621#ifdef LIBXML_SCHEMAS_ENABLED
31622 int mem_base;
31623 xmlSchemaParserCtxtPtr ret_val;
31624 xmlDocPtr doc; /* a preparsed document tree */
31625 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031626
Daniel Veillard42595322004-11-08 10:52:06 +000031627 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31628 mem_base = xmlMemBlocks();
31629 doc = gen_xmlDocPtr(n_doc, 0);
31630
31631 ret_val = xmlSchemaNewDocParserCtxt(doc);
31632 desret_xmlSchemaParserCtxtPtr(ret_val);
31633 call_tests++;
31634 des_xmlDocPtr(n_doc, doc, 0);
31635 xmlResetLastError();
31636 if (mem_base != xmlMemBlocks()) {
31637 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31638 xmlMemBlocks() - mem_base);
31639 test_ret++;
31640 printf(" %d", n_doc);
31641 printf("\n");
31642 }
31643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031644 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031645#endif
31646
Daniel Veillard42595322004-11-08 10:52:06 +000031647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031648}
31649
31650
31651static int
31652test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031654
Daniel Veillard42595322004-11-08 10:52:06 +000031655#ifdef LIBXML_SCHEMAS_ENABLED
31656 int mem_base;
31657 xmlSchemaParserCtxtPtr ret_val;
31658 char * buffer; /* a pointer to a char array containing the schemas */
31659 int n_buffer;
31660 int size; /* the size of the array */
31661 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031662
Daniel Veillard42595322004-11-08 10:52:06 +000031663 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31664 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31665 mem_base = xmlMemBlocks();
31666 buffer = gen_const_char_ptr(n_buffer, 0);
31667 size = gen_int(n_size, 1);
31668
William M. Brackf13f77f2004-11-12 16:03:48 +000031669 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000031670 desret_xmlSchemaParserCtxtPtr(ret_val);
31671 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031672 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031673 des_int(n_size, size, 1);
31674 xmlResetLastError();
31675 if (mem_base != xmlMemBlocks()) {
31676 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31677 xmlMemBlocks() - mem_base);
31678 test_ret++;
31679 printf(" %d", n_buffer);
31680 printf(" %d", n_size);
31681 printf("\n");
31682 }
31683 }
31684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031685 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031686#endif
31687
Daniel Veillard42595322004-11-08 10:52:06 +000031688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031689}
31690
31691
31692static int
31693test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031695
Daniel Veillard42595322004-11-08 10:52:06 +000031696#ifdef LIBXML_SCHEMAS_ENABLED
31697 int mem_base;
31698 xmlSchemaParserCtxtPtr ret_val;
31699 char * URL; /* the location of the schema */
31700 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031701
Daniel Veillard42595322004-11-08 10:52:06 +000031702 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31703 mem_base = xmlMemBlocks();
31704 URL = gen_const_char_ptr(n_URL, 0);
31705
William M. Brackf13f77f2004-11-12 16:03:48 +000031706 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000031707 desret_xmlSchemaParserCtxtPtr(ret_val);
31708 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031709 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031710 xmlResetLastError();
31711 if (mem_base != xmlMemBlocks()) {
31712 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31713 xmlMemBlocks() - mem_base);
31714 test_ret++;
31715 printf(" %d", n_URL);
31716 printf("\n");
31717 }
31718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031719 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031720#endif
31721
Daniel Veillard42595322004-11-08 10:52:06 +000031722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031723}
31724
31725
31726static int
31727test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031729
31730
31731 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031733}
31734
31735
31736static int
31737test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031739
31740
31741 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031743}
31744
31745
31746static int
31747test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031749
31750
31751 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031753}
31754
31755
31756static int
31757test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031759
31760
31761 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031763}
31764
31765
31766static int
31767test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031769
Daniel Veillardce682bc2004-11-05 17:22:25 +000031770#ifdef LIBXML_SCHEMAS_ENABLED
31771 int mem_base;
31772 int ret_val;
31773 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31774 int n_ctxt;
31775 int options; /* a combination of xmlSchemaValidOption */
31776 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031777
Daniel Veillardce682bc2004-11-05 17:22:25 +000031778 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31779 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31780 mem_base = xmlMemBlocks();
31781 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31782 options = gen_int(n_options, 1);
31783
31784 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31785 desret_int(ret_val);
31786 call_tests++;
31787 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31788 des_int(n_options, options, 1);
31789 xmlResetLastError();
31790 if (mem_base != xmlMemBlocks()) {
31791 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031793 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031794 printf(" %d", n_ctxt);
31795 printf(" %d", n_options);
31796 printf("\n");
31797 }
31798 }
31799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031800 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031801#endif
31802
Daniel Veillard42595322004-11-08 10:52:06 +000031803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031804}
31805
31806
31807static int
31808test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031810
Daniel Veillardce682bc2004-11-05 17:22:25 +000031811#ifdef LIBXML_SCHEMAS_ENABLED
31812 int mem_base;
31813 int ret_val;
31814 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31815 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031816
Daniel Veillardce682bc2004-11-05 17:22:25 +000031817 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31818 mem_base = xmlMemBlocks();
31819 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31820
31821 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
31822 desret_int(ret_val);
31823 call_tests++;
31824 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31825 xmlResetLastError();
31826 if (mem_base != xmlMemBlocks()) {
31827 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
31828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031829 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031830 printf(" %d", n_ctxt);
31831 printf("\n");
31832 }
31833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031834 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031835#endif
31836
Daniel Veillard42595322004-11-08 10:52:06 +000031837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031838}
31839
31840
31841static int
31842test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031844
Daniel Veillardce682bc2004-11-05 17:22:25 +000031845#ifdef LIBXML_SCHEMAS_ENABLED
31846 int mem_base;
31847 int ret_val;
31848 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31849 int n_ctxt;
31850 xmlDocPtr doc; /* a parsed document tree */
31851 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031852
Daniel Veillardce682bc2004-11-05 17:22:25 +000031853 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31854 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31855 mem_base = xmlMemBlocks();
31856 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31857 doc = gen_xmlDocPtr(n_doc, 1);
31858
31859 ret_val = xmlSchemaValidateDoc(ctxt, doc);
31860 desret_int(ret_val);
31861 call_tests++;
31862 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31863 des_xmlDocPtr(n_doc, doc, 1);
31864 xmlResetLastError();
31865 if (mem_base != xmlMemBlocks()) {
31866 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
31867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031868 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031869 printf(" %d", n_ctxt);
31870 printf(" %d", n_doc);
31871 printf("\n");
31872 }
31873 }
31874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031875 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031876#endif
31877
Daniel Veillard42595322004-11-08 10:52:06 +000031878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031879}
31880
31881
31882static int
31883test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031885
Daniel Veillardce682bc2004-11-05 17:22:25 +000031886#ifdef LIBXML_SCHEMAS_ENABLED
31887 int mem_base;
31888 int ret_val;
31889 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31890 int n_ctxt;
31891 xmlNodePtr elem; /* an element node */
31892 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031893
Daniel Veillardce682bc2004-11-05 17:22:25 +000031894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31895 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
31896 mem_base = xmlMemBlocks();
31897 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31898 elem = gen_xmlNodePtr(n_elem, 1);
31899
31900 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
31901 desret_int(ret_val);
31902 call_tests++;
31903 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31904 des_xmlNodePtr(n_elem, elem, 1);
31905 xmlResetLastError();
31906 if (mem_base != xmlMemBlocks()) {
31907 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
31908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031910 printf(" %d", n_ctxt);
31911 printf(" %d", n_elem);
31912 printf("\n");
31913 }
31914 }
31915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031916 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031917#endif
31918
Daniel Veillard42595322004-11-08 10:52:06 +000031919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031920}
31921
31922
31923static int
31924test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031926
Daniel Veillardce682bc2004-11-05 17:22:25 +000031927#ifdef LIBXML_SCHEMAS_ENABLED
31928 int mem_base;
31929 int ret_val;
31930 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31931 int n_ctxt;
31932 xmlParserInputBufferPtr input; /* the input to use for reading the data */
31933 int n_input;
31934 xmlCharEncoding enc; /* an optional encoding information */
31935 int n_enc;
31936 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
31937 int n_sax;
31938 void * user_data; /* the context to provide to the SAX handler. */
31939 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031940
Daniel Veillardce682bc2004-11-05 17:22:25 +000031941 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31942 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
31943 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
31944 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
31945 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
31946 mem_base = xmlMemBlocks();
31947 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31948 input = gen_xmlParserInputBufferPtr(n_input, 1);
31949 enc = gen_xmlCharEncoding(n_enc, 2);
31950 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
31951 user_data = gen_userdata(n_user_data, 4);
31952
31953 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
31954 desret_int(ret_val);
31955 call_tests++;
31956 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31957 des_xmlParserInputBufferPtr(n_input, input, 1);
31958 des_xmlCharEncoding(n_enc, enc, 2);
31959 des_xmlSAXHandlerPtr(n_sax, sax, 3);
31960 des_userdata(n_user_data, user_data, 4);
31961 xmlResetLastError();
31962 if (mem_base != xmlMemBlocks()) {
31963 printf("Leak of %d blocks found in xmlSchemaValidateStream",
31964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031965 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031966 printf(" %d", n_ctxt);
31967 printf(" %d", n_input);
31968 printf(" %d", n_enc);
31969 printf(" %d", n_sax);
31970 printf(" %d", n_user_data);
31971 printf("\n");
31972 }
31973 }
31974 }
31975 }
31976 }
31977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031978 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031979#endif
31980
Daniel Veillard42595322004-11-08 10:52:06 +000031981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031982}
31983
31984static int
31985test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031987
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031988 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031989 test_ret += test_xmlSchemaDump();
31990 test_ret += test_xmlSchemaGetParserErrors();
31991 test_ret += test_xmlSchemaGetValidErrors();
31992 test_ret += test_xmlSchemaNewDocParserCtxt();
31993 test_ret += test_xmlSchemaNewMemParserCtxt();
31994 test_ret += test_xmlSchemaNewParserCtxt();
31995 test_ret += test_xmlSchemaNewValidCtxt();
31996 test_ret += test_xmlSchemaParse();
31997 test_ret += test_xmlSchemaSetParserErrors();
31998 test_ret += test_xmlSchemaSetValidErrors();
31999 test_ret += test_xmlSchemaSetValidOptions();
32000 test_ret += test_xmlSchemaValidCtxtGetOptions();
32001 test_ret += test_xmlSchemaValidateDoc();
32002 test_ret += test_xmlSchemaValidateOneElement();
32003 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032004
Daniel Veillard42595322004-11-08 10:52:06 +000032005 if (test_ret != 0)
32006 printf("Module xmlschemas: %d errors\n", test_ret);
32007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032008}
Daniel Veillarda521d282004-11-09 14:59:59 +000032009#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032010
Daniel Veillardce682bc2004-11-05 17:22:25 +000032011#define gen_nb_xmlSchemaFacetPtr 1
32012static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32013 return(NULL);
32014}
32015static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32016}
Daniel Veillarda521d282004-11-09 14:59:59 +000032017#endif
32018
32019#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032020
32021#define gen_nb_xmlSchemaTypePtr 1
32022static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32023 return(NULL);
32024}
32025static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32026}
Daniel Veillarda521d282004-11-09 14:59:59 +000032027#endif
32028
Daniel Veillardce682bc2004-11-05 17:22:25 +000032029
Daniel Veillardd93f6252004-11-02 15:53:51 +000032030static int
32031test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032033
Daniel Veillardce682bc2004-11-05 17:22:25 +000032034#ifdef LIBXML_SCHEMAS_ENABLED
32035 int mem_base;
32036 int ret_val;
32037 xmlSchemaFacetPtr facet; /* the facet */
32038 int n_facet;
32039 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32040 int n_typeDecl;
32041 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32042 int n_ctxt;
32043 xmlChar * name; /* name of the type */
32044 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032045
Daniel Veillardce682bc2004-11-05 17:22:25 +000032046 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32047 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32048 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32049 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32050 mem_base = xmlMemBlocks();
32051 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32052 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32053 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32054 name = gen_const_xmlChar_ptr(n_name, 3);
32055
William M. Brackf13f77f2004-11-12 16:03:48 +000032056 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032057 desret_int(ret_val);
32058 call_tests++;
32059 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32060 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32061 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032062 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032063 xmlResetLastError();
32064 if (mem_base != xmlMemBlocks()) {
32065 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032067 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032068 printf(" %d", n_facet);
32069 printf(" %d", n_typeDecl);
32070 printf(" %d", n_ctxt);
32071 printf(" %d", n_name);
32072 printf("\n");
32073 }
32074 }
32075 }
32076 }
32077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032078 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032079#endif
32080
Daniel Veillard42595322004-11-08 10:52:06 +000032081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032082}
32083
32084
32085static int
32086test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032088
32089#ifdef LIBXML_SCHEMAS_ENABLED
32090 int mem_base;
32091
32092 mem_base = xmlMemBlocks();
32093
32094 xmlSchemaCleanupTypes();
32095 call_tests++;
32096 xmlResetLastError();
32097 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032098 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032100 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032101 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032102 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032103 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032104#endif
32105
Daniel Veillard42595322004-11-08 10:52:06 +000032106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032107}
32108
32109
32110static int
32111test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032113
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032114#ifdef LIBXML_SCHEMAS_ENABLED
32115 int mem_base;
32116 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032117 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032118 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032119
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032120 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32121 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032122 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032123
William M. Brackf13f77f2004-11-12 16:03:48 +000032124 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032125 desret_xmlChar_ptr(ret_val);
32126 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032127 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032128 xmlResetLastError();
32129 if (mem_base != xmlMemBlocks()) {
32130 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032132 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032133 printf(" %d", n_value);
32134 printf("\n");
32135 }
32136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032137 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032138#endif
32139
Daniel Veillard42595322004-11-08 10:52:06 +000032140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032141}
32142
Daniel Veillarda521d282004-11-09 14:59:59 +000032143#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032144
Daniel Veillardce682bc2004-11-05 17:22:25 +000032145#define gen_nb_xmlSchemaValPtr 1
32146static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32147 return(NULL);
32148}
32149static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32150}
Daniel Veillarda521d282004-11-09 14:59:59 +000032151#endif
32152
Daniel Veillardce682bc2004-11-05 17:22:25 +000032153
Daniel Veillardd93f6252004-11-02 15:53:51 +000032154static int
32155test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032157
Daniel Veillardce682bc2004-11-05 17:22:25 +000032158#ifdef LIBXML_SCHEMAS_ENABLED
32159 int mem_base;
32160 int ret_val;
32161 xmlSchemaValPtr x; /* a first value */
32162 int n_x;
32163 xmlSchemaValPtr y; /* a second value */
32164 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032165
Daniel Veillardce682bc2004-11-05 17:22:25 +000032166 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32167 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32168 mem_base = xmlMemBlocks();
32169 x = gen_xmlSchemaValPtr(n_x, 0);
32170 y = gen_xmlSchemaValPtr(n_y, 1);
32171
32172 ret_val = xmlSchemaCompareValues(x, y);
32173 desret_int(ret_val);
32174 call_tests++;
32175 des_xmlSchemaValPtr(n_x, x, 0);
32176 des_xmlSchemaValPtr(n_y, y, 1);
32177 xmlResetLastError();
32178 if (mem_base != xmlMemBlocks()) {
32179 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032181 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032182 printf(" %d", n_x);
32183 printf(" %d", n_y);
32184 printf("\n");
32185 }
32186 }
32187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032188 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032189#endif
32190
Daniel Veillard42595322004-11-08 10:52:06 +000032191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032192}
32193
32194
32195static int
32196test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032198
Daniel Veillard42595322004-11-08 10:52:06 +000032199#ifdef LIBXML_SCHEMAS_ENABLED
32200 int mem_base;
32201 xmlSchemaTypePtr ret_val;
32202 xmlSchemaTypePtr type; /* the built-in simple type. */
32203 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032204
Daniel Veillard42595322004-11-08 10:52:06 +000032205 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32206 mem_base = xmlMemBlocks();
32207 type = gen_xmlSchemaTypePtr(n_type, 0);
32208
32209 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32210 desret_xmlSchemaTypePtr(ret_val);
32211 call_tests++;
32212 des_xmlSchemaTypePtr(n_type, type, 0);
32213 xmlResetLastError();
32214 if (mem_base != xmlMemBlocks()) {
32215 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32216 xmlMemBlocks() - mem_base);
32217 test_ret++;
32218 printf(" %d", n_type);
32219 printf("\n");
32220 }
32221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032222 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032223#endif
32224
Daniel Veillard42595322004-11-08 10:52:06 +000032225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032226}
32227
32228
32229static int
32230test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032232
Daniel Veillard42595322004-11-08 10:52:06 +000032233#ifdef LIBXML_SCHEMAS_ENABLED
32234 xmlSchemaTypePtr ret_val;
32235 xmlSchemaValType type; /* the type of the built in type */
32236 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032237
Daniel Veillard42595322004-11-08 10:52:06 +000032238 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32239 type = gen_xmlSchemaValType(n_type, 0);
32240
32241 ret_val = xmlSchemaGetBuiltInType(type);
32242 desret_xmlSchemaTypePtr(ret_val);
32243 call_tests++;
32244 des_xmlSchemaValType(n_type, type, 0);
32245 xmlResetLastError();
32246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032247 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032248#endif
32249
Daniel Veillard42595322004-11-08 10:52:06 +000032250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032251}
32252
32253
32254static int
32255test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032257
William M. Brack094dd862004-11-14 14:28:34 +000032258#ifdef LIBXML_SCHEMAS_ENABLED
32259 int mem_base;
32260 unsigned long ret_val;
32261 xmlSchemaFacetPtr facet; /* an schemas type facet */
32262 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032263
William M. Brack094dd862004-11-14 14:28:34 +000032264 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32265 mem_base = xmlMemBlocks();
32266 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32267
32268 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32269 desret_unsigned_long(ret_val);
32270 call_tests++;
32271 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32272 xmlResetLastError();
32273 if (mem_base != xmlMemBlocks()) {
32274 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32275 xmlMemBlocks() - mem_base);
32276 test_ret++;
32277 printf(" %d", n_facet);
32278 printf("\n");
32279 }
32280 }
32281 function_tests++;
32282#endif
32283
Daniel Veillard42595322004-11-08 10:52:06 +000032284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032285}
32286
32287
32288static int
32289test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032291
Daniel Veillard42595322004-11-08 10:52:06 +000032292#ifdef LIBXML_SCHEMAS_ENABLED
32293 int mem_base;
32294 xmlSchemaTypePtr ret_val;
32295 xmlChar * name; /* the type name */
32296 int n_name;
32297 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32298 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032299
Daniel Veillard42595322004-11-08 10:52:06 +000032300 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32301 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32302 mem_base = xmlMemBlocks();
32303 name = gen_const_xmlChar_ptr(n_name, 0);
32304 ns = gen_const_xmlChar_ptr(n_ns, 1);
32305
William M. Brackf13f77f2004-11-12 16:03:48 +000032306 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032307 desret_xmlSchemaTypePtr(ret_val);
32308 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032309 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32310 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032311 xmlResetLastError();
32312 if (mem_base != xmlMemBlocks()) {
32313 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32314 xmlMemBlocks() - mem_base);
32315 test_ret++;
32316 printf(" %d", n_name);
32317 printf(" %d", n_ns);
32318 printf("\n");
32319 }
32320 }
32321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032323#endif
32324
Daniel Veillard42595322004-11-08 10:52:06 +000032325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032326}
32327
32328
32329static int
32330test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032332
32333#ifdef LIBXML_SCHEMAS_ENABLED
32334
32335
32336 xmlSchemaInitTypes();
32337 call_tests++;
32338 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032339 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032340#endif
32341
Daniel Veillard42595322004-11-08 10:52:06 +000032342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032343}
32344
32345
32346static int
32347test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032349
Daniel Veillardce682bc2004-11-05 17:22:25 +000032350#ifdef LIBXML_SCHEMAS_ENABLED
32351 int mem_base;
32352 int ret_val;
32353 xmlSchemaTypePtr type; /* the built-in type */
32354 int n_type;
32355 int facetType; /* the facet type */
32356 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032357
Daniel Veillardce682bc2004-11-05 17:22:25 +000032358 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32359 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32360 mem_base = xmlMemBlocks();
32361 type = gen_xmlSchemaTypePtr(n_type, 0);
32362 facetType = gen_int(n_facetType, 1);
32363
32364 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32365 desret_int(ret_val);
32366 call_tests++;
32367 des_xmlSchemaTypePtr(n_type, type, 0);
32368 des_int(n_facetType, facetType, 1);
32369 xmlResetLastError();
32370 if (mem_base != xmlMemBlocks()) {
32371 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032373 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032374 printf(" %d", n_type);
32375 printf(" %d", n_facetType);
32376 printf("\n");
32377 }
32378 }
32379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032380 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032381#endif
32382
Daniel Veillard42595322004-11-08 10:52:06 +000032383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032384}
32385
32386
32387static int
32388test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032390
32391
32392 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032394}
32395
Daniel Veillarda521d282004-11-09 14:59:59 +000032396#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032397
Daniel Veillardce682bc2004-11-05 17:22:25 +000032398#define gen_nb_xmlSchemaValPtr_ptr 1
32399static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32400 return(NULL);
32401}
32402static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32403}
Daniel Veillarda521d282004-11-09 14:59:59 +000032404#endif
32405
Daniel Veillardce682bc2004-11-05 17:22:25 +000032406
Daniel Veillardd93f6252004-11-02 15:53:51 +000032407static int
32408test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032410
Daniel Veillardce682bc2004-11-05 17:22:25 +000032411#ifdef LIBXML_SCHEMAS_ENABLED
32412 int mem_base;
32413 int ret_val;
32414 xmlSchemaTypePtr type; /* the predefined type */
32415 int n_type;
32416 xmlChar * value; /* the value to check */
32417 int n_value;
32418 xmlSchemaValPtr * val; /* the return computed value */
32419 int n_val;
32420 xmlNodePtr node; /* the node containing the value */
32421 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032422
Daniel Veillardce682bc2004-11-05 17:22:25 +000032423 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32424 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32425 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32426 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32427 mem_base = xmlMemBlocks();
32428 type = gen_xmlSchemaTypePtr(n_type, 0);
32429 value = gen_const_xmlChar_ptr(n_value, 1);
32430 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32431 node = gen_xmlNodePtr(n_node, 3);
32432
William M. Brackf13f77f2004-11-12 16:03:48 +000032433 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032434 desret_int(ret_val);
32435 call_tests++;
32436 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032437 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032438 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32439 des_xmlNodePtr(n_node, node, 3);
32440 xmlResetLastError();
32441 if (mem_base != xmlMemBlocks()) {
32442 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032444 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032445 printf(" %d", n_type);
32446 printf(" %d", n_value);
32447 printf(" %d", n_val);
32448 printf(" %d", n_node);
32449 printf("\n");
32450 }
32451 }
32452 }
32453 }
32454 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032455 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032456#endif
32457
Daniel Veillard42595322004-11-08 10:52:06 +000032458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032459}
32460
32461
32462static int
32463test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032465
Daniel Veillardce682bc2004-11-05 17:22:25 +000032466#ifdef LIBXML_SCHEMAS_ENABLED
32467 int mem_base;
32468 int ret_val;
32469 xmlSchemaTypePtr type; /* the predefined type */
32470 int n_type;
32471 xmlChar * value; /* the value to check */
32472 int n_value;
32473 xmlSchemaValPtr * val; /* the return computed value */
32474 int n_val;
32475 xmlNodePtr node; /* the node containing the value */
32476 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032477
Daniel Veillardce682bc2004-11-05 17:22:25 +000032478 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32479 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32480 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32481 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32482 mem_base = xmlMemBlocks();
32483 type = gen_xmlSchemaTypePtr(n_type, 0);
32484 value = gen_const_xmlChar_ptr(n_value, 1);
32485 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32486 node = gen_xmlNodePtr(n_node, 3);
32487
William M. Brackf13f77f2004-11-12 16:03:48 +000032488 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032489 desret_int(ret_val);
32490 call_tests++;
32491 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032492 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032493 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32494 des_xmlNodePtr(n_node, node, 3);
32495 xmlResetLastError();
32496 if (mem_base != xmlMemBlocks()) {
32497 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032499 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032500 printf(" %d", n_type);
32501 printf(" %d", n_value);
32502 printf(" %d", n_val);
32503 printf(" %d", n_node);
32504 printf("\n");
32505 }
32506 }
32507 }
32508 }
32509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032510 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032511#endif
32512
Daniel Veillard42595322004-11-08 10:52:06 +000032513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032514}
32515
32516
32517static int
32518test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032520
Daniel Veillardce682bc2004-11-05 17:22:25 +000032521#ifdef LIBXML_SCHEMAS_ENABLED
32522 int mem_base;
32523 int ret_val;
32524 xmlSchemaTypePtr base; /* the base type */
32525 int n_base;
32526 xmlSchemaFacetPtr facet; /* the facet to check */
32527 int n_facet;
32528 xmlChar * value; /* the lexical repr of the value to validate */
32529 int n_value;
32530 xmlSchemaValPtr val; /* the precomputed value */
32531 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032532
Daniel Veillardce682bc2004-11-05 17:22:25 +000032533 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32534 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32535 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32536 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32537 mem_base = xmlMemBlocks();
32538 base = gen_xmlSchemaTypePtr(n_base, 0);
32539 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32540 value = gen_const_xmlChar_ptr(n_value, 2);
32541 val = gen_xmlSchemaValPtr(n_val, 3);
32542
William M. Brackf13f77f2004-11-12 16:03:48 +000032543 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032544 desret_int(ret_val);
32545 call_tests++;
32546 des_xmlSchemaTypePtr(n_base, base, 0);
32547 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032548 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032549 des_xmlSchemaValPtr(n_val, val, 3);
32550 xmlResetLastError();
32551 if (mem_base != xmlMemBlocks()) {
32552 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032554 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032555 printf(" %d", n_base);
32556 printf(" %d", n_facet);
32557 printf(" %d", n_value);
32558 printf(" %d", n_val);
32559 printf("\n");
32560 }
32561 }
32562 }
32563 }
32564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032565 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032566#endif
32567
Daniel Veillard42595322004-11-08 10:52:06 +000032568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032569}
32570
32571
32572static int
32573test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032575
Daniel Veillardce682bc2004-11-05 17:22:25 +000032576#ifdef LIBXML_SCHEMAS_ENABLED
32577 int mem_base;
32578 int ret_val;
32579 xmlSchemaTypePtr type; /* the built-in type */
32580 int n_type;
32581 xmlSchemaFacetPtr facet; /* the facet to check */
32582 int n_facet;
32583 xmlChar * value; /* the lexical repr. of the value to be validated */
32584 int n_value;
32585 xmlSchemaValPtr val; /* the precomputed value */
32586 int n_val;
32587 unsigned long * length; /* the actual length of the value */
32588 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032589
Daniel Veillardce682bc2004-11-05 17:22:25 +000032590 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32591 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32592 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32593 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32594 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32595 mem_base = xmlMemBlocks();
32596 type = gen_xmlSchemaTypePtr(n_type, 0);
32597 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32598 value = gen_const_xmlChar_ptr(n_value, 2);
32599 val = gen_xmlSchemaValPtr(n_val, 3);
32600 length = gen_unsigned_long_ptr(n_length, 4);
32601
William M. Brackf13f77f2004-11-12 16:03:48 +000032602 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032603 desret_int(ret_val);
32604 call_tests++;
32605 des_xmlSchemaTypePtr(n_type, type, 0);
32606 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032607 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032608 des_xmlSchemaValPtr(n_val, val, 3);
32609 des_unsigned_long_ptr(n_length, length, 4);
32610 xmlResetLastError();
32611 if (mem_base != xmlMemBlocks()) {
32612 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032614 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032615 printf(" %d", n_type);
32616 printf(" %d", n_facet);
32617 printf(" %d", n_value);
32618 printf(" %d", n_val);
32619 printf(" %d", n_length);
32620 printf("\n");
32621 }
32622 }
32623 }
32624 }
32625 }
32626 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032627 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032628#endif
32629
Daniel Veillard42595322004-11-08 10:52:06 +000032630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032631}
32632
32633
32634static int
32635test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032637
Daniel Veillardce682bc2004-11-05 17:22:25 +000032638#ifdef LIBXML_SCHEMAS_ENABLED
32639 int mem_base;
32640 int ret_val;
32641 xmlSchemaFacetPtr facet; /* the facet to check */
32642 int n_facet;
32643 xmlChar * value; /* the lexical repr of the value to validate */
32644 int n_value;
32645 unsigned long actualLen; /* the number of list items */
32646 int n_actualLen;
32647 unsigned long * expectedLen; /* the resulting expected number of list items */
32648 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032649
Daniel Veillardce682bc2004-11-05 17:22:25 +000032650 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32651 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32652 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32653 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32654 mem_base = xmlMemBlocks();
32655 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32656 value = gen_const_xmlChar_ptr(n_value, 1);
32657 actualLen = gen_unsigned_long(n_actualLen, 2);
32658 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32659
William M. Brackf13f77f2004-11-12 16:03:48 +000032660 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032661 desret_int(ret_val);
32662 call_tests++;
32663 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032664 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032665 des_unsigned_long(n_actualLen, actualLen, 2);
32666 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32667 xmlResetLastError();
32668 if (mem_base != xmlMemBlocks()) {
32669 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032671 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032672 printf(" %d", n_facet);
32673 printf(" %d", n_value);
32674 printf(" %d", n_actualLen);
32675 printf(" %d", n_expectedLen);
32676 printf("\n");
32677 }
32678 }
32679 }
32680 }
32681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032682 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032683#endif
32684
Daniel Veillard42595322004-11-08 10:52:06 +000032685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032686}
32687
32688
32689static int
32690test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032692
Daniel Veillardce682bc2004-11-05 17:22:25 +000032693#ifdef LIBXML_SCHEMAS_ENABLED
32694 int mem_base;
32695 int ret_val;
32696 xmlSchemaTypePtr type; /* the predefined type */
32697 int n_type;
32698 xmlChar * value; /* the value to check */
32699 int n_value;
32700 xmlSchemaValPtr * val; /* the return computed value */
32701 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032702
Daniel Veillardce682bc2004-11-05 17:22:25 +000032703 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32704 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32705 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32706 mem_base = xmlMemBlocks();
32707 type = gen_xmlSchemaTypePtr(n_type, 0);
32708 value = gen_const_xmlChar_ptr(n_value, 1);
32709 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32710
William M. Brackf13f77f2004-11-12 16:03:48 +000032711 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032712 desret_int(ret_val);
32713 call_tests++;
32714 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032715 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032716 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32717 xmlResetLastError();
32718 if (mem_base != xmlMemBlocks()) {
32719 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032721 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032722 printf(" %d", n_type);
32723 printf(" %d", n_value);
32724 printf(" %d", n_val);
32725 printf("\n");
32726 }
32727 }
32728 }
32729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032730 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032731#endif
32732
Daniel Veillard42595322004-11-08 10:52:06 +000032733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032734}
32735
Daniel Veillard91b955c2004-12-10 10:26:42 +000032736
32737static int
32738test_xmlSchemaWhiteSpaceReplace(void) {
32739 int test_ret = 0;
32740
32741#ifdef LIBXML_SCHEMAS_ENABLED
32742 int mem_base;
32743 xmlChar * ret_val;
32744 xmlChar * value; /* a value */
32745 int n_value;
32746
32747 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32748 mem_base = xmlMemBlocks();
32749 value = gen_const_xmlChar_ptr(n_value, 0);
32750
32751 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
32752 desret_xmlChar_ptr(ret_val);
32753 call_tests++;
32754 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
32755 xmlResetLastError();
32756 if (mem_base != xmlMemBlocks()) {
32757 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
32758 xmlMemBlocks() - mem_base);
32759 test_ret++;
32760 printf(" %d", n_value);
32761 printf("\n");
32762 }
32763 }
32764 function_tests++;
32765#endif
32766
32767 return(test_ret);
32768}
32769
Daniel Veillardd93f6252004-11-02 15:53:51 +000032770static int
32771test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032773
Daniel Veillard91b955c2004-12-10 10:26:42 +000032774 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032775 test_ret += test_xmlSchemaCheckFacet();
32776 test_ret += test_xmlSchemaCleanupTypes();
32777 test_ret += test_xmlSchemaCollapseString();
32778 test_ret += test_xmlSchemaCompareValues();
32779 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32780 test_ret += test_xmlSchemaGetBuiltInType();
32781 test_ret += test_xmlSchemaGetFacetValueAsULong();
32782 test_ret += test_xmlSchemaGetPredefinedType();
32783 test_ret += test_xmlSchemaInitTypes();
32784 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32785 test_ret += test_xmlSchemaNewFacet();
32786 test_ret += test_xmlSchemaValPredefTypeNode();
32787 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32788 test_ret += test_xmlSchemaValidateFacet();
32789 test_ret += test_xmlSchemaValidateLengthFacet();
32790 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32791 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000032792 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032793
Daniel Veillard42595322004-11-08 10:52:06 +000032794 if (test_ret != 0)
32795 printf("Module xmlschemastypes: %d errors\n", test_ret);
32796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032797}
32798
32799static int
32800test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032802
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032803 int mem_base;
32804 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032805 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032806 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032807
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032808 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32809 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032810 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032811
William M. Brackf13f77f2004-11-12 16:03:48 +000032812 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032813 desret_xmlChar_ptr(ret_val);
32814 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032815 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032816 xmlResetLastError();
32817 if (mem_base != xmlMemBlocks()) {
32818 printf("Leak of %d blocks found in xmlCharStrdup",
32819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032820 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032821 printf(" %d", n_cur);
32822 printf("\n");
32823 }
32824 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032825 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032826
Daniel Veillard42595322004-11-08 10:52:06 +000032827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032828}
32829
32830
32831static int
32832test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032834
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032835 int mem_base;
32836 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032837 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032838 int n_cur;
32839 int len; /* the len of @cur */
32840 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032841
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032842 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32843 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32844 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032845 cur = gen_const_char_ptr(n_cur, 0);
32846 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032847
William M. Brackf13f77f2004-11-12 16:03:48 +000032848 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032849 desret_xmlChar_ptr(ret_val);
32850 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032851 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000032852 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032853 xmlResetLastError();
32854 if (mem_base != xmlMemBlocks()) {
32855 printf("Leak of %d blocks found in xmlCharStrndup",
32856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032857 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032858 printf(" %d", n_cur);
32859 printf(" %d", n_len);
32860 printf("\n");
32861 }
32862 }
32863 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032864 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032865
Daniel Veillard42595322004-11-08 10:52:06 +000032866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032867}
32868
32869
32870static int
32871test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032873
Daniel Veillardce682bc2004-11-05 17:22:25 +000032874 int mem_base;
32875 int ret_val;
32876 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
32877 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032878
Daniel Veillardce682bc2004-11-05 17:22:25 +000032879 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32880 mem_base = xmlMemBlocks();
32881 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32882
William M. Brackf13f77f2004-11-12 16:03:48 +000032883 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032884 desret_int(ret_val);
32885 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032886 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032887 xmlResetLastError();
32888 if (mem_base != xmlMemBlocks()) {
32889 printf("Leak of %d blocks found in xmlCheckUTF8",
32890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032891 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032892 printf(" %d", n_utf);
32893 printf("\n");
32894 }
32895 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000032896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032897
Daniel Veillard42595322004-11-08 10:52:06 +000032898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032899}
32900
32901
32902static int
32903test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032905
Daniel Veillardce682bc2004-11-05 17:22:25 +000032906 int mem_base;
32907 int ret_val;
32908 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
32909 int n_utf;
32910 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. */
32911 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032912
Daniel Veillardce682bc2004-11-05 17:22:25 +000032913 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32914 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
32915 mem_base = xmlMemBlocks();
32916 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32917 len = gen_int_ptr(n_len, 1);
32918
William M. Brackf13f77f2004-11-12 16:03:48 +000032919 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032920 desret_int(ret_val);
32921 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032922 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032923 des_int_ptr(n_len, len, 1);
32924 xmlResetLastError();
32925 if (mem_base != xmlMemBlocks()) {
32926 printf("Leak of %d blocks found in xmlGetUTF8Char",
32927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032928 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032929 printf(" %d", n_utf);
32930 printf(" %d", n_len);
32931 printf("\n");
32932 }
32933 }
32934 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000032935 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032936
Daniel Veillard42595322004-11-08 10:52:06 +000032937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032938}
32939
32940
32941static int
32942test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032944
32945 int mem_base;
32946 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032947 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032948 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032949 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032950 int n_str2;
32951
32952 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32953 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032955 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32956 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032957
William M. Brackf13f77f2004-11-12 16:03:48 +000032958 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032959 desret_int(ret_val);
32960 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032961 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
32962 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032963 xmlResetLastError();
32964 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032965 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032967 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032968 printf(" %d", n_str1);
32969 printf(" %d", n_str2);
32970 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032971 }
32972 }
32973 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032975
Daniel Veillard42595322004-11-08 10:52:06 +000032976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032977}
32978
32979
32980static int
32981test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032983
32984
32985 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032987}
32988
32989
32990static int
32991test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032993
32994 int mem_base;
32995 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032996 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032997 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032998 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032999 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033000 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033001 int n_str;
33002
33003 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33004 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33005 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33006 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033007 pref = gen_const_xmlChar_ptr(n_pref, 0);
33008 name = gen_const_xmlChar_ptr(n_name, 1);
33009 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033010
William M. Brackf13f77f2004-11-12 16:03:48 +000033011 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033012 desret_int(ret_val);
33013 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033014 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33015 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33016 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033017 xmlResetLastError();
33018 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033019 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033021 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033022 printf(" %d", n_pref);
33023 printf(" %d", n_name);
33024 printf(" %d", n_str);
33025 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033026 }
33027 }
33028 }
33029 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033031
Daniel Veillard42595322004-11-08 10:52:06 +000033032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033033}
33034
33035
33036static int
33037test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033039
33040
33041 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033043}
33044
33045
33046static int
33047test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033049
33050 int mem_base;
33051 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033052 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033053 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033054 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033055 int n_str2;
33056
33057 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33058 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033060 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33061 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033062
William M. Brackf13f77f2004-11-12 16:03:48 +000033063 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033064 desret_int(ret_val);
33065 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033066 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33067 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033068 xmlResetLastError();
33069 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033070 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033072 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033073 printf(" %d", n_str1);
33074 printf(" %d", n_str2);
33075 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033076 }
33077 }
33078 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033079 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033080
Daniel Veillard42595322004-11-08 10:52:06 +000033081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033082}
33083
33084
33085static int
33086test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033088
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033089 int mem_base;
33090 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033091 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033092 int n_str;
33093 xmlChar * val; /* the xmlChar to search (needle) */
33094 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033095
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033096 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33097 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033099 str = gen_const_xmlChar_ptr(n_str, 0);
33100 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033101
William M. Brackf13f77f2004-11-12 16:03:48 +000033102 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033103 desret_const_xmlChar_ptr(ret_val);
33104 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033105 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033106 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033107 xmlResetLastError();
33108 if (mem_base != xmlMemBlocks()) {
33109 printf("Leak of %d blocks found in xmlStrcasestr",
33110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033111 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033112 printf(" %d", n_str);
33113 printf(" %d", n_val);
33114 printf("\n");
33115 }
33116 }
33117 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033118 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033119
Daniel Veillard42595322004-11-08 10:52:06 +000033120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033121}
33122
33123
33124static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033125test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033127
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033128 int mem_base;
33129 const xmlChar * ret_val;
33130 xmlChar * str; /* the xmlChar * array */
33131 int n_str;
33132 xmlChar val; /* the xmlChar to search */
33133 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033134
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033135 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33136 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33137 mem_base = xmlMemBlocks();
33138 str = gen_const_xmlChar_ptr(n_str, 0);
33139 val = gen_xmlChar(n_val, 1);
33140
William M. Brackf13f77f2004-11-12 16:03:48 +000033141 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033142 desret_const_xmlChar_ptr(ret_val);
33143 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033144 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033145 des_xmlChar(n_val, val, 1);
33146 xmlResetLastError();
33147 if (mem_base != xmlMemBlocks()) {
33148 printf("Leak of %d blocks found in xmlStrchr",
33149 xmlMemBlocks() - mem_base);
33150 test_ret++;
33151 printf(" %d", n_str);
33152 printf(" %d", n_val);
33153 printf("\n");
33154 }
33155 }
33156 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033158
Daniel Veillard42595322004-11-08 10:52:06 +000033159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033160}
33161
33162
33163static int
33164test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033166
33167 int mem_base;
33168 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033169 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033170 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033171 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033172 int n_str2;
33173
33174 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33175 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033177 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33178 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033179
William M. Brackf13f77f2004-11-12 16:03:48 +000033180 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033181 desret_int(ret_val);
33182 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033183 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33184 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033185 xmlResetLastError();
33186 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033187 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033189 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033190 printf(" %d", n_str1);
33191 printf(" %d", n_str2);
33192 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033193 }
33194 }
33195 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033196 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033197
Daniel Veillard42595322004-11-08 10:52:06 +000033198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033199}
33200
33201
33202static int
33203test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033205
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033206 int mem_base;
33207 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033208 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033209 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033210
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033211 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33212 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033213 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033214
William M. Brackf13f77f2004-11-12 16:03:48 +000033215 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033216 desret_xmlChar_ptr(ret_val);
33217 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033218 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033219 xmlResetLastError();
33220 if (mem_base != xmlMemBlocks()) {
33221 printf("Leak of %d blocks found in xmlStrdup",
33222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033223 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033224 printf(" %d", n_cur);
33225 printf("\n");
33226 }
33227 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033228 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033229
Daniel Veillard42595322004-11-08 10:52:06 +000033230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033231}
33232
33233
33234static int
33235test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033237
33238 int mem_base;
33239 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033240 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033241 int n_str;
33242
33243 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033245 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033246
William M. Brackf13f77f2004-11-12 16:03:48 +000033247 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033248 desret_int(ret_val);
33249 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033250 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033251 xmlResetLastError();
33252 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033253 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033255 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033256 printf(" %d", n_str);
33257 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033258 }
33259 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033261
Daniel Veillard42595322004-11-08 10:52:06 +000033262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033263}
33264
33265
33266static int
33267test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033269
33270 int mem_base;
33271 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033272 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033273 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033274 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033275 int n_str2;
33276 int len; /* the max comparison length */
33277 int n_len;
33278
33279 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33280 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33281 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33282 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033283 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33284 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33285 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033286
William M. Brackf13f77f2004-11-12 16:03:48 +000033287 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033288 desret_int(ret_val);
33289 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033290 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33291 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033292 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033293 xmlResetLastError();
33294 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033295 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033297 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033298 printf(" %d", n_str1);
33299 printf(" %d", n_str2);
33300 printf(" %d", n_len);
33301 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033302 }
33303 }
33304 }
33305 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033307
Daniel Veillard42595322004-11-08 10:52:06 +000033308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033309}
33310
33311
33312static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033313test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033315
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033316 int mem_base;
33317 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033318 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033319 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033320 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033321 int n_str2;
33322 int len; /* the len of @str2 */
33323 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033324
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033325 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33326 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33327 for (n_len = 0;n_len < gen_nb_int;n_len++) {
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);
33331 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033332
William M. Brackf13f77f2004-11-12 16:03:48 +000033333 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033334 desret_xmlChar_ptr(ret_val);
33335 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033336 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33337 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033338 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033339 xmlResetLastError();
33340 if (mem_base != xmlMemBlocks()) {
33341 printf("Leak of %d blocks found in xmlStrncatNew",
33342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033343 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033344 printf(" %d", n_str1);
33345 printf(" %d", n_str2);
33346 printf(" %d", n_len);
33347 printf("\n");
33348 }
33349 }
33350 }
33351 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033352 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033353
Daniel Veillard42595322004-11-08 10:52:06 +000033354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033355}
33356
33357
33358static int
33359test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033361
33362 int mem_base;
33363 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033364 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033365 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033366 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033367 int n_str2;
33368 int len; /* the max comparison length */
33369 int n_len;
33370
33371 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33372 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33373 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33374 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033375 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33376 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33377 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033378
William M. Brackf13f77f2004-11-12 16:03:48 +000033379 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033380 desret_int(ret_val);
33381 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033382 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33383 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033384 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033385 xmlResetLastError();
33386 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033387 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033389 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033390 printf(" %d", n_str1);
33391 printf(" %d", n_str2);
33392 printf(" %d", n_len);
33393 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033394 }
33395 }
33396 }
33397 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033398 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033399
Daniel Veillard42595322004-11-08 10:52:06 +000033400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033401}
33402
33403
33404static int
33405test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033407
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033408 int mem_base;
33409 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033410 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033411 int n_cur;
33412 int len; /* the len of @cur */
33413 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033414
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033415 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33416 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33417 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033418 cur = gen_const_xmlChar_ptr(n_cur, 0);
33419 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033420
William M. Brackf13f77f2004-11-12 16:03:48 +000033421 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033422 desret_xmlChar_ptr(ret_val);
33423 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033424 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033425 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033426 xmlResetLastError();
33427 if (mem_base != xmlMemBlocks()) {
33428 printf("Leak of %d blocks found in xmlStrndup",
33429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033430 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033431 printf(" %d", n_cur);
33432 printf(" %d", n_len);
33433 printf("\n");
33434 }
33435 }
33436 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033437 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033438
Daniel Veillard42595322004-11-08 10:52:06 +000033439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033440}
33441
33442
33443static int
33444test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033446
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033447 int mem_base;
33448 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033449 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033450 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033451 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033452 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033453
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033454 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33455 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33456 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033457 str = gen_const_xmlChar_ptr(n_str, 0);
33458 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033459
William M. Brackf13f77f2004-11-12 16:03:48 +000033460 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033461 desret_const_xmlChar_ptr(ret_val);
33462 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033463 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33464 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033465 xmlResetLastError();
33466 if (mem_base != xmlMemBlocks()) {
33467 printf("Leak of %d blocks found in xmlStrstr",
33468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033469 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033470 printf(" %d", n_str);
33471 printf(" %d", n_val);
33472 printf("\n");
33473 }
33474 }
33475 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033476 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033477
Daniel Veillard42595322004-11-08 10:52:06 +000033478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033479}
33480
33481
33482static int
33483test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033485
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033486 int mem_base;
33487 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033488 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033489 int n_str;
33490 int start; /* the index of the first char (zero based) */
33491 int n_start;
33492 int len; /* the length of the substring */
33493 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033494
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033495 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33496 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33497 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33498 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033499 str = gen_const_xmlChar_ptr(n_str, 0);
33500 start = gen_int(n_start, 1);
33501 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033502
William M. Brackf13f77f2004-11-12 16:03:48 +000033503 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033504 desret_xmlChar_ptr(ret_val);
33505 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033506 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033507 des_int(n_start, start, 1);
33508 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033509 xmlResetLastError();
33510 if (mem_base != xmlMemBlocks()) {
33511 printf("Leak of %d blocks found in xmlStrsub",
33512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033513 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033514 printf(" %d", n_str);
33515 printf(" %d", n_start);
33516 printf(" %d", n_len);
33517 printf("\n");
33518 }
33519 }
33520 }
33521 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033522 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033523
Daniel Veillard42595322004-11-08 10:52:06 +000033524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033525}
33526
33527
33528static int
33529test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033531
33532 int mem_base;
33533 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033534 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033535 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033536 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033537 int n_utf2;
33538
33539 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33540 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33541 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033542 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33543 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033544
William M. Brackf13f77f2004-11-12 16:03:48 +000033545 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033546 desret_int(ret_val);
33547 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033548 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33549 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033550 xmlResetLastError();
33551 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033552 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033554 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033555 printf(" %d", n_utf1);
33556 printf(" %d", n_utf2);
33557 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033558 }
33559 }
33560 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033562
Daniel Veillard42595322004-11-08 10:52:06 +000033563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033564}
33565
33566
33567static int
33568test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033570
33571 int mem_base;
33572 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033573 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033574 int n_utf;
33575
33576 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33577 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033578 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033579
William M. Brackf13f77f2004-11-12 16:03:48 +000033580 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033581 desret_int(ret_val);
33582 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033583 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033584 xmlResetLastError();
33585 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033586 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033589 printf(" %d", n_utf);
33590 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033591 }
33592 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033593 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033594
Daniel Veillard42595322004-11-08 10:52:06 +000033595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033596}
33597
33598
33599static int
33600test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033602
33603 int mem_base;
33604 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033605 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033606 int n_utf;
33607
33608 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33609 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033610 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033611
William M. Brackf13f77f2004-11-12 16:03:48 +000033612 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033613 desret_int(ret_val);
33614 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033615 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033616 xmlResetLastError();
33617 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033618 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033620 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033621 printf(" %d", n_utf);
33622 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033623 }
33624 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033625 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033626
Daniel Veillard42595322004-11-08 10:52:06 +000033627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033628}
33629
33630
33631static int
33632test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033634
33635 int mem_base;
33636 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033637 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033638 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033639 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033640 int n_utfchar;
33641
33642 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33643 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33644 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033645 utf = gen_const_xmlChar_ptr(n_utf, 0);
33646 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033647
William M. Brackf13f77f2004-11-12 16:03:48 +000033648 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033649 desret_int(ret_val);
33650 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033651 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
33652 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033653 xmlResetLastError();
33654 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033655 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033657 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033658 printf(" %d", n_utf);
33659 printf(" %d", n_utfchar);
33660 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033661 }
33662 }
33663 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033664 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033665
Daniel Veillard42595322004-11-08 10:52:06 +000033666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033667}
33668
33669
33670static int
33671test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033673
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033674 int mem_base;
33675 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033676 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033677 int n_utf;
33678 int len; /* the len of @utf (in chars) */
33679 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033680
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033681 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33682 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033684 utf = gen_const_xmlChar_ptr(n_utf, 0);
33685 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033686
William M. Brackf13f77f2004-11-12 16:03:48 +000033687 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033688 desret_xmlChar_ptr(ret_val);
33689 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033690 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033691 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033692 xmlResetLastError();
33693 if (mem_base != xmlMemBlocks()) {
33694 printf("Leak of %d blocks found in xmlUTF8Strndup",
33695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033696 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033697 printf(" %d", n_utf);
33698 printf(" %d", n_len);
33699 printf("\n");
33700 }
33701 }
33702 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033703 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033704
Daniel Veillard42595322004-11-08 10:52:06 +000033705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033706}
33707
33708
33709static int
33710test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033712
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033713 int mem_base;
33714 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033715 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033716 int n_utf;
33717 int pos; /* the position of the desired UTF8 char (in chars) */
33718 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033719
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033720 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33721 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033723 utf = gen_const_xmlChar_ptr(n_utf, 0);
33724 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033725
William M. Brackf13f77f2004-11-12 16:03:48 +000033726 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033727 desret_const_xmlChar_ptr(ret_val);
33728 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033729 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033730 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033731 xmlResetLastError();
33732 if (mem_base != xmlMemBlocks()) {
33733 printf("Leak of %d blocks found in xmlUTF8Strpos",
33734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033735 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033736 printf(" %d", n_utf);
33737 printf(" %d", n_pos);
33738 printf("\n");
33739 }
33740 }
33741 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033743
Daniel Veillard42595322004-11-08 10:52:06 +000033744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033745}
33746
33747
33748static int
33749test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033751
33752 int mem_base;
33753 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033754 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033755 int n_utf;
33756 int len; /* the number of characters in the array */
33757 int n_len;
33758
33759 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33760 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33761 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033762 utf = gen_const_xmlChar_ptr(n_utf, 0);
33763 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033764
William M. Brackf13f77f2004-11-12 16:03:48 +000033765 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033766 desret_int(ret_val);
33767 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033768 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033769 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033770 xmlResetLastError();
33771 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033772 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033774 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033775 printf(" %d", n_utf);
33776 printf(" %d", n_len);
33777 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033778 }
33779 }
33780 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033781 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033782
Daniel Veillard42595322004-11-08 10:52:06 +000033783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033784}
33785
33786
33787static int
33788test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033790
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033791 int mem_base;
33792 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033793 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033794 int n_utf;
33795 int start; /* relative pos of first char */
33796 int n_start;
33797 int len; /* total number to copy */
33798 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033799
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033800 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33801 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33802 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033804 utf = gen_const_xmlChar_ptr(n_utf, 0);
33805 start = gen_int(n_start, 1);
33806 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033807
William M. Brackf13f77f2004-11-12 16:03:48 +000033808 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033809 desret_xmlChar_ptr(ret_val);
33810 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033811 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033812 des_int(n_start, start, 1);
33813 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033814 xmlResetLastError();
33815 if (mem_base != xmlMemBlocks()) {
33816 printf("Leak of %d blocks found in xmlUTF8Strsub",
33817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033818 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033819 printf(" %d", n_utf);
33820 printf(" %d", n_start);
33821 printf(" %d", n_len);
33822 printf("\n");
33823 }
33824 }
33825 }
33826 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033827 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033828
Daniel Veillard42595322004-11-08 10:52:06 +000033829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033830}
33831
33832static int
33833test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033835
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033836 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033837 test_ret += test_xmlCharStrdup();
33838 test_ret += test_xmlCharStrndup();
33839 test_ret += test_xmlCheckUTF8();
33840 test_ret += test_xmlGetUTF8Char();
33841 test_ret += test_xmlStrEqual();
33842 test_ret += test_xmlStrPrintf();
33843 test_ret += test_xmlStrQEqual();
33844 test_ret += test_xmlStrVPrintf();
33845 test_ret += test_xmlStrcasecmp();
33846 test_ret += test_xmlStrcasestr();
33847 test_ret += test_xmlStrchr();
33848 test_ret += test_xmlStrcmp();
33849 test_ret += test_xmlStrdup();
33850 test_ret += test_xmlStrlen();
33851 test_ret += test_xmlStrncasecmp();
33852 test_ret += test_xmlStrncatNew();
33853 test_ret += test_xmlStrncmp();
33854 test_ret += test_xmlStrndup();
33855 test_ret += test_xmlStrstr();
33856 test_ret += test_xmlStrsub();
33857 test_ret += test_xmlUTF8Charcmp();
33858 test_ret += test_xmlUTF8Size();
33859 test_ret += test_xmlUTF8Strlen();
33860 test_ret += test_xmlUTF8Strloc();
33861 test_ret += test_xmlUTF8Strndup();
33862 test_ret += test_xmlUTF8Strpos();
33863 test_ret += test_xmlUTF8Strsize();
33864 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033865
Daniel Veillard42595322004-11-08 10:52:06 +000033866 if (test_ret != 0)
33867 printf("Module xmlstring: %d errors\n", test_ret);
33868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033869}
33870
33871static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033872test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033873 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033874
33875#ifdef LIBXML_UNICODE_ENABLED
33876 int mem_base;
33877 int ret_val;
33878 int code; /* UCS code point */
33879 int n_code;
33880
33881 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33882 mem_base = xmlMemBlocks();
33883 code = gen_int(n_code, 0);
33884
33885 ret_val = xmlUCSIsAegeanNumbers(code);
33886 desret_int(ret_val);
33887 call_tests++;
33888 des_int(n_code, code, 0);
33889 xmlResetLastError();
33890 if (mem_base != xmlMemBlocks()) {
33891 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
33892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033893 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033894 printf(" %d", n_code);
33895 printf("\n");
33896 }
33897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033898 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033899#endif
33900
Daniel Veillard42595322004-11-08 10:52:06 +000033901 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033902}
33903
33904
33905static int
33906test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033907 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033908
33909#ifdef LIBXML_UNICODE_ENABLED
33910 int mem_base;
33911 int ret_val;
33912 int code; /* UCS code point */
33913 int n_code;
33914
33915 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33916 mem_base = xmlMemBlocks();
33917 code = gen_int(n_code, 0);
33918
33919 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
33920 desret_int(ret_val);
33921 call_tests++;
33922 des_int(n_code, code, 0);
33923 xmlResetLastError();
33924 if (mem_base != xmlMemBlocks()) {
33925 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
33926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033927 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033928 printf(" %d", n_code);
33929 printf("\n");
33930 }
33931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033932 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033933#endif
33934
Daniel Veillard42595322004-11-08 10:52:06 +000033935 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033936}
33937
33938
33939static int
33940test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033941 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033942
33943#ifdef LIBXML_UNICODE_ENABLED
33944 int mem_base;
33945 int ret_val;
33946 int code; /* UCS code point */
33947 int n_code;
33948
33949 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33950 mem_base = xmlMemBlocks();
33951 code = gen_int(n_code, 0);
33952
33953 ret_val = xmlUCSIsArabic(code);
33954 desret_int(ret_val);
33955 call_tests++;
33956 des_int(n_code, code, 0);
33957 xmlResetLastError();
33958 if (mem_base != xmlMemBlocks()) {
33959 printf("Leak of %d blocks found in xmlUCSIsArabic",
33960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033961 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033962 printf(" %d", n_code);
33963 printf("\n");
33964 }
33965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033966 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033967#endif
33968
Daniel Veillard42595322004-11-08 10:52:06 +000033969 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033970}
33971
33972
33973static int
33974test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033975 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033976
33977#ifdef LIBXML_UNICODE_ENABLED
33978 int mem_base;
33979 int ret_val;
33980 int code; /* UCS code point */
33981 int n_code;
33982
33983 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33984 mem_base = xmlMemBlocks();
33985 code = gen_int(n_code, 0);
33986
33987 ret_val = xmlUCSIsArabicPresentationFormsA(code);
33988 desret_int(ret_val);
33989 call_tests++;
33990 des_int(n_code, code, 0);
33991 xmlResetLastError();
33992 if (mem_base != xmlMemBlocks()) {
33993 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
33994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033995 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033996 printf(" %d", n_code);
33997 printf("\n");
33998 }
33999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034000 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034001#endif
34002
Daniel Veillard42595322004-11-08 10:52:06 +000034003 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034004}
34005
34006
34007static int
34008test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034009 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034010
34011#ifdef LIBXML_UNICODE_ENABLED
34012 int mem_base;
34013 int ret_val;
34014 int code; /* UCS code point */
34015 int n_code;
34016
34017 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34018 mem_base = xmlMemBlocks();
34019 code = gen_int(n_code, 0);
34020
34021 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34022 desret_int(ret_val);
34023 call_tests++;
34024 des_int(n_code, code, 0);
34025 xmlResetLastError();
34026 if (mem_base != xmlMemBlocks()) {
34027 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034029 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034030 printf(" %d", n_code);
34031 printf("\n");
34032 }
34033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034034 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034035#endif
34036
Daniel Veillard42595322004-11-08 10:52:06 +000034037 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034038}
34039
34040
34041static int
34042test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034043 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034044
34045#ifdef LIBXML_UNICODE_ENABLED
34046 int mem_base;
34047 int ret_val;
34048 int code; /* UCS code point */
34049 int n_code;
34050
34051 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34052 mem_base = xmlMemBlocks();
34053 code = gen_int(n_code, 0);
34054
34055 ret_val = xmlUCSIsArmenian(code);
34056 desret_int(ret_val);
34057 call_tests++;
34058 des_int(n_code, code, 0);
34059 xmlResetLastError();
34060 if (mem_base != xmlMemBlocks()) {
34061 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034063 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034064 printf(" %d", n_code);
34065 printf("\n");
34066 }
34067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034068 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034069#endif
34070
Daniel Veillard42595322004-11-08 10:52:06 +000034071 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034072}
34073
34074
34075static int
34076test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034077 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034078
34079#ifdef LIBXML_UNICODE_ENABLED
34080 int mem_base;
34081 int ret_val;
34082 int code; /* UCS code point */
34083 int n_code;
34084
34085 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34086 mem_base = xmlMemBlocks();
34087 code = gen_int(n_code, 0);
34088
34089 ret_val = xmlUCSIsArrows(code);
34090 desret_int(ret_val);
34091 call_tests++;
34092 des_int(n_code, code, 0);
34093 xmlResetLastError();
34094 if (mem_base != xmlMemBlocks()) {
34095 printf("Leak of %d blocks found in xmlUCSIsArrows",
34096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034097 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034098 printf(" %d", n_code);
34099 printf("\n");
34100 }
34101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034102 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034103#endif
34104
Daniel Veillard42595322004-11-08 10:52:06 +000034105 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034106}
34107
34108
34109static int
34110test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034111 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034112
34113#ifdef LIBXML_UNICODE_ENABLED
34114 int mem_base;
34115 int ret_val;
34116 int code; /* UCS code point */
34117 int n_code;
34118
34119 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34120 mem_base = xmlMemBlocks();
34121 code = gen_int(n_code, 0);
34122
34123 ret_val = xmlUCSIsBasicLatin(code);
34124 desret_int(ret_val);
34125 call_tests++;
34126 des_int(n_code, code, 0);
34127 xmlResetLastError();
34128 if (mem_base != xmlMemBlocks()) {
34129 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034131 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034132 printf(" %d", n_code);
34133 printf("\n");
34134 }
34135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034136 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034137#endif
34138
Daniel Veillard42595322004-11-08 10:52:06 +000034139 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034140}
34141
34142
34143static int
34144test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034145 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034146
34147#ifdef LIBXML_UNICODE_ENABLED
34148 int mem_base;
34149 int ret_val;
34150 int code; /* UCS code point */
34151 int n_code;
34152
34153 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34154 mem_base = xmlMemBlocks();
34155 code = gen_int(n_code, 0);
34156
34157 ret_val = xmlUCSIsBengali(code);
34158 desret_int(ret_val);
34159 call_tests++;
34160 des_int(n_code, code, 0);
34161 xmlResetLastError();
34162 if (mem_base != xmlMemBlocks()) {
34163 printf("Leak of %d blocks found in xmlUCSIsBengali",
34164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034165 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034166 printf(" %d", n_code);
34167 printf("\n");
34168 }
34169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034170 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034171#endif
34172
Daniel Veillard42595322004-11-08 10:52:06 +000034173 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034174}
34175
34176
34177static int
34178test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034179 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034180
34181#ifdef LIBXML_UNICODE_ENABLED
34182 int mem_base;
34183 int ret_val;
34184 int code; /* UCS code point */
34185 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034186 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034187 int n_block;
34188
34189 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34190 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34191 mem_base = xmlMemBlocks();
34192 code = gen_int(n_code, 0);
34193 block = gen_const_char_ptr(n_block, 1);
34194
William M. Brackf13f77f2004-11-12 16:03:48 +000034195 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034196 desret_int(ret_val);
34197 call_tests++;
34198 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034199 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034200 xmlResetLastError();
34201 if (mem_base != xmlMemBlocks()) {
34202 printf("Leak of %d blocks found in xmlUCSIsBlock",
34203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034204 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034205 printf(" %d", n_code);
34206 printf(" %d", n_block);
34207 printf("\n");
34208 }
34209 }
34210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034211 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034212#endif
34213
Daniel Veillard42595322004-11-08 10:52:06 +000034214 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034215}
34216
34217
34218static int
34219test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034220 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034221
34222#ifdef LIBXML_UNICODE_ENABLED
34223 int mem_base;
34224 int ret_val;
34225 int code; /* UCS code point */
34226 int n_code;
34227
34228 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34229 mem_base = xmlMemBlocks();
34230 code = gen_int(n_code, 0);
34231
34232 ret_val = xmlUCSIsBlockElements(code);
34233 desret_int(ret_val);
34234 call_tests++;
34235 des_int(n_code, code, 0);
34236 xmlResetLastError();
34237 if (mem_base != xmlMemBlocks()) {
34238 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034240 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034241 printf(" %d", n_code);
34242 printf("\n");
34243 }
34244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034245 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034246#endif
34247
Daniel Veillard42595322004-11-08 10:52:06 +000034248 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034249}
34250
34251
34252static int
34253test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034254 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034255
34256#ifdef LIBXML_UNICODE_ENABLED
34257 int mem_base;
34258 int ret_val;
34259 int code; /* UCS code point */
34260 int n_code;
34261
34262 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34263 mem_base = xmlMemBlocks();
34264 code = gen_int(n_code, 0);
34265
34266 ret_val = xmlUCSIsBopomofo(code);
34267 desret_int(ret_val);
34268 call_tests++;
34269 des_int(n_code, code, 0);
34270 xmlResetLastError();
34271 if (mem_base != xmlMemBlocks()) {
34272 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034274 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034275 printf(" %d", n_code);
34276 printf("\n");
34277 }
34278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034279 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034280#endif
34281
Daniel Veillard42595322004-11-08 10:52:06 +000034282 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034283}
34284
34285
34286static int
34287test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034288 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034289
34290#ifdef LIBXML_UNICODE_ENABLED
34291 int mem_base;
34292 int ret_val;
34293 int code; /* UCS code point */
34294 int n_code;
34295
34296 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34297 mem_base = xmlMemBlocks();
34298 code = gen_int(n_code, 0);
34299
34300 ret_val = xmlUCSIsBopomofoExtended(code);
34301 desret_int(ret_val);
34302 call_tests++;
34303 des_int(n_code, code, 0);
34304 xmlResetLastError();
34305 if (mem_base != xmlMemBlocks()) {
34306 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034308 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034309 printf(" %d", n_code);
34310 printf("\n");
34311 }
34312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034313 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034314#endif
34315
Daniel Veillard42595322004-11-08 10:52:06 +000034316 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034317}
34318
34319
34320static int
34321test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034322 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034323
34324#ifdef LIBXML_UNICODE_ENABLED
34325 int mem_base;
34326 int ret_val;
34327 int code; /* UCS code point */
34328 int n_code;
34329
34330 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34331 mem_base = xmlMemBlocks();
34332 code = gen_int(n_code, 0);
34333
34334 ret_val = xmlUCSIsBoxDrawing(code);
34335 desret_int(ret_val);
34336 call_tests++;
34337 des_int(n_code, code, 0);
34338 xmlResetLastError();
34339 if (mem_base != xmlMemBlocks()) {
34340 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034342 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034343 printf(" %d", n_code);
34344 printf("\n");
34345 }
34346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034347 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034348#endif
34349
Daniel Veillard42595322004-11-08 10:52:06 +000034350 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034351}
34352
34353
34354static int
34355test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034356 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034357
34358#ifdef LIBXML_UNICODE_ENABLED
34359 int mem_base;
34360 int ret_val;
34361 int code; /* UCS code point */
34362 int n_code;
34363
34364 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34365 mem_base = xmlMemBlocks();
34366 code = gen_int(n_code, 0);
34367
34368 ret_val = xmlUCSIsBraillePatterns(code);
34369 desret_int(ret_val);
34370 call_tests++;
34371 des_int(n_code, code, 0);
34372 xmlResetLastError();
34373 if (mem_base != xmlMemBlocks()) {
34374 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034376 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034377 printf(" %d", n_code);
34378 printf("\n");
34379 }
34380 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034381 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034382#endif
34383
Daniel Veillard42595322004-11-08 10:52:06 +000034384 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034385}
34386
34387
34388static int
34389test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034390 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034391
34392#ifdef LIBXML_UNICODE_ENABLED
34393 int mem_base;
34394 int ret_val;
34395 int code; /* UCS code point */
34396 int n_code;
34397
34398 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34399 mem_base = xmlMemBlocks();
34400 code = gen_int(n_code, 0);
34401
34402 ret_val = xmlUCSIsBuhid(code);
34403 desret_int(ret_val);
34404 call_tests++;
34405 des_int(n_code, code, 0);
34406 xmlResetLastError();
34407 if (mem_base != xmlMemBlocks()) {
34408 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034410 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034411 printf(" %d", n_code);
34412 printf("\n");
34413 }
34414 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034415 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034416#endif
34417
Daniel Veillard42595322004-11-08 10:52:06 +000034418 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034419}
34420
34421
34422static int
34423test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034424 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034425
34426#ifdef LIBXML_UNICODE_ENABLED
34427 int mem_base;
34428 int ret_val;
34429 int code; /* UCS code point */
34430 int n_code;
34431
34432 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34433 mem_base = xmlMemBlocks();
34434 code = gen_int(n_code, 0);
34435
34436 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34437 desret_int(ret_val);
34438 call_tests++;
34439 des_int(n_code, code, 0);
34440 xmlResetLastError();
34441 if (mem_base != xmlMemBlocks()) {
34442 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034444 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034445 printf(" %d", n_code);
34446 printf("\n");
34447 }
34448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034449 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034450#endif
34451
Daniel Veillard42595322004-11-08 10:52:06 +000034452 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034453}
34454
34455
34456static int
34457test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034458 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034459
34460#ifdef LIBXML_UNICODE_ENABLED
34461 int mem_base;
34462 int ret_val;
34463 int code; /* UCS code point */
34464 int n_code;
34465
34466 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34467 mem_base = xmlMemBlocks();
34468 code = gen_int(n_code, 0);
34469
34470 ret_val = xmlUCSIsCJKCompatibility(code);
34471 desret_int(ret_val);
34472 call_tests++;
34473 des_int(n_code, code, 0);
34474 xmlResetLastError();
34475 if (mem_base != xmlMemBlocks()) {
34476 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034478 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034479 printf(" %d", n_code);
34480 printf("\n");
34481 }
34482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034483 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034484#endif
34485
Daniel Veillard42595322004-11-08 10:52:06 +000034486 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034487}
34488
34489
34490static int
34491test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034492 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034493
34494#ifdef LIBXML_UNICODE_ENABLED
34495 int mem_base;
34496 int ret_val;
34497 int code; /* UCS code point */
34498 int n_code;
34499
34500 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34501 mem_base = xmlMemBlocks();
34502 code = gen_int(n_code, 0);
34503
34504 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34505 desret_int(ret_val);
34506 call_tests++;
34507 des_int(n_code, code, 0);
34508 xmlResetLastError();
34509 if (mem_base != xmlMemBlocks()) {
34510 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034512 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034513 printf(" %d", n_code);
34514 printf("\n");
34515 }
34516 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034517 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034518#endif
34519
Daniel Veillard42595322004-11-08 10:52:06 +000034520 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034521}
34522
34523
34524static int
34525test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034526 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034527
34528#ifdef LIBXML_UNICODE_ENABLED
34529 int mem_base;
34530 int ret_val;
34531 int code; /* UCS code point */
34532 int n_code;
34533
34534 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34535 mem_base = xmlMemBlocks();
34536 code = gen_int(n_code, 0);
34537
34538 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34539 desret_int(ret_val);
34540 call_tests++;
34541 des_int(n_code, code, 0);
34542 xmlResetLastError();
34543 if (mem_base != xmlMemBlocks()) {
34544 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034546 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034547 printf(" %d", n_code);
34548 printf("\n");
34549 }
34550 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034551 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034552#endif
34553
Daniel Veillard42595322004-11-08 10:52:06 +000034554 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034555}
34556
34557
34558static int
34559test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034560 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034561
34562#ifdef LIBXML_UNICODE_ENABLED
34563 int mem_base;
34564 int ret_val;
34565 int code; /* UCS code point */
34566 int n_code;
34567
34568 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34569 mem_base = xmlMemBlocks();
34570 code = gen_int(n_code, 0);
34571
34572 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34573 desret_int(ret_val);
34574 call_tests++;
34575 des_int(n_code, code, 0);
34576 xmlResetLastError();
34577 if (mem_base != xmlMemBlocks()) {
34578 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034580 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034581 printf(" %d", n_code);
34582 printf("\n");
34583 }
34584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034585 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034586#endif
34587
Daniel Veillard42595322004-11-08 10:52:06 +000034588 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034589}
34590
34591
34592static int
34593test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034594 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034595
34596#ifdef LIBXML_UNICODE_ENABLED
34597 int mem_base;
34598 int ret_val;
34599 int code; /* UCS code point */
34600 int n_code;
34601
34602 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34603 mem_base = xmlMemBlocks();
34604 code = gen_int(n_code, 0);
34605
34606 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34607 desret_int(ret_val);
34608 call_tests++;
34609 des_int(n_code, code, 0);
34610 xmlResetLastError();
34611 if (mem_base != xmlMemBlocks()) {
34612 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034614 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034615 printf(" %d", n_code);
34616 printf("\n");
34617 }
34618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034619 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034620#endif
34621
Daniel Veillard42595322004-11-08 10:52:06 +000034622 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034623}
34624
34625
34626static int
34627test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034628 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034629
34630#ifdef LIBXML_UNICODE_ENABLED
34631 int mem_base;
34632 int ret_val;
34633 int code; /* UCS code point */
34634 int n_code;
34635
34636 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34637 mem_base = xmlMemBlocks();
34638 code = gen_int(n_code, 0);
34639
34640 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34641 desret_int(ret_val);
34642 call_tests++;
34643 des_int(n_code, code, 0);
34644 xmlResetLastError();
34645 if (mem_base != xmlMemBlocks()) {
34646 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34647 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034648 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034649 printf(" %d", n_code);
34650 printf("\n");
34651 }
34652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034653 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034654#endif
34655
Daniel Veillard42595322004-11-08 10:52:06 +000034656 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034657}
34658
34659
34660static int
34661test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034662 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034663
34664#ifdef LIBXML_UNICODE_ENABLED
34665 int mem_base;
34666 int ret_val;
34667 int code; /* UCS code point */
34668 int n_code;
34669
34670 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34671 mem_base = xmlMemBlocks();
34672 code = gen_int(n_code, 0);
34673
34674 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34675 desret_int(ret_val);
34676 call_tests++;
34677 des_int(n_code, code, 0);
34678 xmlResetLastError();
34679 if (mem_base != xmlMemBlocks()) {
34680 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034682 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034683 printf(" %d", n_code);
34684 printf("\n");
34685 }
34686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034687 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034688#endif
34689
Daniel Veillard42595322004-11-08 10:52:06 +000034690 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034691}
34692
34693
34694static int
34695test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034696 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034697
34698#ifdef LIBXML_UNICODE_ENABLED
34699 int mem_base;
34700 int ret_val;
34701 int code; /* UCS code point */
34702 int n_code;
34703
34704 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34705 mem_base = xmlMemBlocks();
34706 code = gen_int(n_code, 0);
34707
34708 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34709 desret_int(ret_val);
34710 call_tests++;
34711 des_int(n_code, code, 0);
34712 xmlResetLastError();
34713 if (mem_base != xmlMemBlocks()) {
34714 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034716 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034717 printf(" %d", n_code);
34718 printf("\n");
34719 }
34720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034721 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034722#endif
34723
Daniel Veillard42595322004-11-08 10:52:06 +000034724 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034725}
34726
34727
34728static int
34729test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034730 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034731
34732#ifdef LIBXML_UNICODE_ENABLED
34733 int mem_base;
34734 int ret_val;
34735 int code; /* UCS code point */
34736 int n_code;
34737
34738 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34739 mem_base = xmlMemBlocks();
34740 code = gen_int(n_code, 0);
34741
34742 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34743 desret_int(ret_val);
34744 call_tests++;
34745 des_int(n_code, code, 0);
34746 xmlResetLastError();
34747 if (mem_base != xmlMemBlocks()) {
34748 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034750 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034751 printf(" %d", n_code);
34752 printf("\n");
34753 }
34754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034755 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034756#endif
34757
Daniel Veillard42595322004-11-08 10:52:06 +000034758 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034759}
34760
34761
34762static int
34763test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034764 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034765
34766#ifdef LIBXML_UNICODE_ENABLED
34767 int mem_base;
34768 int ret_val;
34769 int code; /* UCS code point */
34770 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034771 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034772 int n_cat;
34773
34774 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34775 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34776 mem_base = xmlMemBlocks();
34777 code = gen_int(n_code, 0);
34778 cat = gen_const_char_ptr(n_cat, 1);
34779
William M. Brackf13f77f2004-11-12 16:03:48 +000034780 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034781 desret_int(ret_val);
34782 call_tests++;
34783 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034784 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034785 xmlResetLastError();
34786 if (mem_base != xmlMemBlocks()) {
34787 printf("Leak of %d blocks found in xmlUCSIsCat",
34788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034789 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034790 printf(" %d", n_code);
34791 printf(" %d", n_cat);
34792 printf("\n");
34793 }
34794 }
34795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034796 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034797#endif
34798
Daniel Veillard42595322004-11-08 10:52:06 +000034799 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034800}
34801
34802
34803static int
34804test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034805 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034806
34807#ifdef LIBXML_UNICODE_ENABLED
34808 int mem_base;
34809 int ret_val;
34810 int code; /* UCS code point */
34811 int n_code;
34812
34813 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34814 mem_base = xmlMemBlocks();
34815 code = gen_int(n_code, 0);
34816
34817 ret_val = xmlUCSIsCatC(code);
34818 desret_int(ret_val);
34819 call_tests++;
34820 des_int(n_code, code, 0);
34821 xmlResetLastError();
34822 if (mem_base != xmlMemBlocks()) {
34823 printf("Leak of %d blocks found in xmlUCSIsCatC",
34824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034825 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034826 printf(" %d", n_code);
34827 printf("\n");
34828 }
34829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034830 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034831#endif
34832
Daniel Veillard42595322004-11-08 10:52:06 +000034833 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034834}
34835
34836
34837static int
34838test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034839 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034840
34841#ifdef LIBXML_UNICODE_ENABLED
34842 int mem_base;
34843 int ret_val;
34844 int code; /* UCS code point */
34845 int n_code;
34846
34847 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34848 mem_base = xmlMemBlocks();
34849 code = gen_int(n_code, 0);
34850
34851 ret_val = xmlUCSIsCatCc(code);
34852 desret_int(ret_val);
34853 call_tests++;
34854 des_int(n_code, code, 0);
34855 xmlResetLastError();
34856 if (mem_base != xmlMemBlocks()) {
34857 printf("Leak of %d blocks found in xmlUCSIsCatCc",
34858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034859 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034860 printf(" %d", n_code);
34861 printf("\n");
34862 }
34863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034864 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034865#endif
34866
Daniel Veillard42595322004-11-08 10:52:06 +000034867 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034868}
34869
34870
34871static int
34872test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034873 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034874
34875#ifdef LIBXML_UNICODE_ENABLED
34876 int mem_base;
34877 int ret_val;
34878 int code; /* UCS code point */
34879 int n_code;
34880
34881 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34882 mem_base = xmlMemBlocks();
34883 code = gen_int(n_code, 0);
34884
34885 ret_val = xmlUCSIsCatCf(code);
34886 desret_int(ret_val);
34887 call_tests++;
34888 des_int(n_code, code, 0);
34889 xmlResetLastError();
34890 if (mem_base != xmlMemBlocks()) {
34891 printf("Leak of %d blocks found in xmlUCSIsCatCf",
34892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034893 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034894 printf(" %d", n_code);
34895 printf("\n");
34896 }
34897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034898 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034899#endif
34900
Daniel Veillard42595322004-11-08 10:52:06 +000034901 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034902}
34903
34904
34905static int
34906test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034907 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034908
34909#ifdef LIBXML_UNICODE_ENABLED
34910 int mem_base;
34911 int ret_val;
34912 int code; /* UCS code point */
34913 int n_code;
34914
34915 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34916 mem_base = xmlMemBlocks();
34917 code = gen_int(n_code, 0);
34918
34919 ret_val = xmlUCSIsCatCo(code);
34920 desret_int(ret_val);
34921 call_tests++;
34922 des_int(n_code, code, 0);
34923 xmlResetLastError();
34924 if (mem_base != xmlMemBlocks()) {
34925 printf("Leak of %d blocks found in xmlUCSIsCatCo",
34926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034927 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034928 printf(" %d", n_code);
34929 printf("\n");
34930 }
34931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034932 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034933#endif
34934
Daniel Veillard42595322004-11-08 10:52:06 +000034935 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034936}
34937
34938
34939static int
34940test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034941 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034942
34943#ifdef LIBXML_UNICODE_ENABLED
34944 int mem_base;
34945 int ret_val;
34946 int code; /* UCS code point */
34947 int n_code;
34948
34949 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34950 mem_base = xmlMemBlocks();
34951 code = gen_int(n_code, 0);
34952
34953 ret_val = xmlUCSIsCatCs(code);
34954 desret_int(ret_val);
34955 call_tests++;
34956 des_int(n_code, code, 0);
34957 xmlResetLastError();
34958 if (mem_base != xmlMemBlocks()) {
34959 printf("Leak of %d blocks found in xmlUCSIsCatCs",
34960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034961 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034962 printf(" %d", n_code);
34963 printf("\n");
34964 }
34965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034966 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034967#endif
34968
Daniel Veillard42595322004-11-08 10:52:06 +000034969 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034970}
34971
34972
34973static int
34974test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034975 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034976
34977#ifdef LIBXML_UNICODE_ENABLED
34978 int mem_base;
34979 int ret_val;
34980 int code; /* UCS code point */
34981 int n_code;
34982
34983 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34984 mem_base = xmlMemBlocks();
34985 code = gen_int(n_code, 0);
34986
34987 ret_val = xmlUCSIsCatL(code);
34988 desret_int(ret_val);
34989 call_tests++;
34990 des_int(n_code, code, 0);
34991 xmlResetLastError();
34992 if (mem_base != xmlMemBlocks()) {
34993 printf("Leak of %d blocks found in xmlUCSIsCatL",
34994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034995 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034996 printf(" %d", n_code);
34997 printf("\n");
34998 }
34999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035000 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035001#endif
35002
Daniel Veillard42595322004-11-08 10:52:06 +000035003 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035004}
35005
35006
35007static int
35008test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035009 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035010
35011#ifdef LIBXML_UNICODE_ENABLED
35012 int mem_base;
35013 int ret_val;
35014 int code; /* UCS code point */
35015 int n_code;
35016
35017 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35018 mem_base = xmlMemBlocks();
35019 code = gen_int(n_code, 0);
35020
35021 ret_val = xmlUCSIsCatLl(code);
35022 desret_int(ret_val);
35023 call_tests++;
35024 des_int(n_code, code, 0);
35025 xmlResetLastError();
35026 if (mem_base != xmlMemBlocks()) {
35027 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035029 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035030 printf(" %d", n_code);
35031 printf("\n");
35032 }
35033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035034 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035035#endif
35036
Daniel Veillard42595322004-11-08 10:52:06 +000035037 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035038}
35039
35040
35041static int
35042test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035043 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035044
35045#ifdef LIBXML_UNICODE_ENABLED
35046 int mem_base;
35047 int ret_val;
35048 int code; /* UCS code point */
35049 int n_code;
35050
35051 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35052 mem_base = xmlMemBlocks();
35053 code = gen_int(n_code, 0);
35054
35055 ret_val = xmlUCSIsCatLm(code);
35056 desret_int(ret_val);
35057 call_tests++;
35058 des_int(n_code, code, 0);
35059 xmlResetLastError();
35060 if (mem_base != xmlMemBlocks()) {
35061 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035063 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035064 printf(" %d", n_code);
35065 printf("\n");
35066 }
35067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035068 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035069#endif
35070
Daniel Veillard42595322004-11-08 10:52:06 +000035071 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035072}
35073
35074
35075static int
35076test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035077 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035078
35079#ifdef LIBXML_UNICODE_ENABLED
35080 int mem_base;
35081 int ret_val;
35082 int code; /* UCS code point */
35083 int n_code;
35084
35085 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35086 mem_base = xmlMemBlocks();
35087 code = gen_int(n_code, 0);
35088
35089 ret_val = xmlUCSIsCatLo(code);
35090 desret_int(ret_val);
35091 call_tests++;
35092 des_int(n_code, code, 0);
35093 xmlResetLastError();
35094 if (mem_base != xmlMemBlocks()) {
35095 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035097 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035098 printf(" %d", n_code);
35099 printf("\n");
35100 }
35101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035102 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035103#endif
35104
Daniel Veillard42595322004-11-08 10:52:06 +000035105 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035106}
35107
35108
35109static int
35110test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035111 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035112
35113#ifdef LIBXML_UNICODE_ENABLED
35114 int mem_base;
35115 int ret_val;
35116 int code; /* UCS code point */
35117 int n_code;
35118
35119 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35120 mem_base = xmlMemBlocks();
35121 code = gen_int(n_code, 0);
35122
35123 ret_val = xmlUCSIsCatLt(code);
35124 desret_int(ret_val);
35125 call_tests++;
35126 des_int(n_code, code, 0);
35127 xmlResetLastError();
35128 if (mem_base != xmlMemBlocks()) {
35129 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035131 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035132 printf(" %d", n_code);
35133 printf("\n");
35134 }
35135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035136 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035137#endif
35138
Daniel Veillard42595322004-11-08 10:52:06 +000035139 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035140}
35141
35142
35143static int
35144test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035145 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035146
35147#ifdef LIBXML_UNICODE_ENABLED
35148 int mem_base;
35149 int ret_val;
35150 int code; /* UCS code point */
35151 int n_code;
35152
35153 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35154 mem_base = xmlMemBlocks();
35155 code = gen_int(n_code, 0);
35156
35157 ret_val = xmlUCSIsCatLu(code);
35158 desret_int(ret_val);
35159 call_tests++;
35160 des_int(n_code, code, 0);
35161 xmlResetLastError();
35162 if (mem_base != xmlMemBlocks()) {
35163 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035165 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035166 printf(" %d", n_code);
35167 printf("\n");
35168 }
35169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035170 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035171#endif
35172
Daniel Veillard42595322004-11-08 10:52:06 +000035173 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035174}
35175
35176
35177static int
35178test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035179 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035180
35181#ifdef LIBXML_UNICODE_ENABLED
35182 int mem_base;
35183 int ret_val;
35184 int code; /* UCS code point */
35185 int n_code;
35186
35187 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35188 mem_base = xmlMemBlocks();
35189 code = gen_int(n_code, 0);
35190
35191 ret_val = xmlUCSIsCatM(code);
35192 desret_int(ret_val);
35193 call_tests++;
35194 des_int(n_code, code, 0);
35195 xmlResetLastError();
35196 if (mem_base != xmlMemBlocks()) {
35197 printf("Leak of %d blocks found in xmlUCSIsCatM",
35198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035199 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035200 printf(" %d", n_code);
35201 printf("\n");
35202 }
35203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035204 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035205#endif
35206
Daniel Veillard42595322004-11-08 10:52:06 +000035207 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035208}
35209
35210
35211static int
35212test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035213 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035214
35215#ifdef LIBXML_UNICODE_ENABLED
35216 int mem_base;
35217 int ret_val;
35218 int code; /* UCS code point */
35219 int n_code;
35220
35221 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35222 mem_base = xmlMemBlocks();
35223 code = gen_int(n_code, 0);
35224
35225 ret_val = xmlUCSIsCatMc(code);
35226 desret_int(ret_val);
35227 call_tests++;
35228 des_int(n_code, code, 0);
35229 xmlResetLastError();
35230 if (mem_base != xmlMemBlocks()) {
35231 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035233 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035234 printf(" %d", n_code);
35235 printf("\n");
35236 }
35237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035238 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035239#endif
35240
Daniel Veillard42595322004-11-08 10:52:06 +000035241 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035242}
35243
35244
35245static int
35246test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035247 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035248
35249#ifdef LIBXML_UNICODE_ENABLED
35250 int mem_base;
35251 int ret_val;
35252 int code; /* UCS code point */
35253 int n_code;
35254
35255 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35256 mem_base = xmlMemBlocks();
35257 code = gen_int(n_code, 0);
35258
35259 ret_val = xmlUCSIsCatMe(code);
35260 desret_int(ret_val);
35261 call_tests++;
35262 des_int(n_code, code, 0);
35263 xmlResetLastError();
35264 if (mem_base != xmlMemBlocks()) {
35265 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035267 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035268 printf(" %d", n_code);
35269 printf("\n");
35270 }
35271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035272 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035273#endif
35274
Daniel Veillard42595322004-11-08 10:52:06 +000035275 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035276}
35277
35278
35279static int
35280test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035281 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035282
35283#ifdef LIBXML_UNICODE_ENABLED
35284 int mem_base;
35285 int ret_val;
35286 int code; /* UCS code point */
35287 int n_code;
35288
35289 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35290 mem_base = xmlMemBlocks();
35291 code = gen_int(n_code, 0);
35292
35293 ret_val = xmlUCSIsCatMn(code);
35294 desret_int(ret_val);
35295 call_tests++;
35296 des_int(n_code, code, 0);
35297 xmlResetLastError();
35298 if (mem_base != xmlMemBlocks()) {
35299 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035301 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035302 printf(" %d", n_code);
35303 printf("\n");
35304 }
35305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035306 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035307#endif
35308
Daniel Veillard42595322004-11-08 10:52:06 +000035309 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035310}
35311
35312
35313static int
35314test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035315 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035316
35317#ifdef LIBXML_UNICODE_ENABLED
35318 int mem_base;
35319 int ret_val;
35320 int code; /* UCS code point */
35321 int n_code;
35322
35323 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35324 mem_base = xmlMemBlocks();
35325 code = gen_int(n_code, 0);
35326
35327 ret_val = xmlUCSIsCatN(code);
35328 desret_int(ret_val);
35329 call_tests++;
35330 des_int(n_code, code, 0);
35331 xmlResetLastError();
35332 if (mem_base != xmlMemBlocks()) {
35333 printf("Leak of %d blocks found in xmlUCSIsCatN",
35334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035335 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035336 printf(" %d", n_code);
35337 printf("\n");
35338 }
35339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035340 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035341#endif
35342
Daniel Veillard42595322004-11-08 10:52:06 +000035343 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035344}
35345
35346
35347static int
35348test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035349 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035350
35351#ifdef LIBXML_UNICODE_ENABLED
35352 int mem_base;
35353 int ret_val;
35354 int code; /* UCS code point */
35355 int n_code;
35356
35357 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35358 mem_base = xmlMemBlocks();
35359 code = gen_int(n_code, 0);
35360
35361 ret_val = xmlUCSIsCatNd(code);
35362 desret_int(ret_val);
35363 call_tests++;
35364 des_int(n_code, code, 0);
35365 xmlResetLastError();
35366 if (mem_base != xmlMemBlocks()) {
35367 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035369 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035370 printf(" %d", n_code);
35371 printf("\n");
35372 }
35373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035374 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035375#endif
35376
Daniel Veillard42595322004-11-08 10:52:06 +000035377 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035378}
35379
35380
35381static int
35382test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035383 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035384
35385#ifdef LIBXML_UNICODE_ENABLED
35386 int mem_base;
35387 int ret_val;
35388 int code; /* UCS code point */
35389 int n_code;
35390
35391 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35392 mem_base = xmlMemBlocks();
35393 code = gen_int(n_code, 0);
35394
35395 ret_val = xmlUCSIsCatNl(code);
35396 desret_int(ret_val);
35397 call_tests++;
35398 des_int(n_code, code, 0);
35399 xmlResetLastError();
35400 if (mem_base != xmlMemBlocks()) {
35401 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035403 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035404 printf(" %d", n_code);
35405 printf("\n");
35406 }
35407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035408 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035409#endif
35410
Daniel Veillard42595322004-11-08 10:52:06 +000035411 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035412}
35413
35414
35415static int
35416test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035417 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035418
35419#ifdef LIBXML_UNICODE_ENABLED
35420 int mem_base;
35421 int ret_val;
35422 int code; /* UCS code point */
35423 int n_code;
35424
35425 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35426 mem_base = xmlMemBlocks();
35427 code = gen_int(n_code, 0);
35428
35429 ret_val = xmlUCSIsCatNo(code);
35430 desret_int(ret_val);
35431 call_tests++;
35432 des_int(n_code, code, 0);
35433 xmlResetLastError();
35434 if (mem_base != xmlMemBlocks()) {
35435 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035437 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035438 printf(" %d", n_code);
35439 printf("\n");
35440 }
35441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035442 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035443#endif
35444
Daniel Veillard42595322004-11-08 10:52:06 +000035445 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035446}
35447
35448
35449static int
35450test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035451 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035452
35453#ifdef LIBXML_UNICODE_ENABLED
35454 int mem_base;
35455 int ret_val;
35456 int code; /* UCS code point */
35457 int n_code;
35458
35459 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35460 mem_base = xmlMemBlocks();
35461 code = gen_int(n_code, 0);
35462
35463 ret_val = xmlUCSIsCatP(code);
35464 desret_int(ret_val);
35465 call_tests++;
35466 des_int(n_code, code, 0);
35467 xmlResetLastError();
35468 if (mem_base != xmlMemBlocks()) {
35469 printf("Leak of %d blocks found in xmlUCSIsCatP",
35470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035471 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035472 printf(" %d", n_code);
35473 printf("\n");
35474 }
35475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035476 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035477#endif
35478
Daniel Veillard42595322004-11-08 10:52:06 +000035479 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035480}
35481
35482
35483static int
35484test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035485 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035486
35487#ifdef LIBXML_UNICODE_ENABLED
35488 int mem_base;
35489 int ret_val;
35490 int code; /* UCS code point */
35491 int n_code;
35492
35493 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35494 mem_base = xmlMemBlocks();
35495 code = gen_int(n_code, 0);
35496
35497 ret_val = xmlUCSIsCatPc(code);
35498 desret_int(ret_val);
35499 call_tests++;
35500 des_int(n_code, code, 0);
35501 xmlResetLastError();
35502 if (mem_base != xmlMemBlocks()) {
35503 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035505 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035506 printf(" %d", n_code);
35507 printf("\n");
35508 }
35509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035510 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035511#endif
35512
Daniel Veillard42595322004-11-08 10:52:06 +000035513 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035514}
35515
35516
35517static int
35518test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035519 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035520
35521#ifdef LIBXML_UNICODE_ENABLED
35522 int mem_base;
35523 int ret_val;
35524 int code; /* UCS code point */
35525 int n_code;
35526
35527 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35528 mem_base = xmlMemBlocks();
35529 code = gen_int(n_code, 0);
35530
35531 ret_val = xmlUCSIsCatPd(code);
35532 desret_int(ret_val);
35533 call_tests++;
35534 des_int(n_code, code, 0);
35535 xmlResetLastError();
35536 if (mem_base != xmlMemBlocks()) {
35537 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035539 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035540 printf(" %d", n_code);
35541 printf("\n");
35542 }
35543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035544 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035545#endif
35546
Daniel Veillard42595322004-11-08 10:52:06 +000035547 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035548}
35549
35550
35551static int
35552test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035553 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035554
35555#ifdef LIBXML_UNICODE_ENABLED
35556 int mem_base;
35557 int ret_val;
35558 int code; /* UCS code point */
35559 int n_code;
35560
35561 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35562 mem_base = xmlMemBlocks();
35563 code = gen_int(n_code, 0);
35564
35565 ret_val = xmlUCSIsCatPe(code);
35566 desret_int(ret_val);
35567 call_tests++;
35568 des_int(n_code, code, 0);
35569 xmlResetLastError();
35570 if (mem_base != xmlMemBlocks()) {
35571 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035573 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035574 printf(" %d", n_code);
35575 printf("\n");
35576 }
35577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035578 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035579#endif
35580
Daniel Veillard42595322004-11-08 10:52:06 +000035581 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035582}
35583
35584
35585static int
35586test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035587 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035588
35589#ifdef LIBXML_UNICODE_ENABLED
35590 int mem_base;
35591 int ret_val;
35592 int code; /* UCS code point */
35593 int n_code;
35594
35595 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35596 mem_base = xmlMemBlocks();
35597 code = gen_int(n_code, 0);
35598
35599 ret_val = xmlUCSIsCatPf(code);
35600 desret_int(ret_val);
35601 call_tests++;
35602 des_int(n_code, code, 0);
35603 xmlResetLastError();
35604 if (mem_base != xmlMemBlocks()) {
35605 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035607 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035608 printf(" %d", n_code);
35609 printf("\n");
35610 }
35611 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035612 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035613#endif
35614
Daniel Veillard42595322004-11-08 10:52:06 +000035615 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035616}
35617
35618
35619static int
35620test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035621 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035622
35623#ifdef LIBXML_UNICODE_ENABLED
35624 int mem_base;
35625 int ret_val;
35626 int code; /* UCS code point */
35627 int n_code;
35628
35629 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35630 mem_base = xmlMemBlocks();
35631 code = gen_int(n_code, 0);
35632
35633 ret_val = xmlUCSIsCatPi(code);
35634 desret_int(ret_val);
35635 call_tests++;
35636 des_int(n_code, code, 0);
35637 xmlResetLastError();
35638 if (mem_base != xmlMemBlocks()) {
35639 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035641 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035642 printf(" %d", n_code);
35643 printf("\n");
35644 }
35645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035646 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035647#endif
35648
Daniel Veillard42595322004-11-08 10:52:06 +000035649 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035650}
35651
35652
35653static int
35654test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035655 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035656
35657#ifdef LIBXML_UNICODE_ENABLED
35658 int mem_base;
35659 int ret_val;
35660 int code; /* UCS code point */
35661 int n_code;
35662
35663 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35664 mem_base = xmlMemBlocks();
35665 code = gen_int(n_code, 0);
35666
35667 ret_val = xmlUCSIsCatPo(code);
35668 desret_int(ret_val);
35669 call_tests++;
35670 des_int(n_code, code, 0);
35671 xmlResetLastError();
35672 if (mem_base != xmlMemBlocks()) {
35673 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035675 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035676 printf(" %d", n_code);
35677 printf("\n");
35678 }
35679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035680 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035681#endif
35682
Daniel Veillard42595322004-11-08 10:52:06 +000035683 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035684}
35685
35686
35687static int
35688test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035689 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035690
35691#ifdef LIBXML_UNICODE_ENABLED
35692 int mem_base;
35693 int ret_val;
35694 int code; /* UCS code point */
35695 int n_code;
35696
35697 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35698 mem_base = xmlMemBlocks();
35699 code = gen_int(n_code, 0);
35700
35701 ret_val = xmlUCSIsCatPs(code);
35702 desret_int(ret_val);
35703 call_tests++;
35704 des_int(n_code, code, 0);
35705 xmlResetLastError();
35706 if (mem_base != xmlMemBlocks()) {
35707 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035709 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035710 printf(" %d", n_code);
35711 printf("\n");
35712 }
35713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035714 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035715#endif
35716
Daniel Veillard42595322004-11-08 10:52:06 +000035717 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035718}
35719
35720
35721static int
35722test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035723 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035724
35725#ifdef LIBXML_UNICODE_ENABLED
35726 int mem_base;
35727 int ret_val;
35728 int code; /* UCS code point */
35729 int n_code;
35730
35731 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35732 mem_base = xmlMemBlocks();
35733 code = gen_int(n_code, 0);
35734
35735 ret_val = xmlUCSIsCatS(code);
35736 desret_int(ret_val);
35737 call_tests++;
35738 des_int(n_code, code, 0);
35739 xmlResetLastError();
35740 if (mem_base != xmlMemBlocks()) {
35741 printf("Leak of %d blocks found in xmlUCSIsCatS",
35742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035743 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035744 printf(" %d", n_code);
35745 printf("\n");
35746 }
35747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035748 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035749#endif
35750
Daniel Veillard42595322004-11-08 10:52:06 +000035751 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035752}
35753
35754
35755static int
35756test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035757 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035758
35759#ifdef LIBXML_UNICODE_ENABLED
35760 int mem_base;
35761 int ret_val;
35762 int code; /* UCS code point */
35763 int n_code;
35764
35765 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35766 mem_base = xmlMemBlocks();
35767 code = gen_int(n_code, 0);
35768
35769 ret_val = xmlUCSIsCatSc(code);
35770 desret_int(ret_val);
35771 call_tests++;
35772 des_int(n_code, code, 0);
35773 xmlResetLastError();
35774 if (mem_base != xmlMemBlocks()) {
35775 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035777 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035778 printf(" %d", n_code);
35779 printf("\n");
35780 }
35781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035782 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035783#endif
35784
Daniel Veillard42595322004-11-08 10:52:06 +000035785 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035786}
35787
35788
35789static int
35790test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035791 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035792
35793#ifdef LIBXML_UNICODE_ENABLED
35794 int mem_base;
35795 int ret_val;
35796 int code; /* UCS code point */
35797 int n_code;
35798
35799 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35800 mem_base = xmlMemBlocks();
35801 code = gen_int(n_code, 0);
35802
35803 ret_val = xmlUCSIsCatSk(code);
35804 desret_int(ret_val);
35805 call_tests++;
35806 des_int(n_code, code, 0);
35807 xmlResetLastError();
35808 if (mem_base != xmlMemBlocks()) {
35809 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035811 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035812 printf(" %d", n_code);
35813 printf("\n");
35814 }
35815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035816 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035817#endif
35818
Daniel Veillard42595322004-11-08 10:52:06 +000035819 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035820}
35821
35822
35823static int
35824test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035825 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035826
35827#ifdef LIBXML_UNICODE_ENABLED
35828 int mem_base;
35829 int ret_val;
35830 int code; /* UCS code point */
35831 int n_code;
35832
35833 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35834 mem_base = xmlMemBlocks();
35835 code = gen_int(n_code, 0);
35836
35837 ret_val = xmlUCSIsCatSm(code);
35838 desret_int(ret_val);
35839 call_tests++;
35840 des_int(n_code, code, 0);
35841 xmlResetLastError();
35842 if (mem_base != xmlMemBlocks()) {
35843 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035845 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035846 printf(" %d", n_code);
35847 printf("\n");
35848 }
35849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035850 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035851#endif
35852
Daniel Veillard42595322004-11-08 10:52:06 +000035853 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035854}
35855
35856
35857static int
35858test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035859 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035860
35861#ifdef LIBXML_UNICODE_ENABLED
35862 int mem_base;
35863 int ret_val;
35864 int code; /* UCS code point */
35865 int n_code;
35866
35867 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35868 mem_base = xmlMemBlocks();
35869 code = gen_int(n_code, 0);
35870
35871 ret_val = xmlUCSIsCatSo(code);
35872 desret_int(ret_val);
35873 call_tests++;
35874 des_int(n_code, code, 0);
35875 xmlResetLastError();
35876 if (mem_base != xmlMemBlocks()) {
35877 printf("Leak of %d blocks found in xmlUCSIsCatSo",
35878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035879 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035880 printf(" %d", n_code);
35881 printf("\n");
35882 }
35883 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035884 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035885#endif
35886
Daniel Veillard42595322004-11-08 10:52:06 +000035887 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035888}
35889
35890
35891static int
35892test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035893 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035894
35895#ifdef LIBXML_UNICODE_ENABLED
35896 int mem_base;
35897 int ret_val;
35898 int code; /* UCS code point */
35899 int n_code;
35900
35901 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35902 mem_base = xmlMemBlocks();
35903 code = gen_int(n_code, 0);
35904
35905 ret_val = xmlUCSIsCatZ(code);
35906 desret_int(ret_val);
35907 call_tests++;
35908 des_int(n_code, code, 0);
35909 xmlResetLastError();
35910 if (mem_base != xmlMemBlocks()) {
35911 printf("Leak of %d blocks found in xmlUCSIsCatZ",
35912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035913 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035914 printf(" %d", n_code);
35915 printf("\n");
35916 }
35917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035918 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035919#endif
35920
Daniel Veillard42595322004-11-08 10:52:06 +000035921 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035922}
35923
35924
35925static int
35926test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035927 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035928
35929#ifdef LIBXML_UNICODE_ENABLED
35930 int mem_base;
35931 int ret_val;
35932 int code; /* UCS code point */
35933 int n_code;
35934
35935 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35936 mem_base = xmlMemBlocks();
35937 code = gen_int(n_code, 0);
35938
35939 ret_val = xmlUCSIsCatZl(code);
35940 desret_int(ret_val);
35941 call_tests++;
35942 des_int(n_code, code, 0);
35943 xmlResetLastError();
35944 if (mem_base != xmlMemBlocks()) {
35945 printf("Leak of %d blocks found in xmlUCSIsCatZl",
35946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035947 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035948 printf(" %d", n_code);
35949 printf("\n");
35950 }
35951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035952 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035953#endif
35954
Daniel Veillard42595322004-11-08 10:52:06 +000035955 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035956}
35957
35958
35959static int
35960test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035961 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035962
35963#ifdef LIBXML_UNICODE_ENABLED
35964 int mem_base;
35965 int ret_val;
35966 int code; /* UCS code point */
35967 int n_code;
35968
35969 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35970 mem_base = xmlMemBlocks();
35971 code = gen_int(n_code, 0);
35972
35973 ret_val = xmlUCSIsCatZp(code);
35974 desret_int(ret_val);
35975 call_tests++;
35976 des_int(n_code, code, 0);
35977 xmlResetLastError();
35978 if (mem_base != xmlMemBlocks()) {
35979 printf("Leak of %d blocks found in xmlUCSIsCatZp",
35980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035981 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035982 printf(" %d", n_code);
35983 printf("\n");
35984 }
35985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035986 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035987#endif
35988
Daniel Veillard42595322004-11-08 10:52:06 +000035989 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035990}
35991
35992
35993static int
35994test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035995 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035996
35997#ifdef LIBXML_UNICODE_ENABLED
35998 int mem_base;
35999 int ret_val;
36000 int code; /* UCS code point */
36001 int n_code;
36002
36003 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36004 mem_base = xmlMemBlocks();
36005 code = gen_int(n_code, 0);
36006
36007 ret_val = xmlUCSIsCatZs(code);
36008 desret_int(ret_val);
36009 call_tests++;
36010 des_int(n_code, code, 0);
36011 xmlResetLastError();
36012 if (mem_base != xmlMemBlocks()) {
36013 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036015 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036016 printf(" %d", n_code);
36017 printf("\n");
36018 }
36019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036020 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036021#endif
36022
Daniel Veillard42595322004-11-08 10:52:06 +000036023 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036024}
36025
36026
36027static int
36028test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036029 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036030
36031#ifdef LIBXML_UNICODE_ENABLED
36032 int mem_base;
36033 int ret_val;
36034 int code; /* UCS code point */
36035 int n_code;
36036
36037 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36038 mem_base = xmlMemBlocks();
36039 code = gen_int(n_code, 0);
36040
36041 ret_val = xmlUCSIsCherokee(code);
36042 desret_int(ret_val);
36043 call_tests++;
36044 des_int(n_code, code, 0);
36045 xmlResetLastError();
36046 if (mem_base != xmlMemBlocks()) {
36047 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036049 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036050 printf(" %d", n_code);
36051 printf("\n");
36052 }
36053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036054 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036055#endif
36056
Daniel Veillard42595322004-11-08 10:52:06 +000036057 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036058}
36059
36060
36061static int
36062test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036063 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036064
36065#ifdef LIBXML_UNICODE_ENABLED
36066 int mem_base;
36067 int ret_val;
36068 int code; /* UCS code point */
36069 int n_code;
36070
36071 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36072 mem_base = xmlMemBlocks();
36073 code = gen_int(n_code, 0);
36074
36075 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36076 desret_int(ret_val);
36077 call_tests++;
36078 des_int(n_code, code, 0);
36079 xmlResetLastError();
36080 if (mem_base != xmlMemBlocks()) {
36081 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036083 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036084 printf(" %d", n_code);
36085 printf("\n");
36086 }
36087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036088 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036089#endif
36090
Daniel Veillard42595322004-11-08 10:52:06 +000036091 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036092}
36093
36094
36095static int
36096test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036097 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036098
36099#ifdef LIBXML_UNICODE_ENABLED
36100 int mem_base;
36101 int ret_val;
36102 int code; /* UCS code point */
36103 int n_code;
36104
36105 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36106 mem_base = xmlMemBlocks();
36107 code = gen_int(n_code, 0);
36108
36109 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36110 desret_int(ret_val);
36111 call_tests++;
36112 des_int(n_code, code, 0);
36113 xmlResetLastError();
36114 if (mem_base != xmlMemBlocks()) {
36115 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036117 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036118 printf(" %d", n_code);
36119 printf("\n");
36120 }
36121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036122 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036123#endif
36124
Daniel Veillard42595322004-11-08 10:52:06 +000036125 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036126}
36127
36128
36129static int
36130test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036131 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036132
36133#ifdef LIBXML_UNICODE_ENABLED
36134 int mem_base;
36135 int ret_val;
36136 int code; /* UCS code point */
36137 int n_code;
36138
36139 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36140 mem_base = xmlMemBlocks();
36141 code = gen_int(n_code, 0);
36142
36143 ret_val = xmlUCSIsCombiningHalfMarks(code);
36144 desret_int(ret_val);
36145 call_tests++;
36146 des_int(n_code, code, 0);
36147 xmlResetLastError();
36148 if (mem_base != xmlMemBlocks()) {
36149 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036151 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036152 printf(" %d", n_code);
36153 printf("\n");
36154 }
36155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036156 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036157#endif
36158
Daniel Veillard42595322004-11-08 10:52:06 +000036159 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036160}
36161
36162
36163static int
36164test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036165 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036166
36167#ifdef LIBXML_UNICODE_ENABLED
36168 int mem_base;
36169 int ret_val;
36170 int code; /* UCS code point */
36171 int n_code;
36172
36173 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36174 mem_base = xmlMemBlocks();
36175 code = gen_int(n_code, 0);
36176
36177 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36178 desret_int(ret_val);
36179 call_tests++;
36180 des_int(n_code, code, 0);
36181 xmlResetLastError();
36182 if (mem_base != xmlMemBlocks()) {
36183 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036185 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036186 printf(" %d", n_code);
36187 printf("\n");
36188 }
36189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036190 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036191#endif
36192
Daniel Veillard42595322004-11-08 10:52:06 +000036193 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036194}
36195
36196
36197static int
36198test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036199 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036200
36201#ifdef LIBXML_UNICODE_ENABLED
36202 int mem_base;
36203 int ret_val;
36204 int code; /* UCS code point */
36205 int n_code;
36206
36207 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36208 mem_base = xmlMemBlocks();
36209 code = gen_int(n_code, 0);
36210
36211 ret_val = xmlUCSIsControlPictures(code);
36212 desret_int(ret_val);
36213 call_tests++;
36214 des_int(n_code, code, 0);
36215 xmlResetLastError();
36216 if (mem_base != xmlMemBlocks()) {
36217 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036219 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036220 printf(" %d", n_code);
36221 printf("\n");
36222 }
36223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036224 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036225#endif
36226
Daniel Veillard42595322004-11-08 10:52:06 +000036227 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036228}
36229
36230
36231static int
36232test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036233 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036234
36235#ifdef LIBXML_UNICODE_ENABLED
36236 int mem_base;
36237 int ret_val;
36238 int code; /* UCS code point */
36239 int n_code;
36240
36241 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36242 mem_base = xmlMemBlocks();
36243 code = gen_int(n_code, 0);
36244
36245 ret_val = xmlUCSIsCurrencySymbols(code);
36246 desret_int(ret_val);
36247 call_tests++;
36248 des_int(n_code, code, 0);
36249 xmlResetLastError();
36250 if (mem_base != xmlMemBlocks()) {
36251 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036253 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036254 printf(" %d", n_code);
36255 printf("\n");
36256 }
36257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036258 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036259#endif
36260
Daniel Veillard42595322004-11-08 10:52:06 +000036261 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036262}
36263
36264
36265static int
36266test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036267 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036268
36269#ifdef LIBXML_UNICODE_ENABLED
36270 int mem_base;
36271 int ret_val;
36272 int code; /* UCS code point */
36273 int n_code;
36274
36275 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36276 mem_base = xmlMemBlocks();
36277 code = gen_int(n_code, 0);
36278
36279 ret_val = xmlUCSIsCypriotSyllabary(code);
36280 desret_int(ret_val);
36281 call_tests++;
36282 des_int(n_code, code, 0);
36283 xmlResetLastError();
36284 if (mem_base != xmlMemBlocks()) {
36285 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036287 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036288 printf(" %d", n_code);
36289 printf("\n");
36290 }
36291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036292 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036293#endif
36294
Daniel Veillard42595322004-11-08 10:52:06 +000036295 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036296}
36297
36298
36299static int
36300test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036301 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036302
36303#ifdef LIBXML_UNICODE_ENABLED
36304 int mem_base;
36305 int ret_val;
36306 int code; /* UCS code point */
36307 int n_code;
36308
36309 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36310 mem_base = xmlMemBlocks();
36311 code = gen_int(n_code, 0);
36312
36313 ret_val = xmlUCSIsCyrillic(code);
36314 desret_int(ret_val);
36315 call_tests++;
36316 des_int(n_code, code, 0);
36317 xmlResetLastError();
36318 if (mem_base != xmlMemBlocks()) {
36319 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036321 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036322 printf(" %d", n_code);
36323 printf("\n");
36324 }
36325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036326 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036327#endif
36328
Daniel Veillard42595322004-11-08 10:52:06 +000036329 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036330}
36331
36332
36333static int
36334test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036335 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036336
36337#ifdef LIBXML_UNICODE_ENABLED
36338 int mem_base;
36339 int ret_val;
36340 int code; /* UCS code point */
36341 int n_code;
36342
36343 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36344 mem_base = xmlMemBlocks();
36345 code = gen_int(n_code, 0);
36346
36347 ret_val = xmlUCSIsCyrillicSupplement(code);
36348 desret_int(ret_val);
36349 call_tests++;
36350 des_int(n_code, code, 0);
36351 xmlResetLastError();
36352 if (mem_base != xmlMemBlocks()) {
36353 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036355 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036356 printf(" %d", n_code);
36357 printf("\n");
36358 }
36359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036360 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036361#endif
36362
Daniel Veillard42595322004-11-08 10:52:06 +000036363 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036364}
36365
36366
36367static int
36368test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036369 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036370
36371#ifdef LIBXML_UNICODE_ENABLED
36372 int mem_base;
36373 int ret_val;
36374 int code; /* UCS code point */
36375 int n_code;
36376
36377 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36378 mem_base = xmlMemBlocks();
36379 code = gen_int(n_code, 0);
36380
36381 ret_val = xmlUCSIsDeseret(code);
36382 desret_int(ret_val);
36383 call_tests++;
36384 des_int(n_code, code, 0);
36385 xmlResetLastError();
36386 if (mem_base != xmlMemBlocks()) {
36387 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036389 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036390 printf(" %d", n_code);
36391 printf("\n");
36392 }
36393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036394 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036395#endif
36396
Daniel Veillard42595322004-11-08 10:52:06 +000036397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036398}
36399
36400
36401static int
36402test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036404
36405#ifdef LIBXML_UNICODE_ENABLED
36406 int mem_base;
36407 int ret_val;
36408 int code; /* UCS code point */
36409 int n_code;
36410
36411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36412 mem_base = xmlMemBlocks();
36413 code = gen_int(n_code, 0);
36414
36415 ret_val = xmlUCSIsDevanagari(code);
36416 desret_int(ret_val);
36417 call_tests++;
36418 des_int(n_code, code, 0);
36419 xmlResetLastError();
36420 if (mem_base != xmlMemBlocks()) {
36421 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036424 printf(" %d", n_code);
36425 printf("\n");
36426 }
36427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036428 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036429#endif
36430
Daniel Veillard42595322004-11-08 10:52:06 +000036431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036432}
36433
36434
36435static int
36436test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036438
36439#ifdef LIBXML_UNICODE_ENABLED
36440 int mem_base;
36441 int ret_val;
36442 int code; /* UCS code point */
36443 int n_code;
36444
36445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36446 mem_base = xmlMemBlocks();
36447 code = gen_int(n_code, 0);
36448
36449 ret_val = xmlUCSIsDingbats(code);
36450 desret_int(ret_val);
36451 call_tests++;
36452 des_int(n_code, code, 0);
36453 xmlResetLastError();
36454 if (mem_base != xmlMemBlocks()) {
36455 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036458 printf(" %d", n_code);
36459 printf("\n");
36460 }
36461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036463#endif
36464
Daniel Veillard42595322004-11-08 10:52:06 +000036465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036466}
36467
36468
36469static int
36470test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036472
36473#ifdef LIBXML_UNICODE_ENABLED
36474 int mem_base;
36475 int ret_val;
36476 int code; /* UCS code point */
36477 int n_code;
36478
36479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36480 mem_base = xmlMemBlocks();
36481 code = gen_int(n_code, 0);
36482
36483 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36484 desret_int(ret_val);
36485 call_tests++;
36486 des_int(n_code, code, 0);
36487 xmlResetLastError();
36488 if (mem_base != xmlMemBlocks()) {
36489 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036492 printf(" %d", n_code);
36493 printf("\n");
36494 }
36495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036497#endif
36498
Daniel Veillard42595322004-11-08 10:52:06 +000036499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036500}
36501
36502
36503static int
36504test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036506
36507#ifdef LIBXML_UNICODE_ENABLED
36508 int mem_base;
36509 int ret_val;
36510 int code; /* UCS code point */
36511 int n_code;
36512
36513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36514 mem_base = xmlMemBlocks();
36515 code = gen_int(n_code, 0);
36516
36517 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36518 desret_int(ret_val);
36519 call_tests++;
36520 des_int(n_code, code, 0);
36521 xmlResetLastError();
36522 if (mem_base != xmlMemBlocks()) {
36523 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036526 printf(" %d", n_code);
36527 printf("\n");
36528 }
36529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036531#endif
36532
Daniel Veillard42595322004-11-08 10:52:06 +000036533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036534}
36535
36536
36537static int
36538test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036540
36541#ifdef LIBXML_UNICODE_ENABLED
36542 int mem_base;
36543 int ret_val;
36544 int code; /* UCS code point */
36545 int n_code;
36546
36547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36548 mem_base = xmlMemBlocks();
36549 code = gen_int(n_code, 0);
36550
36551 ret_val = xmlUCSIsEthiopic(code);
36552 desret_int(ret_val);
36553 call_tests++;
36554 des_int(n_code, code, 0);
36555 xmlResetLastError();
36556 if (mem_base != xmlMemBlocks()) {
36557 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036560 printf(" %d", n_code);
36561 printf("\n");
36562 }
36563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036565#endif
36566
Daniel Veillard42595322004-11-08 10:52:06 +000036567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036568}
36569
36570
36571static int
36572test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036574
36575#ifdef LIBXML_UNICODE_ENABLED
36576 int mem_base;
36577 int ret_val;
36578 int code; /* UCS code point */
36579 int n_code;
36580
36581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36582 mem_base = xmlMemBlocks();
36583 code = gen_int(n_code, 0);
36584
36585 ret_val = xmlUCSIsGeneralPunctuation(code);
36586 desret_int(ret_val);
36587 call_tests++;
36588 des_int(n_code, code, 0);
36589 xmlResetLastError();
36590 if (mem_base != xmlMemBlocks()) {
36591 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036594 printf(" %d", n_code);
36595 printf("\n");
36596 }
36597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036599#endif
36600
Daniel Veillard42595322004-11-08 10:52:06 +000036601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036602}
36603
36604
36605static int
36606test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036608
36609#ifdef LIBXML_UNICODE_ENABLED
36610 int mem_base;
36611 int ret_val;
36612 int code; /* UCS code point */
36613 int n_code;
36614
36615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36616 mem_base = xmlMemBlocks();
36617 code = gen_int(n_code, 0);
36618
36619 ret_val = xmlUCSIsGeometricShapes(code);
36620 desret_int(ret_val);
36621 call_tests++;
36622 des_int(n_code, code, 0);
36623 xmlResetLastError();
36624 if (mem_base != xmlMemBlocks()) {
36625 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036628 printf(" %d", n_code);
36629 printf("\n");
36630 }
36631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036633#endif
36634
Daniel Veillard42595322004-11-08 10:52:06 +000036635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036636}
36637
36638
36639static int
36640test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036642
36643#ifdef LIBXML_UNICODE_ENABLED
36644 int mem_base;
36645 int ret_val;
36646 int code; /* UCS code point */
36647 int n_code;
36648
36649 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36650 mem_base = xmlMemBlocks();
36651 code = gen_int(n_code, 0);
36652
36653 ret_val = xmlUCSIsGeorgian(code);
36654 desret_int(ret_val);
36655 call_tests++;
36656 des_int(n_code, code, 0);
36657 xmlResetLastError();
36658 if (mem_base != xmlMemBlocks()) {
36659 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036661 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036662 printf(" %d", n_code);
36663 printf("\n");
36664 }
36665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036666 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036667#endif
36668
Daniel Veillard42595322004-11-08 10:52:06 +000036669 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036670}
36671
36672
36673static int
36674test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036675 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036676
36677#ifdef LIBXML_UNICODE_ENABLED
36678 int mem_base;
36679 int ret_val;
36680 int code; /* UCS code point */
36681 int n_code;
36682
36683 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36684 mem_base = xmlMemBlocks();
36685 code = gen_int(n_code, 0);
36686
36687 ret_val = xmlUCSIsGothic(code);
36688 desret_int(ret_val);
36689 call_tests++;
36690 des_int(n_code, code, 0);
36691 xmlResetLastError();
36692 if (mem_base != xmlMemBlocks()) {
36693 printf("Leak of %d blocks found in xmlUCSIsGothic",
36694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036695 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036696 printf(" %d", n_code);
36697 printf("\n");
36698 }
36699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036700 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036701#endif
36702
Daniel Veillard42595322004-11-08 10:52:06 +000036703 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036704}
36705
36706
36707static int
36708test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036709 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036710
36711#ifdef LIBXML_UNICODE_ENABLED
36712 int mem_base;
36713 int ret_val;
36714 int code; /* UCS code point */
36715 int n_code;
36716
36717 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36718 mem_base = xmlMemBlocks();
36719 code = gen_int(n_code, 0);
36720
36721 ret_val = xmlUCSIsGreek(code);
36722 desret_int(ret_val);
36723 call_tests++;
36724 des_int(n_code, code, 0);
36725 xmlResetLastError();
36726 if (mem_base != xmlMemBlocks()) {
36727 printf("Leak of %d blocks found in xmlUCSIsGreek",
36728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036729 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036730 printf(" %d", n_code);
36731 printf("\n");
36732 }
36733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036734 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036735#endif
36736
Daniel Veillard42595322004-11-08 10:52:06 +000036737 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036738}
36739
36740
36741static int
36742test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036743 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036744
36745#ifdef LIBXML_UNICODE_ENABLED
36746 int mem_base;
36747 int ret_val;
36748 int code; /* UCS code point */
36749 int n_code;
36750
36751 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36752 mem_base = xmlMemBlocks();
36753 code = gen_int(n_code, 0);
36754
36755 ret_val = xmlUCSIsGreekExtended(code);
36756 desret_int(ret_val);
36757 call_tests++;
36758 des_int(n_code, code, 0);
36759 xmlResetLastError();
36760 if (mem_base != xmlMemBlocks()) {
36761 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036763 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036764 printf(" %d", n_code);
36765 printf("\n");
36766 }
36767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036768 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036769#endif
36770
Daniel Veillard42595322004-11-08 10:52:06 +000036771 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036772}
36773
36774
36775static int
36776test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036777 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036778
36779#ifdef LIBXML_UNICODE_ENABLED
36780 int mem_base;
36781 int ret_val;
36782 int code; /* UCS code point */
36783 int n_code;
36784
36785 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36786 mem_base = xmlMemBlocks();
36787 code = gen_int(n_code, 0);
36788
36789 ret_val = xmlUCSIsGreekandCoptic(code);
36790 desret_int(ret_val);
36791 call_tests++;
36792 des_int(n_code, code, 0);
36793 xmlResetLastError();
36794 if (mem_base != xmlMemBlocks()) {
36795 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036797 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036798 printf(" %d", n_code);
36799 printf("\n");
36800 }
36801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036802 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036803#endif
36804
Daniel Veillard42595322004-11-08 10:52:06 +000036805 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036806}
36807
36808
36809static int
36810test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036811 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036812
36813#ifdef LIBXML_UNICODE_ENABLED
36814 int mem_base;
36815 int ret_val;
36816 int code; /* UCS code point */
36817 int n_code;
36818
36819 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36820 mem_base = xmlMemBlocks();
36821 code = gen_int(n_code, 0);
36822
36823 ret_val = xmlUCSIsGujarati(code);
36824 desret_int(ret_val);
36825 call_tests++;
36826 des_int(n_code, code, 0);
36827 xmlResetLastError();
36828 if (mem_base != xmlMemBlocks()) {
36829 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036831 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036832 printf(" %d", n_code);
36833 printf("\n");
36834 }
36835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036836 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036837#endif
36838
Daniel Veillard42595322004-11-08 10:52:06 +000036839 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036840}
36841
36842
36843static int
36844test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036845 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036846
36847#ifdef LIBXML_UNICODE_ENABLED
36848 int mem_base;
36849 int ret_val;
36850 int code; /* UCS code point */
36851 int n_code;
36852
36853 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36854 mem_base = xmlMemBlocks();
36855 code = gen_int(n_code, 0);
36856
36857 ret_val = xmlUCSIsGurmukhi(code);
36858 desret_int(ret_val);
36859 call_tests++;
36860 des_int(n_code, code, 0);
36861 xmlResetLastError();
36862 if (mem_base != xmlMemBlocks()) {
36863 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
36864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036865 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036866 printf(" %d", n_code);
36867 printf("\n");
36868 }
36869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036870 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036871#endif
36872
Daniel Veillard42595322004-11-08 10:52:06 +000036873 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036874}
36875
36876
36877static int
36878test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036879 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036880
36881#ifdef LIBXML_UNICODE_ENABLED
36882 int mem_base;
36883 int ret_val;
36884 int code; /* UCS code point */
36885 int n_code;
36886
36887 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36888 mem_base = xmlMemBlocks();
36889 code = gen_int(n_code, 0);
36890
36891 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
36892 desret_int(ret_val);
36893 call_tests++;
36894 des_int(n_code, code, 0);
36895 xmlResetLastError();
36896 if (mem_base != xmlMemBlocks()) {
36897 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
36898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036899 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036900 printf(" %d", n_code);
36901 printf("\n");
36902 }
36903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036904 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036905#endif
36906
Daniel Veillard42595322004-11-08 10:52:06 +000036907 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036908}
36909
36910
36911static int
36912test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036913 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036914
36915#ifdef LIBXML_UNICODE_ENABLED
36916 int mem_base;
36917 int ret_val;
36918 int code; /* UCS code point */
36919 int n_code;
36920
36921 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36922 mem_base = xmlMemBlocks();
36923 code = gen_int(n_code, 0);
36924
36925 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
36926 desret_int(ret_val);
36927 call_tests++;
36928 des_int(n_code, code, 0);
36929 xmlResetLastError();
36930 if (mem_base != xmlMemBlocks()) {
36931 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
36932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036933 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036934 printf(" %d", n_code);
36935 printf("\n");
36936 }
36937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036938 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036939#endif
36940
Daniel Veillard42595322004-11-08 10:52:06 +000036941 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036942}
36943
36944
36945static int
36946test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036947 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036948
36949#ifdef LIBXML_UNICODE_ENABLED
36950 int mem_base;
36951 int ret_val;
36952 int code; /* UCS code point */
36953 int n_code;
36954
36955 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36956 mem_base = xmlMemBlocks();
36957 code = gen_int(n_code, 0);
36958
36959 ret_val = xmlUCSIsHangulJamo(code);
36960 desret_int(ret_val);
36961 call_tests++;
36962 des_int(n_code, code, 0);
36963 xmlResetLastError();
36964 if (mem_base != xmlMemBlocks()) {
36965 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
36966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036967 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036968 printf(" %d", n_code);
36969 printf("\n");
36970 }
36971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036972 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036973#endif
36974
Daniel Veillard42595322004-11-08 10:52:06 +000036975 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036976}
36977
36978
36979static int
36980test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036981 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036982
36983#ifdef LIBXML_UNICODE_ENABLED
36984 int mem_base;
36985 int ret_val;
36986 int code; /* UCS code point */
36987 int n_code;
36988
36989 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36990 mem_base = xmlMemBlocks();
36991 code = gen_int(n_code, 0);
36992
36993 ret_val = xmlUCSIsHangulSyllables(code);
36994 desret_int(ret_val);
36995 call_tests++;
36996 des_int(n_code, code, 0);
36997 xmlResetLastError();
36998 if (mem_base != xmlMemBlocks()) {
36999 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037001 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037002 printf(" %d", n_code);
37003 printf("\n");
37004 }
37005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037006 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037007#endif
37008
Daniel Veillard42595322004-11-08 10:52:06 +000037009 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037010}
37011
37012
37013static int
37014test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037015 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037016
37017#ifdef LIBXML_UNICODE_ENABLED
37018 int mem_base;
37019 int ret_val;
37020 int code; /* UCS code point */
37021 int n_code;
37022
37023 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37024 mem_base = xmlMemBlocks();
37025 code = gen_int(n_code, 0);
37026
37027 ret_val = xmlUCSIsHanunoo(code);
37028 desret_int(ret_val);
37029 call_tests++;
37030 des_int(n_code, code, 0);
37031 xmlResetLastError();
37032 if (mem_base != xmlMemBlocks()) {
37033 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037035 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037036 printf(" %d", n_code);
37037 printf("\n");
37038 }
37039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037040 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037041#endif
37042
Daniel Veillard42595322004-11-08 10:52:06 +000037043 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037044}
37045
37046
37047static int
37048test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037049 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037050
37051#ifdef LIBXML_UNICODE_ENABLED
37052 int mem_base;
37053 int ret_val;
37054 int code; /* UCS code point */
37055 int n_code;
37056
37057 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37058 mem_base = xmlMemBlocks();
37059 code = gen_int(n_code, 0);
37060
37061 ret_val = xmlUCSIsHebrew(code);
37062 desret_int(ret_val);
37063 call_tests++;
37064 des_int(n_code, code, 0);
37065 xmlResetLastError();
37066 if (mem_base != xmlMemBlocks()) {
37067 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037069 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037070 printf(" %d", n_code);
37071 printf("\n");
37072 }
37073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037074 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037075#endif
37076
Daniel Veillard42595322004-11-08 10:52:06 +000037077 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037078}
37079
37080
37081static int
37082test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037083 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037084
37085#ifdef LIBXML_UNICODE_ENABLED
37086 int mem_base;
37087 int ret_val;
37088 int code; /* UCS code point */
37089 int n_code;
37090
37091 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37092 mem_base = xmlMemBlocks();
37093 code = gen_int(n_code, 0);
37094
37095 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37096 desret_int(ret_val);
37097 call_tests++;
37098 des_int(n_code, code, 0);
37099 xmlResetLastError();
37100 if (mem_base != xmlMemBlocks()) {
37101 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037103 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037104 printf(" %d", n_code);
37105 printf("\n");
37106 }
37107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037108 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037109#endif
37110
Daniel Veillard42595322004-11-08 10:52:06 +000037111 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037112}
37113
37114
37115static int
37116test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037117 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037118
37119#ifdef LIBXML_UNICODE_ENABLED
37120 int mem_base;
37121 int ret_val;
37122 int code; /* UCS code point */
37123 int n_code;
37124
37125 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37126 mem_base = xmlMemBlocks();
37127 code = gen_int(n_code, 0);
37128
37129 ret_val = xmlUCSIsHighSurrogates(code);
37130 desret_int(ret_val);
37131 call_tests++;
37132 des_int(n_code, code, 0);
37133 xmlResetLastError();
37134 if (mem_base != xmlMemBlocks()) {
37135 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037137 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037138 printf(" %d", n_code);
37139 printf("\n");
37140 }
37141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037142 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037143#endif
37144
Daniel Veillard42595322004-11-08 10:52:06 +000037145 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037146}
37147
37148
37149static int
37150test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037151 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037152
37153#ifdef LIBXML_UNICODE_ENABLED
37154 int mem_base;
37155 int ret_val;
37156 int code; /* UCS code point */
37157 int n_code;
37158
37159 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37160 mem_base = xmlMemBlocks();
37161 code = gen_int(n_code, 0);
37162
37163 ret_val = xmlUCSIsHiragana(code);
37164 desret_int(ret_val);
37165 call_tests++;
37166 des_int(n_code, code, 0);
37167 xmlResetLastError();
37168 if (mem_base != xmlMemBlocks()) {
37169 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037171 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037172 printf(" %d", n_code);
37173 printf("\n");
37174 }
37175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037176 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037177#endif
37178
Daniel Veillard42595322004-11-08 10:52:06 +000037179 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037180}
37181
37182
37183static int
37184test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037185 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037186
37187#ifdef LIBXML_UNICODE_ENABLED
37188 int mem_base;
37189 int ret_val;
37190 int code; /* UCS code point */
37191 int n_code;
37192
37193 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37194 mem_base = xmlMemBlocks();
37195 code = gen_int(n_code, 0);
37196
37197 ret_val = xmlUCSIsIPAExtensions(code);
37198 desret_int(ret_val);
37199 call_tests++;
37200 des_int(n_code, code, 0);
37201 xmlResetLastError();
37202 if (mem_base != xmlMemBlocks()) {
37203 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037205 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037206 printf(" %d", n_code);
37207 printf("\n");
37208 }
37209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037210 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037211#endif
37212
Daniel Veillard42595322004-11-08 10:52:06 +000037213 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037214}
37215
37216
37217static int
37218test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037219 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037220
37221#ifdef LIBXML_UNICODE_ENABLED
37222 int mem_base;
37223 int ret_val;
37224 int code; /* UCS code point */
37225 int n_code;
37226
37227 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37228 mem_base = xmlMemBlocks();
37229 code = gen_int(n_code, 0);
37230
37231 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37232 desret_int(ret_val);
37233 call_tests++;
37234 des_int(n_code, code, 0);
37235 xmlResetLastError();
37236 if (mem_base != xmlMemBlocks()) {
37237 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037239 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037240 printf(" %d", n_code);
37241 printf("\n");
37242 }
37243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037244 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037245#endif
37246
Daniel Veillard42595322004-11-08 10:52:06 +000037247 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037248}
37249
37250
37251static int
37252test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037253 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037254
37255#ifdef LIBXML_UNICODE_ENABLED
37256 int mem_base;
37257 int ret_val;
37258 int code; /* UCS code point */
37259 int n_code;
37260
37261 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37262 mem_base = xmlMemBlocks();
37263 code = gen_int(n_code, 0);
37264
37265 ret_val = xmlUCSIsKanbun(code);
37266 desret_int(ret_val);
37267 call_tests++;
37268 des_int(n_code, code, 0);
37269 xmlResetLastError();
37270 if (mem_base != xmlMemBlocks()) {
37271 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037273 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037274 printf(" %d", n_code);
37275 printf("\n");
37276 }
37277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037278 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037279#endif
37280
Daniel Veillard42595322004-11-08 10:52:06 +000037281 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037282}
37283
37284
37285static int
37286test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037287 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037288
37289#ifdef LIBXML_UNICODE_ENABLED
37290 int mem_base;
37291 int ret_val;
37292 int code; /* UCS code point */
37293 int n_code;
37294
37295 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37296 mem_base = xmlMemBlocks();
37297 code = gen_int(n_code, 0);
37298
37299 ret_val = xmlUCSIsKangxiRadicals(code);
37300 desret_int(ret_val);
37301 call_tests++;
37302 des_int(n_code, code, 0);
37303 xmlResetLastError();
37304 if (mem_base != xmlMemBlocks()) {
37305 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037307 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037308 printf(" %d", n_code);
37309 printf("\n");
37310 }
37311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037312 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037313#endif
37314
Daniel Veillard42595322004-11-08 10:52:06 +000037315 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037316}
37317
37318
37319static int
37320test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037321 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037322
37323#ifdef LIBXML_UNICODE_ENABLED
37324 int mem_base;
37325 int ret_val;
37326 int code; /* UCS code point */
37327 int n_code;
37328
37329 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37330 mem_base = xmlMemBlocks();
37331 code = gen_int(n_code, 0);
37332
37333 ret_val = xmlUCSIsKannada(code);
37334 desret_int(ret_val);
37335 call_tests++;
37336 des_int(n_code, code, 0);
37337 xmlResetLastError();
37338 if (mem_base != xmlMemBlocks()) {
37339 printf("Leak of %d blocks found in xmlUCSIsKannada",
37340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037341 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037342 printf(" %d", n_code);
37343 printf("\n");
37344 }
37345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037346 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037347#endif
37348
Daniel Veillard42595322004-11-08 10:52:06 +000037349 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037350}
37351
37352
37353static int
37354test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037355 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037356
37357#ifdef LIBXML_UNICODE_ENABLED
37358 int mem_base;
37359 int ret_val;
37360 int code; /* UCS code point */
37361 int n_code;
37362
37363 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37364 mem_base = xmlMemBlocks();
37365 code = gen_int(n_code, 0);
37366
37367 ret_val = xmlUCSIsKatakana(code);
37368 desret_int(ret_val);
37369 call_tests++;
37370 des_int(n_code, code, 0);
37371 xmlResetLastError();
37372 if (mem_base != xmlMemBlocks()) {
37373 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037375 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037376 printf(" %d", n_code);
37377 printf("\n");
37378 }
37379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037380 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037381#endif
37382
Daniel Veillard42595322004-11-08 10:52:06 +000037383 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037384}
37385
37386
37387static int
37388test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037389 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037390
37391#ifdef LIBXML_UNICODE_ENABLED
37392 int mem_base;
37393 int ret_val;
37394 int code; /* UCS code point */
37395 int n_code;
37396
37397 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37398 mem_base = xmlMemBlocks();
37399 code = gen_int(n_code, 0);
37400
37401 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37402 desret_int(ret_val);
37403 call_tests++;
37404 des_int(n_code, code, 0);
37405 xmlResetLastError();
37406 if (mem_base != xmlMemBlocks()) {
37407 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037409 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037410 printf(" %d", n_code);
37411 printf("\n");
37412 }
37413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037414 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037415#endif
37416
Daniel Veillard42595322004-11-08 10:52:06 +000037417 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037418}
37419
37420
37421static int
37422test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037423 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037424
37425#ifdef LIBXML_UNICODE_ENABLED
37426 int mem_base;
37427 int ret_val;
37428 int code; /* UCS code point */
37429 int n_code;
37430
37431 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37432 mem_base = xmlMemBlocks();
37433 code = gen_int(n_code, 0);
37434
37435 ret_val = xmlUCSIsKhmer(code);
37436 desret_int(ret_val);
37437 call_tests++;
37438 des_int(n_code, code, 0);
37439 xmlResetLastError();
37440 if (mem_base != xmlMemBlocks()) {
37441 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037443 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037444 printf(" %d", n_code);
37445 printf("\n");
37446 }
37447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037448 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037449#endif
37450
Daniel Veillard42595322004-11-08 10:52:06 +000037451 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037452}
37453
37454
37455static int
37456test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037457 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037458
37459#ifdef LIBXML_UNICODE_ENABLED
37460 int mem_base;
37461 int ret_val;
37462 int code; /* UCS code point */
37463 int n_code;
37464
37465 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37466 mem_base = xmlMemBlocks();
37467 code = gen_int(n_code, 0);
37468
37469 ret_val = xmlUCSIsKhmerSymbols(code);
37470 desret_int(ret_val);
37471 call_tests++;
37472 des_int(n_code, code, 0);
37473 xmlResetLastError();
37474 if (mem_base != xmlMemBlocks()) {
37475 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037477 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037478 printf(" %d", n_code);
37479 printf("\n");
37480 }
37481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037482 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037483#endif
37484
Daniel Veillard42595322004-11-08 10:52:06 +000037485 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037486}
37487
37488
37489static int
37490test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037491 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037492
37493#ifdef LIBXML_UNICODE_ENABLED
37494 int mem_base;
37495 int ret_val;
37496 int code; /* UCS code point */
37497 int n_code;
37498
37499 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37500 mem_base = xmlMemBlocks();
37501 code = gen_int(n_code, 0);
37502
37503 ret_val = xmlUCSIsLao(code);
37504 desret_int(ret_val);
37505 call_tests++;
37506 des_int(n_code, code, 0);
37507 xmlResetLastError();
37508 if (mem_base != xmlMemBlocks()) {
37509 printf("Leak of %d blocks found in xmlUCSIsLao",
37510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037511 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037512 printf(" %d", n_code);
37513 printf("\n");
37514 }
37515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037516 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037517#endif
37518
Daniel Veillard42595322004-11-08 10:52:06 +000037519 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037520}
37521
37522
37523static int
37524test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037525 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037526
37527#ifdef LIBXML_UNICODE_ENABLED
37528 int mem_base;
37529 int ret_val;
37530 int code; /* UCS code point */
37531 int n_code;
37532
37533 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37534 mem_base = xmlMemBlocks();
37535 code = gen_int(n_code, 0);
37536
37537 ret_val = xmlUCSIsLatin1Supplement(code);
37538 desret_int(ret_val);
37539 call_tests++;
37540 des_int(n_code, code, 0);
37541 xmlResetLastError();
37542 if (mem_base != xmlMemBlocks()) {
37543 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037545 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037546 printf(" %d", n_code);
37547 printf("\n");
37548 }
37549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037550 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037551#endif
37552
Daniel Veillard42595322004-11-08 10:52:06 +000037553 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037554}
37555
37556
37557static int
37558test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037559 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037560
37561#ifdef LIBXML_UNICODE_ENABLED
37562 int mem_base;
37563 int ret_val;
37564 int code; /* UCS code point */
37565 int n_code;
37566
37567 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37568 mem_base = xmlMemBlocks();
37569 code = gen_int(n_code, 0);
37570
37571 ret_val = xmlUCSIsLatinExtendedA(code);
37572 desret_int(ret_val);
37573 call_tests++;
37574 des_int(n_code, code, 0);
37575 xmlResetLastError();
37576 if (mem_base != xmlMemBlocks()) {
37577 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037579 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037580 printf(" %d", n_code);
37581 printf("\n");
37582 }
37583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037584 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037585#endif
37586
Daniel Veillard42595322004-11-08 10:52:06 +000037587 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037588}
37589
37590
37591static int
37592test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037593 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037594
37595#ifdef LIBXML_UNICODE_ENABLED
37596 int mem_base;
37597 int ret_val;
37598 int code; /* UCS code point */
37599 int n_code;
37600
37601 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37602 mem_base = xmlMemBlocks();
37603 code = gen_int(n_code, 0);
37604
37605 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37606 desret_int(ret_val);
37607 call_tests++;
37608 des_int(n_code, code, 0);
37609 xmlResetLastError();
37610 if (mem_base != xmlMemBlocks()) {
37611 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037613 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037614 printf(" %d", n_code);
37615 printf("\n");
37616 }
37617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037618 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037619#endif
37620
Daniel Veillard42595322004-11-08 10:52:06 +000037621 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037622}
37623
37624
37625static int
37626test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037627 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037628
37629#ifdef LIBXML_UNICODE_ENABLED
37630 int mem_base;
37631 int ret_val;
37632 int code; /* UCS code point */
37633 int n_code;
37634
37635 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37636 mem_base = xmlMemBlocks();
37637 code = gen_int(n_code, 0);
37638
37639 ret_val = xmlUCSIsLatinExtendedB(code);
37640 desret_int(ret_val);
37641 call_tests++;
37642 des_int(n_code, code, 0);
37643 xmlResetLastError();
37644 if (mem_base != xmlMemBlocks()) {
37645 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037647 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037648 printf(" %d", n_code);
37649 printf("\n");
37650 }
37651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037652 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037653#endif
37654
Daniel Veillard42595322004-11-08 10:52:06 +000037655 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037656}
37657
37658
37659static int
37660test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037661 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037662
37663#ifdef LIBXML_UNICODE_ENABLED
37664 int mem_base;
37665 int ret_val;
37666 int code; /* UCS code point */
37667 int n_code;
37668
37669 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37670 mem_base = xmlMemBlocks();
37671 code = gen_int(n_code, 0);
37672
37673 ret_val = xmlUCSIsLetterlikeSymbols(code);
37674 desret_int(ret_val);
37675 call_tests++;
37676 des_int(n_code, code, 0);
37677 xmlResetLastError();
37678 if (mem_base != xmlMemBlocks()) {
37679 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037681 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037682 printf(" %d", n_code);
37683 printf("\n");
37684 }
37685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037686 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037687#endif
37688
Daniel Veillard42595322004-11-08 10:52:06 +000037689 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037690}
37691
37692
37693static int
37694test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037695 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037696
37697#ifdef LIBXML_UNICODE_ENABLED
37698 int mem_base;
37699 int ret_val;
37700 int code; /* UCS code point */
37701 int n_code;
37702
37703 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37704 mem_base = xmlMemBlocks();
37705 code = gen_int(n_code, 0);
37706
37707 ret_val = xmlUCSIsLimbu(code);
37708 desret_int(ret_val);
37709 call_tests++;
37710 des_int(n_code, code, 0);
37711 xmlResetLastError();
37712 if (mem_base != xmlMemBlocks()) {
37713 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037715 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037716 printf(" %d", n_code);
37717 printf("\n");
37718 }
37719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037720 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037721#endif
37722
Daniel Veillard42595322004-11-08 10:52:06 +000037723 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037724}
37725
37726
37727static int
37728test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037729 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037730
37731#ifdef LIBXML_UNICODE_ENABLED
37732 int mem_base;
37733 int ret_val;
37734 int code; /* UCS code point */
37735 int n_code;
37736
37737 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37738 mem_base = xmlMemBlocks();
37739 code = gen_int(n_code, 0);
37740
37741 ret_val = xmlUCSIsLinearBIdeograms(code);
37742 desret_int(ret_val);
37743 call_tests++;
37744 des_int(n_code, code, 0);
37745 xmlResetLastError();
37746 if (mem_base != xmlMemBlocks()) {
37747 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037749 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037750 printf(" %d", n_code);
37751 printf("\n");
37752 }
37753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037754 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037755#endif
37756
Daniel Veillard42595322004-11-08 10:52:06 +000037757 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037758}
37759
37760
37761static int
37762test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037763 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037764
37765#ifdef LIBXML_UNICODE_ENABLED
37766 int mem_base;
37767 int ret_val;
37768 int code; /* UCS code point */
37769 int n_code;
37770
37771 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37772 mem_base = xmlMemBlocks();
37773 code = gen_int(n_code, 0);
37774
37775 ret_val = xmlUCSIsLinearBSyllabary(code);
37776 desret_int(ret_val);
37777 call_tests++;
37778 des_int(n_code, code, 0);
37779 xmlResetLastError();
37780 if (mem_base != xmlMemBlocks()) {
37781 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037783 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037784 printf(" %d", n_code);
37785 printf("\n");
37786 }
37787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037788 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037789#endif
37790
Daniel Veillard42595322004-11-08 10:52:06 +000037791 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037792}
37793
37794
37795static int
37796test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037797 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037798
37799#ifdef LIBXML_UNICODE_ENABLED
37800 int mem_base;
37801 int ret_val;
37802 int code; /* UCS code point */
37803 int n_code;
37804
37805 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37806 mem_base = xmlMemBlocks();
37807 code = gen_int(n_code, 0);
37808
37809 ret_val = xmlUCSIsLowSurrogates(code);
37810 desret_int(ret_val);
37811 call_tests++;
37812 des_int(n_code, code, 0);
37813 xmlResetLastError();
37814 if (mem_base != xmlMemBlocks()) {
37815 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037817 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037818 printf(" %d", n_code);
37819 printf("\n");
37820 }
37821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037822 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037823#endif
37824
Daniel Veillard42595322004-11-08 10:52:06 +000037825 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037826}
37827
37828
37829static int
37830test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037831 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037832
37833#ifdef LIBXML_UNICODE_ENABLED
37834 int mem_base;
37835 int ret_val;
37836 int code; /* UCS code point */
37837 int n_code;
37838
37839 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37840 mem_base = xmlMemBlocks();
37841 code = gen_int(n_code, 0);
37842
37843 ret_val = xmlUCSIsMalayalam(code);
37844 desret_int(ret_val);
37845 call_tests++;
37846 des_int(n_code, code, 0);
37847 xmlResetLastError();
37848 if (mem_base != xmlMemBlocks()) {
37849 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
37850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037851 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037852 printf(" %d", n_code);
37853 printf("\n");
37854 }
37855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037856 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037857#endif
37858
Daniel Veillard42595322004-11-08 10:52:06 +000037859 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037860}
37861
37862
37863static int
37864test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037865 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037866
37867#ifdef LIBXML_UNICODE_ENABLED
37868 int mem_base;
37869 int ret_val;
37870 int code; /* UCS code point */
37871 int n_code;
37872
37873 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37874 mem_base = xmlMemBlocks();
37875 code = gen_int(n_code, 0);
37876
37877 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
37878 desret_int(ret_val);
37879 call_tests++;
37880 des_int(n_code, code, 0);
37881 xmlResetLastError();
37882 if (mem_base != xmlMemBlocks()) {
37883 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
37884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037885 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037886 printf(" %d", n_code);
37887 printf("\n");
37888 }
37889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037890 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037891#endif
37892
Daniel Veillard42595322004-11-08 10:52:06 +000037893 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037894}
37895
37896
37897static int
37898test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037899 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037900
37901#ifdef LIBXML_UNICODE_ENABLED
37902 int mem_base;
37903 int ret_val;
37904 int code; /* UCS code point */
37905 int n_code;
37906
37907 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37908 mem_base = xmlMemBlocks();
37909 code = gen_int(n_code, 0);
37910
37911 ret_val = xmlUCSIsMathematicalOperators(code);
37912 desret_int(ret_val);
37913 call_tests++;
37914 des_int(n_code, code, 0);
37915 xmlResetLastError();
37916 if (mem_base != xmlMemBlocks()) {
37917 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
37918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037919 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037920 printf(" %d", n_code);
37921 printf("\n");
37922 }
37923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037924 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037925#endif
37926
Daniel Veillard42595322004-11-08 10:52:06 +000037927 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037928}
37929
37930
37931static int
37932test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037933 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037934
37935#ifdef LIBXML_UNICODE_ENABLED
37936 int mem_base;
37937 int ret_val;
37938 int code; /* UCS code point */
37939 int n_code;
37940
37941 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37942 mem_base = xmlMemBlocks();
37943 code = gen_int(n_code, 0);
37944
37945 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
37946 desret_int(ret_val);
37947 call_tests++;
37948 des_int(n_code, code, 0);
37949 xmlResetLastError();
37950 if (mem_base != xmlMemBlocks()) {
37951 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
37952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037953 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037954 printf(" %d", n_code);
37955 printf("\n");
37956 }
37957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037958 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037959#endif
37960
Daniel Veillard42595322004-11-08 10:52:06 +000037961 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037962}
37963
37964
37965static int
37966test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037967 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037968
37969#ifdef LIBXML_UNICODE_ENABLED
37970 int mem_base;
37971 int ret_val;
37972 int code; /* UCS code point */
37973 int n_code;
37974
37975 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37976 mem_base = xmlMemBlocks();
37977 code = gen_int(n_code, 0);
37978
37979 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
37980 desret_int(ret_val);
37981 call_tests++;
37982 des_int(n_code, code, 0);
37983 xmlResetLastError();
37984 if (mem_base != xmlMemBlocks()) {
37985 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
37986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037987 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037988 printf(" %d", n_code);
37989 printf("\n");
37990 }
37991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037992 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037993#endif
37994
Daniel Veillard42595322004-11-08 10:52:06 +000037995 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037996}
37997
37998
37999static int
38000test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038001 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038002
38003#ifdef LIBXML_UNICODE_ENABLED
38004 int mem_base;
38005 int ret_val;
38006 int code; /* UCS code point */
38007 int n_code;
38008
38009 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38010 mem_base = xmlMemBlocks();
38011 code = gen_int(n_code, 0);
38012
38013 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38014 desret_int(ret_val);
38015 call_tests++;
38016 des_int(n_code, code, 0);
38017 xmlResetLastError();
38018 if (mem_base != xmlMemBlocks()) {
38019 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038021 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038022 printf(" %d", n_code);
38023 printf("\n");
38024 }
38025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038026 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038027#endif
38028
Daniel Veillard42595322004-11-08 10:52:06 +000038029 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038030}
38031
38032
38033static int
38034test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038035 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038036
38037#ifdef LIBXML_UNICODE_ENABLED
38038 int mem_base;
38039 int ret_val;
38040 int code; /* UCS code point */
38041 int n_code;
38042
38043 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38044 mem_base = xmlMemBlocks();
38045 code = gen_int(n_code, 0);
38046
38047 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38048 desret_int(ret_val);
38049 call_tests++;
38050 des_int(n_code, code, 0);
38051 xmlResetLastError();
38052 if (mem_base != xmlMemBlocks()) {
38053 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038055 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038056 printf(" %d", n_code);
38057 printf("\n");
38058 }
38059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038060 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038061#endif
38062
Daniel Veillard42595322004-11-08 10:52:06 +000038063 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038064}
38065
38066
38067static int
38068test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038069 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038070
38071#ifdef LIBXML_UNICODE_ENABLED
38072 int mem_base;
38073 int ret_val;
38074 int code; /* UCS code point */
38075 int n_code;
38076
38077 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38078 mem_base = xmlMemBlocks();
38079 code = gen_int(n_code, 0);
38080
38081 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38082 desret_int(ret_val);
38083 call_tests++;
38084 des_int(n_code, code, 0);
38085 xmlResetLastError();
38086 if (mem_base != xmlMemBlocks()) {
38087 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038089 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038090 printf(" %d", n_code);
38091 printf("\n");
38092 }
38093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038094 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038095#endif
38096
Daniel Veillard42595322004-11-08 10:52:06 +000038097 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038098}
38099
38100
38101static int
38102test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038103 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038104
38105#ifdef LIBXML_UNICODE_ENABLED
38106 int mem_base;
38107 int ret_val;
38108 int code; /* UCS code point */
38109 int n_code;
38110
38111 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38112 mem_base = xmlMemBlocks();
38113 code = gen_int(n_code, 0);
38114
38115 ret_val = xmlUCSIsMongolian(code);
38116 desret_int(ret_val);
38117 call_tests++;
38118 des_int(n_code, code, 0);
38119 xmlResetLastError();
38120 if (mem_base != xmlMemBlocks()) {
38121 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038123 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038124 printf(" %d", n_code);
38125 printf("\n");
38126 }
38127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038128 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038129#endif
38130
Daniel Veillard42595322004-11-08 10:52:06 +000038131 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038132}
38133
38134
38135static int
38136test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038137 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038138
38139#ifdef LIBXML_UNICODE_ENABLED
38140 int mem_base;
38141 int ret_val;
38142 int code; /* UCS code point */
38143 int n_code;
38144
38145 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38146 mem_base = xmlMemBlocks();
38147 code = gen_int(n_code, 0);
38148
38149 ret_val = xmlUCSIsMusicalSymbols(code);
38150 desret_int(ret_val);
38151 call_tests++;
38152 des_int(n_code, code, 0);
38153 xmlResetLastError();
38154 if (mem_base != xmlMemBlocks()) {
38155 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038157 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038158 printf(" %d", n_code);
38159 printf("\n");
38160 }
38161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038162 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038163#endif
38164
Daniel Veillard42595322004-11-08 10:52:06 +000038165 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038166}
38167
38168
38169static int
38170test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038171 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038172
38173#ifdef LIBXML_UNICODE_ENABLED
38174 int mem_base;
38175 int ret_val;
38176 int code; /* UCS code point */
38177 int n_code;
38178
38179 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38180 mem_base = xmlMemBlocks();
38181 code = gen_int(n_code, 0);
38182
38183 ret_val = xmlUCSIsMyanmar(code);
38184 desret_int(ret_val);
38185 call_tests++;
38186 des_int(n_code, code, 0);
38187 xmlResetLastError();
38188 if (mem_base != xmlMemBlocks()) {
38189 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038191 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038192 printf(" %d", n_code);
38193 printf("\n");
38194 }
38195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038196 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038197#endif
38198
Daniel Veillard42595322004-11-08 10:52:06 +000038199 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038200}
38201
38202
38203static int
38204test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038205 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038206
38207#ifdef LIBXML_UNICODE_ENABLED
38208 int mem_base;
38209 int ret_val;
38210 int code; /* UCS code point */
38211 int n_code;
38212
38213 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38214 mem_base = xmlMemBlocks();
38215 code = gen_int(n_code, 0);
38216
38217 ret_val = xmlUCSIsNumberForms(code);
38218 desret_int(ret_val);
38219 call_tests++;
38220 des_int(n_code, code, 0);
38221 xmlResetLastError();
38222 if (mem_base != xmlMemBlocks()) {
38223 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038225 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038226 printf(" %d", n_code);
38227 printf("\n");
38228 }
38229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038230 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038231#endif
38232
Daniel Veillard42595322004-11-08 10:52:06 +000038233 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038234}
38235
38236
38237static int
38238test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038239 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038240
38241#ifdef LIBXML_UNICODE_ENABLED
38242 int mem_base;
38243 int ret_val;
38244 int code; /* UCS code point */
38245 int n_code;
38246
38247 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38248 mem_base = xmlMemBlocks();
38249 code = gen_int(n_code, 0);
38250
38251 ret_val = xmlUCSIsOgham(code);
38252 desret_int(ret_val);
38253 call_tests++;
38254 des_int(n_code, code, 0);
38255 xmlResetLastError();
38256 if (mem_base != xmlMemBlocks()) {
38257 printf("Leak of %d blocks found in xmlUCSIsOgham",
38258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038259 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038260 printf(" %d", n_code);
38261 printf("\n");
38262 }
38263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038264 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038265#endif
38266
Daniel Veillard42595322004-11-08 10:52:06 +000038267 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038268}
38269
38270
38271static int
38272test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038273 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038274
38275#ifdef LIBXML_UNICODE_ENABLED
38276 int mem_base;
38277 int ret_val;
38278 int code; /* UCS code point */
38279 int n_code;
38280
38281 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38282 mem_base = xmlMemBlocks();
38283 code = gen_int(n_code, 0);
38284
38285 ret_val = xmlUCSIsOldItalic(code);
38286 desret_int(ret_val);
38287 call_tests++;
38288 des_int(n_code, code, 0);
38289 xmlResetLastError();
38290 if (mem_base != xmlMemBlocks()) {
38291 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038293 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038294 printf(" %d", n_code);
38295 printf("\n");
38296 }
38297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038298 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038299#endif
38300
Daniel Veillard42595322004-11-08 10:52:06 +000038301 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038302}
38303
38304
38305static int
38306test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038307 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038308
38309#ifdef LIBXML_UNICODE_ENABLED
38310 int mem_base;
38311 int ret_val;
38312 int code; /* UCS code point */
38313 int n_code;
38314
38315 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38316 mem_base = xmlMemBlocks();
38317 code = gen_int(n_code, 0);
38318
38319 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38320 desret_int(ret_val);
38321 call_tests++;
38322 des_int(n_code, code, 0);
38323 xmlResetLastError();
38324 if (mem_base != xmlMemBlocks()) {
38325 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038327 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038328 printf(" %d", n_code);
38329 printf("\n");
38330 }
38331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038332 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038333#endif
38334
Daniel Veillard42595322004-11-08 10:52:06 +000038335 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038336}
38337
38338
38339static int
38340test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038341 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038342
38343#ifdef LIBXML_UNICODE_ENABLED
38344 int mem_base;
38345 int ret_val;
38346 int code; /* UCS code point */
38347 int n_code;
38348
38349 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38350 mem_base = xmlMemBlocks();
38351 code = gen_int(n_code, 0);
38352
38353 ret_val = xmlUCSIsOriya(code);
38354 desret_int(ret_val);
38355 call_tests++;
38356 des_int(n_code, code, 0);
38357 xmlResetLastError();
38358 if (mem_base != xmlMemBlocks()) {
38359 printf("Leak of %d blocks found in xmlUCSIsOriya",
38360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038361 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038362 printf(" %d", n_code);
38363 printf("\n");
38364 }
38365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038366 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038367#endif
38368
Daniel Veillard42595322004-11-08 10:52:06 +000038369 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038370}
38371
38372
38373static int
38374test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038375 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038376
38377#ifdef LIBXML_UNICODE_ENABLED
38378 int mem_base;
38379 int ret_val;
38380 int code; /* UCS code point */
38381 int n_code;
38382
38383 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38384 mem_base = xmlMemBlocks();
38385 code = gen_int(n_code, 0);
38386
38387 ret_val = xmlUCSIsOsmanya(code);
38388 desret_int(ret_val);
38389 call_tests++;
38390 des_int(n_code, code, 0);
38391 xmlResetLastError();
38392 if (mem_base != xmlMemBlocks()) {
38393 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038395 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038396 printf(" %d", n_code);
38397 printf("\n");
38398 }
38399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038400 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038401#endif
38402
Daniel Veillard42595322004-11-08 10:52:06 +000038403 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038404}
38405
38406
38407static int
38408test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038409 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038410
38411#ifdef LIBXML_UNICODE_ENABLED
38412 int mem_base;
38413 int ret_val;
38414 int code; /* UCS code point */
38415 int n_code;
38416
38417 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38418 mem_base = xmlMemBlocks();
38419 code = gen_int(n_code, 0);
38420
38421 ret_val = xmlUCSIsPhoneticExtensions(code);
38422 desret_int(ret_val);
38423 call_tests++;
38424 des_int(n_code, code, 0);
38425 xmlResetLastError();
38426 if (mem_base != xmlMemBlocks()) {
38427 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038429 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038430 printf(" %d", n_code);
38431 printf("\n");
38432 }
38433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038434 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038435#endif
38436
Daniel Veillard42595322004-11-08 10:52:06 +000038437 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038438}
38439
38440
38441static int
38442test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038443 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038444
38445#ifdef LIBXML_UNICODE_ENABLED
38446 int mem_base;
38447 int ret_val;
38448 int code; /* UCS code point */
38449 int n_code;
38450
38451 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38452 mem_base = xmlMemBlocks();
38453 code = gen_int(n_code, 0);
38454
38455 ret_val = xmlUCSIsPrivateUse(code);
38456 desret_int(ret_val);
38457 call_tests++;
38458 des_int(n_code, code, 0);
38459 xmlResetLastError();
38460 if (mem_base != xmlMemBlocks()) {
38461 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038463 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038464 printf(" %d", n_code);
38465 printf("\n");
38466 }
38467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038468 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038469#endif
38470
Daniel Veillard42595322004-11-08 10:52:06 +000038471 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038472}
38473
38474
38475static int
38476test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038477 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038478
38479#ifdef LIBXML_UNICODE_ENABLED
38480 int mem_base;
38481 int ret_val;
38482 int code; /* UCS code point */
38483 int n_code;
38484
38485 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38486 mem_base = xmlMemBlocks();
38487 code = gen_int(n_code, 0);
38488
38489 ret_val = xmlUCSIsPrivateUseArea(code);
38490 desret_int(ret_val);
38491 call_tests++;
38492 des_int(n_code, code, 0);
38493 xmlResetLastError();
38494 if (mem_base != xmlMemBlocks()) {
38495 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038497 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038498 printf(" %d", n_code);
38499 printf("\n");
38500 }
38501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038502 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038503#endif
38504
Daniel Veillard42595322004-11-08 10:52:06 +000038505 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038506}
38507
38508
38509static int
38510test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038511 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038512
38513#ifdef LIBXML_UNICODE_ENABLED
38514 int mem_base;
38515 int ret_val;
38516 int code; /* UCS code point */
38517 int n_code;
38518
38519 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38520 mem_base = xmlMemBlocks();
38521 code = gen_int(n_code, 0);
38522
38523 ret_val = xmlUCSIsRunic(code);
38524 desret_int(ret_val);
38525 call_tests++;
38526 des_int(n_code, code, 0);
38527 xmlResetLastError();
38528 if (mem_base != xmlMemBlocks()) {
38529 printf("Leak of %d blocks found in xmlUCSIsRunic",
38530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038531 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038532 printf(" %d", n_code);
38533 printf("\n");
38534 }
38535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038536 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038537#endif
38538
Daniel Veillard42595322004-11-08 10:52:06 +000038539 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038540}
38541
38542
38543static int
38544test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038545 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038546
38547#ifdef LIBXML_UNICODE_ENABLED
38548 int mem_base;
38549 int ret_val;
38550 int code; /* UCS code point */
38551 int n_code;
38552
38553 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38554 mem_base = xmlMemBlocks();
38555 code = gen_int(n_code, 0);
38556
38557 ret_val = xmlUCSIsShavian(code);
38558 desret_int(ret_val);
38559 call_tests++;
38560 des_int(n_code, code, 0);
38561 xmlResetLastError();
38562 if (mem_base != xmlMemBlocks()) {
38563 printf("Leak of %d blocks found in xmlUCSIsShavian",
38564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038565 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038566 printf(" %d", n_code);
38567 printf("\n");
38568 }
38569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038570 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038571#endif
38572
Daniel Veillard42595322004-11-08 10:52:06 +000038573 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038574}
38575
38576
38577static int
38578test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038579 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038580
38581#ifdef LIBXML_UNICODE_ENABLED
38582 int mem_base;
38583 int ret_val;
38584 int code; /* UCS code point */
38585 int n_code;
38586
38587 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38588 mem_base = xmlMemBlocks();
38589 code = gen_int(n_code, 0);
38590
38591 ret_val = xmlUCSIsSinhala(code);
38592 desret_int(ret_val);
38593 call_tests++;
38594 des_int(n_code, code, 0);
38595 xmlResetLastError();
38596 if (mem_base != xmlMemBlocks()) {
38597 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038599 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038600 printf(" %d", n_code);
38601 printf("\n");
38602 }
38603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038604 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038605#endif
38606
Daniel Veillard42595322004-11-08 10:52:06 +000038607 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038608}
38609
38610
38611static int
38612test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038613 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038614
38615#ifdef LIBXML_UNICODE_ENABLED
38616 int mem_base;
38617 int ret_val;
38618 int code; /* UCS code point */
38619 int n_code;
38620
38621 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38622 mem_base = xmlMemBlocks();
38623 code = gen_int(n_code, 0);
38624
38625 ret_val = xmlUCSIsSmallFormVariants(code);
38626 desret_int(ret_val);
38627 call_tests++;
38628 des_int(n_code, code, 0);
38629 xmlResetLastError();
38630 if (mem_base != xmlMemBlocks()) {
38631 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038633 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038634 printf(" %d", n_code);
38635 printf("\n");
38636 }
38637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038638 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038639#endif
38640
Daniel Veillard42595322004-11-08 10:52:06 +000038641 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038642}
38643
38644
38645static int
38646test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038647 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038648
38649#ifdef LIBXML_UNICODE_ENABLED
38650 int mem_base;
38651 int ret_val;
38652 int code; /* UCS code point */
38653 int n_code;
38654
38655 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38656 mem_base = xmlMemBlocks();
38657 code = gen_int(n_code, 0);
38658
38659 ret_val = xmlUCSIsSpacingModifierLetters(code);
38660 desret_int(ret_val);
38661 call_tests++;
38662 des_int(n_code, code, 0);
38663 xmlResetLastError();
38664 if (mem_base != xmlMemBlocks()) {
38665 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038667 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038668 printf(" %d", n_code);
38669 printf("\n");
38670 }
38671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038672 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038673#endif
38674
Daniel Veillard42595322004-11-08 10:52:06 +000038675 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038676}
38677
38678
38679static int
38680test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038681 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038682
38683#ifdef LIBXML_UNICODE_ENABLED
38684 int mem_base;
38685 int ret_val;
38686 int code; /* UCS code point */
38687 int n_code;
38688
38689 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38690 mem_base = xmlMemBlocks();
38691 code = gen_int(n_code, 0);
38692
38693 ret_val = xmlUCSIsSpecials(code);
38694 desret_int(ret_val);
38695 call_tests++;
38696 des_int(n_code, code, 0);
38697 xmlResetLastError();
38698 if (mem_base != xmlMemBlocks()) {
38699 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038701 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038702 printf(" %d", n_code);
38703 printf("\n");
38704 }
38705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038706 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038707#endif
38708
Daniel Veillard42595322004-11-08 10:52:06 +000038709 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038710}
38711
38712
38713static int
38714test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038715 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038716
38717#ifdef LIBXML_UNICODE_ENABLED
38718 int mem_base;
38719 int ret_val;
38720 int code; /* UCS code point */
38721 int n_code;
38722
38723 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38724 mem_base = xmlMemBlocks();
38725 code = gen_int(n_code, 0);
38726
38727 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38728 desret_int(ret_val);
38729 call_tests++;
38730 des_int(n_code, code, 0);
38731 xmlResetLastError();
38732 if (mem_base != xmlMemBlocks()) {
38733 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038735 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038736 printf(" %d", n_code);
38737 printf("\n");
38738 }
38739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038740 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038741#endif
38742
Daniel Veillard42595322004-11-08 10:52:06 +000038743 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038744}
38745
38746
38747static int
38748test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038749 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038750
38751#ifdef LIBXML_UNICODE_ENABLED
38752 int mem_base;
38753 int ret_val;
38754 int code; /* UCS code point */
38755 int n_code;
38756
38757 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38758 mem_base = xmlMemBlocks();
38759 code = gen_int(n_code, 0);
38760
38761 ret_val = xmlUCSIsSupplementalArrowsA(code);
38762 desret_int(ret_val);
38763 call_tests++;
38764 des_int(n_code, code, 0);
38765 xmlResetLastError();
38766 if (mem_base != xmlMemBlocks()) {
38767 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038769 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038770 printf(" %d", n_code);
38771 printf("\n");
38772 }
38773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038774 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038775#endif
38776
Daniel Veillard42595322004-11-08 10:52:06 +000038777 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038778}
38779
38780
38781static int
38782test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038783 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038784
38785#ifdef LIBXML_UNICODE_ENABLED
38786 int mem_base;
38787 int ret_val;
38788 int code; /* UCS code point */
38789 int n_code;
38790
38791 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38792 mem_base = xmlMemBlocks();
38793 code = gen_int(n_code, 0);
38794
38795 ret_val = xmlUCSIsSupplementalArrowsB(code);
38796 desret_int(ret_val);
38797 call_tests++;
38798 des_int(n_code, code, 0);
38799 xmlResetLastError();
38800 if (mem_base != xmlMemBlocks()) {
38801 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038803 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038804 printf(" %d", n_code);
38805 printf("\n");
38806 }
38807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038808 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038809#endif
38810
Daniel Veillard42595322004-11-08 10:52:06 +000038811 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038812}
38813
38814
38815static int
38816test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038817 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038818
38819#ifdef LIBXML_UNICODE_ENABLED
38820 int mem_base;
38821 int ret_val;
38822 int code; /* UCS code point */
38823 int n_code;
38824
38825 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38826 mem_base = xmlMemBlocks();
38827 code = gen_int(n_code, 0);
38828
38829 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38830 desret_int(ret_val);
38831 call_tests++;
38832 des_int(n_code, code, 0);
38833 xmlResetLastError();
38834 if (mem_base != xmlMemBlocks()) {
38835 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038837 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038838 printf(" %d", n_code);
38839 printf("\n");
38840 }
38841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038842 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038843#endif
38844
Daniel Veillard42595322004-11-08 10:52:06 +000038845 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038846}
38847
38848
38849static int
38850test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038851 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038852
38853#ifdef LIBXML_UNICODE_ENABLED
38854 int mem_base;
38855 int ret_val;
38856 int code; /* UCS code point */
38857 int n_code;
38858
38859 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38860 mem_base = xmlMemBlocks();
38861 code = gen_int(n_code, 0);
38862
38863 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
38864 desret_int(ret_val);
38865 call_tests++;
38866 des_int(n_code, code, 0);
38867 xmlResetLastError();
38868 if (mem_base != xmlMemBlocks()) {
38869 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
38870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038871 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038872 printf(" %d", n_code);
38873 printf("\n");
38874 }
38875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038876 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038877#endif
38878
Daniel Veillard42595322004-11-08 10:52:06 +000038879 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038880}
38881
38882
38883static int
38884test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038885 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038886
38887#ifdef LIBXML_UNICODE_ENABLED
38888 int mem_base;
38889 int ret_val;
38890 int code; /* UCS code point */
38891 int n_code;
38892
38893 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38894 mem_base = xmlMemBlocks();
38895 code = gen_int(n_code, 0);
38896
38897 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
38898 desret_int(ret_val);
38899 call_tests++;
38900 des_int(n_code, code, 0);
38901 xmlResetLastError();
38902 if (mem_base != xmlMemBlocks()) {
38903 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
38904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038905 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038906 printf(" %d", n_code);
38907 printf("\n");
38908 }
38909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038910 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038911#endif
38912
Daniel Veillard42595322004-11-08 10:52:06 +000038913 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038914}
38915
38916
38917static int
38918test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038919 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038920
38921#ifdef LIBXML_UNICODE_ENABLED
38922 int mem_base;
38923 int ret_val;
38924 int code; /* UCS code point */
38925 int n_code;
38926
38927 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38928 mem_base = xmlMemBlocks();
38929 code = gen_int(n_code, 0);
38930
38931 ret_val = xmlUCSIsSyriac(code);
38932 desret_int(ret_val);
38933 call_tests++;
38934 des_int(n_code, code, 0);
38935 xmlResetLastError();
38936 if (mem_base != xmlMemBlocks()) {
38937 printf("Leak of %d blocks found in xmlUCSIsSyriac",
38938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038939 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038940 printf(" %d", n_code);
38941 printf("\n");
38942 }
38943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038944 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038945#endif
38946
Daniel Veillard42595322004-11-08 10:52:06 +000038947 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038948}
38949
38950
38951static int
38952test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038953 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038954
38955#ifdef LIBXML_UNICODE_ENABLED
38956 int mem_base;
38957 int ret_val;
38958 int code; /* UCS code point */
38959 int n_code;
38960
38961 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38962 mem_base = xmlMemBlocks();
38963 code = gen_int(n_code, 0);
38964
38965 ret_val = xmlUCSIsTagalog(code);
38966 desret_int(ret_val);
38967 call_tests++;
38968 des_int(n_code, code, 0);
38969 xmlResetLastError();
38970 if (mem_base != xmlMemBlocks()) {
38971 printf("Leak of %d blocks found in xmlUCSIsTagalog",
38972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038973 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038974 printf(" %d", n_code);
38975 printf("\n");
38976 }
38977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038978 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038979#endif
38980
Daniel Veillard42595322004-11-08 10:52:06 +000038981 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038982}
38983
38984
38985static int
38986test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038987 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038988
38989#ifdef LIBXML_UNICODE_ENABLED
38990 int mem_base;
38991 int ret_val;
38992 int code; /* UCS code point */
38993 int n_code;
38994
38995 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38996 mem_base = xmlMemBlocks();
38997 code = gen_int(n_code, 0);
38998
38999 ret_val = xmlUCSIsTagbanwa(code);
39000 desret_int(ret_val);
39001 call_tests++;
39002 des_int(n_code, code, 0);
39003 xmlResetLastError();
39004 if (mem_base != xmlMemBlocks()) {
39005 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039007 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039008 printf(" %d", n_code);
39009 printf("\n");
39010 }
39011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039012 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039013#endif
39014
Daniel Veillard42595322004-11-08 10:52:06 +000039015 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039016}
39017
39018
39019static int
39020test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039021 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039022
39023#ifdef LIBXML_UNICODE_ENABLED
39024 int mem_base;
39025 int ret_val;
39026 int code; /* UCS code point */
39027 int n_code;
39028
39029 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39030 mem_base = xmlMemBlocks();
39031 code = gen_int(n_code, 0);
39032
39033 ret_val = xmlUCSIsTags(code);
39034 desret_int(ret_val);
39035 call_tests++;
39036 des_int(n_code, code, 0);
39037 xmlResetLastError();
39038 if (mem_base != xmlMemBlocks()) {
39039 printf("Leak of %d blocks found in xmlUCSIsTags",
39040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039041 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039042 printf(" %d", n_code);
39043 printf("\n");
39044 }
39045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039046 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039047#endif
39048
Daniel Veillard42595322004-11-08 10:52:06 +000039049 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039050}
39051
39052
39053static int
39054test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039055 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039056
39057#ifdef LIBXML_UNICODE_ENABLED
39058 int mem_base;
39059 int ret_val;
39060 int code; /* UCS code point */
39061 int n_code;
39062
39063 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39064 mem_base = xmlMemBlocks();
39065 code = gen_int(n_code, 0);
39066
39067 ret_val = xmlUCSIsTaiLe(code);
39068 desret_int(ret_val);
39069 call_tests++;
39070 des_int(n_code, code, 0);
39071 xmlResetLastError();
39072 if (mem_base != xmlMemBlocks()) {
39073 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039075 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039076 printf(" %d", n_code);
39077 printf("\n");
39078 }
39079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039080 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039081#endif
39082
Daniel Veillard42595322004-11-08 10:52:06 +000039083 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039084}
39085
39086
39087static int
39088test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039089 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039090
39091#ifdef LIBXML_UNICODE_ENABLED
39092 int mem_base;
39093 int ret_val;
39094 int code; /* UCS code point */
39095 int n_code;
39096
39097 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39098 mem_base = xmlMemBlocks();
39099 code = gen_int(n_code, 0);
39100
39101 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39102 desret_int(ret_val);
39103 call_tests++;
39104 des_int(n_code, code, 0);
39105 xmlResetLastError();
39106 if (mem_base != xmlMemBlocks()) {
39107 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039109 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039110 printf(" %d", n_code);
39111 printf("\n");
39112 }
39113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039114 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039115#endif
39116
Daniel Veillard42595322004-11-08 10:52:06 +000039117 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039118}
39119
39120
39121static int
39122test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039123 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039124
39125#ifdef LIBXML_UNICODE_ENABLED
39126 int mem_base;
39127 int ret_val;
39128 int code; /* UCS code point */
39129 int n_code;
39130
39131 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39132 mem_base = xmlMemBlocks();
39133 code = gen_int(n_code, 0);
39134
39135 ret_val = xmlUCSIsTamil(code);
39136 desret_int(ret_val);
39137 call_tests++;
39138 des_int(n_code, code, 0);
39139 xmlResetLastError();
39140 if (mem_base != xmlMemBlocks()) {
39141 printf("Leak of %d blocks found in xmlUCSIsTamil",
39142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039143 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039144 printf(" %d", n_code);
39145 printf("\n");
39146 }
39147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039148 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039149#endif
39150
Daniel Veillard42595322004-11-08 10:52:06 +000039151 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039152}
39153
39154
39155static int
39156test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039157 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039158
39159#ifdef LIBXML_UNICODE_ENABLED
39160 int mem_base;
39161 int ret_val;
39162 int code; /* UCS code point */
39163 int n_code;
39164
39165 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39166 mem_base = xmlMemBlocks();
39167 code = gen_int(n_code, 0);
39168
39169 ret_val = xmlUCSIsTelugu(code);
39170 desret_int(ret_val);
39171 call_tests++;
39172 des_int(n_code, code, 0);
39173 xmlResetLastError();
39174 if (mem_base != xmlMemBlocks()) {
39175 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039177 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039178 printf(" %d", n_code);
39179 printf("\n");
39180 }
39181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039182 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039183#endif
39184
Daniel Veillard42595322004-11-08 10:52:06 +000039185 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039186}
39187
39188
39189static int
39190test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039191 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039192
39193#ifdef LIBXML_UNICODE_ENABLED
39194 int mem_base;
39195 int ret_val;
39196 int code; /* UCS code point */
39197 int n_code;
39198
39199 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39200 mem_base = xmlMemBlocks();
39201 code = gen_int(n_code, 0);
39202
39203 ret_val = xmlUCSIsThaana(code);
39204 desret_int(ret_val);
39205 call_tests++;
39206 des_int(n_code, code, 0);
39207 xmlResetLastError();
39208 if (mem_base != xmlMemBlocks()) {
39209 printf("Leak of %d blocks found in xmlUCSIsThaana",
39210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039211 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039212 printf(" %d", n_code);
39213 printf("\n");
39214 }
39215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039216 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039217#endif
39218
Daniel Veillard42595322004-11-08 10:52:06 +000039219 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039220}
39221
39222
39223static int
39224test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039225 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039226
39227#ifdef LIBXML_UNICODE_ENABLED
39228 int mem_base;
39229 int ret_val;
39230 int code; /* UCS code point */
39231 int n_code;
39232
39233 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39234 mem_base = xmlMemBlocks();
39235 code = gen_int(n_code, 0);
39236
39237 ret_val = xmlUCSIsThai(code);
39238 desret_int(ret_val);
39239 call_tests++;
39240 des_int(n_code, code, 0);
39241 xmlResetLastError();
39242 if (mem_base != xmlMemBlocks()) {
39243 printf("Leak of %d blocks found in xmlUCSIsThai",
39244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039245 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039246 printf(" %d", n_code);
39247 printf("\n");
39248 }
39249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039250 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039251#endif
39252
Daniel Veillard42595322004-11-08 10:52:06 +000039253 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039254}
39255
39256
39257static int
39258test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039259 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039260
39261#ifdef LIBXML_UNICODE_ENABLED
39262 int mem_base;
39263 int ret_val;
39264 int code; /* UCS code point */
39265 int n_code;
39266
39267 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39268 mem_base = xmlMemBlocks();
39269 code = gen_int(n_code, 0);
39270
39271 ret_val = xmlUCSIsTibetan(code);
39272 desret_int(ret_val);
39273 call_tests++;
39274 des_int(n_code, code, 0);
39275 xmlResetLastError();
39276 if (mem_base != xmlMemBlocks()) {
39277 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039279 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039280 printf(" %d", n_code);
39281 printf("\n");
39282 }
39283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039284 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039285#endif
39286
Daniel Veillard42595322004-11-08 10:52:06 +000039287 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039288}
39289
39290
39291static int
39292test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039293 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039294
39295#ifdef LIBXML_UNICODE_ENABLED
39296 int mem_base;
39297 int ret_val;
39298 int code; /* UCS code point */
39299 int n_code;
39300
39301 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39302 mem_base = xmlMemBlocks();
39303 code = gen_int(n_code, 0);
39304
39305 ret_val = xmlUCSIsUgaritic(code);
39306 desret_int(ret_val);
39307 call_tests++;
39308 des_int(n_code, code, 0);
39309 xmlResetLastError();
39310 if (mem_base != xmlMemBlocks()) {
39311 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039313 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039314 printf(" %d", n_code);
39315 printf("\n");
39316 }
39317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039318 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039319#endif
39320
Daniel Veillard42595322004-11-08 10:52:06 +000039321 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039322}
39323
39324
39325static int
39326test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039327 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039328
39329#ifdef LIBXML_UNICODE_ENABLED
39330 int mem_base;
39331 int ret_val;
39332 int code; /* UCS code point */
39333 int n_code;
39334
39335 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39336 mem_base = xmlMemBlocks();
39337 code = gen_int(n_code, 0);
39338
39339 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39340 desret_int(ret_val);
39341 call_tests++;
39342 des_int(n_code, code, 0);
39343 xmlResetLastError();
39344 if (mem_base != xmlMemBlocks()) {
39345 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039347 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039348 printf(" %d", n_code);
39349 printf("\n");
39350 }
39351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039352 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039353#endif
39354
Daniel Veillard42595322004-11-08 10:52:06 +000039355 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039356}
39357
39358
39359static int
39360test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039361 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039362
39363#ifdef LIBXML_UNICODE_ENABLED
39364 int mem_base;
39365 int ret_val;
39366 int code; /* UCS code point */
39367 int n_code;
39368
39369 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39370 mem_base = xmlMemBlocks();
39371 code = gen_int(n_code, 0);
39372
39373 ret_val = xmlUCSIsVariationSelectors(code);
39374 desret_int(ret_val);
39375 call_tests++;
39376 des_int(n_code, code, 0);
39377 xmlResetLastError();
39378 if (mem_base != xmlMemBlocks()) {
39379 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039381 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039382 printf(" %d", n_code);
39383 printf("\n");
39384 }
39385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039386 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039387#endif
39388
Daniel Veillard42595322004-11-08 10:52:06 +000039389 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039390}
39391
39392
39393static int
39394test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039395 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039396
39397#ifdef LIBXML_UNICODE_ENABLED
39398 int mem_base;
39399 int ret_val;
39400 int code; /* UCS code point */
39401 int n_code;
39402
39403 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39404 mem_base = xmlMemBlocks();
39405 code = gen_int(n_code, 0);
39406
39407 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39408 desret_int(ret_val);
39409 call_tests++;
39410 des_int(n_code, code, 0);
39411 xmlResetLastError();
39412 if (mem_base != xmlMemBlocks()) {
39413 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039415 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039416 printf(" %d", n_code);
39417 printf("\n");
39418 }
39419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039420 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039421#endif
39422
Daniel Veillard42595322004-11-08 10:52:06 +000039423 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039424}
39425
39426
39427static int
39428test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039429 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039430
39431#ifdef LIBXML_UNICODE_ENABLED
39432 int mem_base;
39433 int ret_val;
39434 int code; /* UCS code point */
39435 int n_code;
39436
39437 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39438 mem_base = xmlMemBlocks();
39439 code = gen_int(n_code, 0);
39440
39441 ret_val = xmlUCSIsYiRadicals(code);
39442 desret_int(ret_val);
39443 call_tests++;
39444 des_int(n_code, code, 0);
39445 xmlResetLastError();
39446 if (mem_base != xmlMemBlocks()) {
39447 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039449 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039450 printf(" %d", n_code);
39451 printf("\n");
39452 }
39453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039454 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039455#endif
39456
Daniel Veillard42595322004-11-08 10:52:06 +000039457 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039458}
39459
39460
39461static int
39462test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039463 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039464
39465#ifdef LIBXML_UNICODE_ENABLED
39466 int mem_base;
39467 int ret_val;
39468 int code; /* UCS code point */
39469 int n_code;
39470
39471 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39472 mem_base = xmlMemBlocks();
39473 code = gen_int(n_code, 0);
39474
39475 ret_val = xmlUCSIsYiSyllables(code);
39476 desret_int(ret_val);
39477 call_tests++;
39478 des_int(n_code, code, 0);
39479 xmlResetLastError();
39480 if (mem_base != xmlMemBlocks()) {
39481 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039483 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039484 printf(" %d", n_code);
39485 printf("\n");
39486 }
39487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039488 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039489#endif
39490
Daniel Veillard42595322004-11-08 10:52:06 +000039491 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039492}
39493
39494
39495static int
39496test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039497 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039498
39499#ifdef LIBXML_UNICODE_ENABLED
39500 int mem_base;
39501 int ret_val;
39502 int code; /* UCS code point */
39503 int n_code;
39504
39505 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39506 mem_base = xmlMemBlocks();
39507 code = gen_int(n_code, 0);
39508
39509 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39510 desret_int(ret_val);
39511 call_tests++;
39512 des_int(n_code, code, 0);
39513 xmlResetLastError();
39514 if (mem_base != xmlMemBlocks()) {
39515 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039517 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039518 printf(" %d", n_code);
39519 printf("\n");
39520 }
39521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039522 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039523#endif
39524
Daniel Veillard42595322004-11-08 10:52:06 +000039525 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039526}
39527
39528static int
39529test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039530 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039531
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039532 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039533 test_ret += test_xmlUCSIsAegeanNumbers();
39534 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39535 test_ret += test_xmlUCSIsArabic();
39536 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39537 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39538 test_ret += test_xmlUCSIsArmenian();
39539 test_ret += test_xmlUCSIsArrows();
39540 test_ret += test_xmlUCSIsBasicLatin();
39541 test_ret += test_xmlUCSIsBengali();
39542 test_ret += test_xmlUCSIsBlock();
39543 test_ret += test_xmlUCSIsBlockElements();
39544 test_ret += test_xmlUCSIsBopomofo();
39545 test_ret += test_xmlUCSIsBopomofoExtended();
39546 test_ret += test_xmlUCSIsBoxDrawing();
39547 test_ret += test_xmlUCSIsBraillePatterns();
39548 test_ret += test_xmlUCSIsBuhid();
39549 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39550 test_ret += test_xmlUCSIsCJKCompatibility();
39551 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39552 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39553 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39554 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39555 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39556 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39557 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39558 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39559 test_ret += test_xmlUCSIsCat();
39560 test_ret += test_xmlUCSIsCatC();
39561 test_ret += test_xmlUCSIsCatCc();
39562 test_ret += test_xmlUCSIsCatCf();
39563 test_ret += test_xmlUCSIsCatCo();
39564 test_ret += test_xmlUCSIsCatCs();
39565 test_ret += test_xmlUCSIsCatL();
39566 test_ret += test_xmlUCSIsCatLl();
39567 test_ret += test_xmlUCSIsCatLm();
39568 test_ret += test_xmlUCSIsCatLo();
39569 test_ret += test_xmlUCSIsCatLt();
39570 test_ret += test_xmlUCSIsCatLu();
39571 test_ret += test_xmlUCSIsCatM();
39572 test_ret += test_xmlUCSIsCatMc();
39573 test_ret += test_xmlUCSIsCatMe();
39574 test_ret += test_xmlUCSIsCatMn();
39575 test_ret += test_xmlUCSIsCatN();
39576 test_ret += test_xmlUCSIsCatNd();
39577 test_ret += test_xmlUCSIsCatNl();
39578 test_ret += test_xmlUCSIsCatNo();
39579 test_ret += test_xmlUCSIsCatP();
39580 test_ret += test_xmlUCSIsCatPc();
39581 test_ret += test_xmlUCSIsCatPd();
39582 test_ret += test_xmlUCSIsCatPe();
39583 test_ret += test_xmlUCSIsCatPf();
39584 test_ret += test_xmlUCSIsCatPi();
39585 test_ret += test_xmlUCSIsCatPo();
39586 test_ret += test_xmlUCSIsCatPs();
39587 test_ret += test_xmlUCSIsCatS();
39588 test_ret += test_xmlUCSIsCatSc();
39589 test_ret += test_xmlUCSIsCatSk();
39590 test_ret += test_xmlUCSIsCatSm();
39591 test_ret += test_xmlUCSIsCatSo();
39592 test_ret += test_xmlUCSIsCatZ();
39593 test_ret += test_xmlUCSIsCatZl();
39594 test_ret += test_xmlUCSIsCatZp();
39595 test_ret += test_xmlUCSIsCatZs();
39596 test_ret += test_xmlUCSIsCherokee();
39597 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39598 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39599 test_ret += test_xmlUCSIsCombiningHalfMarks();
39600 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39601 test_ret += test_xmlUCSIsControlPictures();
39602 test_ret += test_xmlUCSIsCurrencySymbols();
39603 test_ret += test_xmlUCSIsCypriotSyllabary();
39604 test_ret += test_xmlUCSIsCyrillic();
39605 test_ret += test_xmlUCSIsCyrillicSupplement();
39606 test_ret += test_xmlUCSIsDeseret();
39607 test_ret += test_xmlUCSIsDevanagari();
39608 test_ret += test_xmlUCSIsDingbats();
39609 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39610 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39611 test_ret += test_xmlUCSIsEthiopic();
39612 test_ret += test_xmlUCSIsGeneralPunctuation();
39613 test_ret += test_xmlUCSIsGeometricShapes();
39614 test_ret += test_xmlUCSIsGeorgian();
39615 test_ret += test_xmlUCSIsGothic();
39616 test_ret += test_xmlUCSIsGreek();
39617 test_ret += test_xmlUCSIsGreekExtended();
39618 test_ret += test_xmlUCSIsGreekandCoptic();
39619 test_ret += test_xmlUCSIsGujarati();
39620 test_ret += test_xmlUCSIsGurmukhi();
39621 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39622 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39623 test_ret += test_xmlUCSIsHangulJamo();
39624 test_ret += test_xmlUCSIsHangulSyllables();
39625 test_ret += test_xmlUCSIsHanunoo();
39626 test_ret += test_xmlUCSIsHebrew();
39627 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39628 test_ret += test_xmlUCSIsHighSurrogates();
39629 test_ret += test_xmlUCSIsHiragana();
39630 test_ret += test_xmlUCSIsIPAExtensions();
39631 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39632 test_ret += test_xmlUCSIsKanbun();
39633 test_ret += test_xmlUCSIsKangxiRadicals();
39634 test_ret += test_xmlUCSIsKannada();
39635 test_ret += test_xmlUCSIsKatakana();
39636 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39637 test_ret += test_xmlUCSIsKhmer();
39638 test_ret += test_xmlUCSIsKhmerSymbols();
39639 test_ret += test_xmlUCSIsLao();
39640 test_ret += test_xmlUCSIsLatin1Supplement();
39641 test_ret += test_xmlUCSIsLatinExtendedA();
39642 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39643 test_ret += test_xmlUCSIsLatinExtendedB();
39644 test_ret += test_xmlUCSIsLetterlikeSymbols();
39645 test_ret += test_xmlUCSIsLimbu();
39646 test_ret += test_xmlUCSIsLinearBIdeograms();
39647 test_ret += test_xmlUCSIsLinearBSyllabary();
39648 test_ret += test_xmlUCSIsLowSurrogates();
39649 test_ret += test_xmlUCSIsMalayalam();
39650 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39651 test_ret += test_xmlUCSIsMathematicalOperators();
39652 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39653 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39654 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39655 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39656 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39657 test_ret += test_xmlUCSIsMongolian();
39658 test_ret += test_xmlUCSIsMusicalSymbols();
39659 test_ret += test_xmlUCSIsMyanmar();
39660 test_ret += test_xmlUCSIsNumberForms();
39661 test_ret += test_xmlUCSIsOgham();
39662 test_ret += test_xmlUCSIsOldItalic();
39663 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39664 test_ret += test_xmlUCSIsOriya();
39665 test_ret += test_xmlUCSIsOsmanya();
39666 test_ret += test_xmlUCSIsPhoneticExtensions();
39667 test_ret += test_xmlUCSIsPrivateUse();
39668 test_ret += test_xmlUCSIsPrivateUseArea();
39669 test_ret += test_xmlUCSIsRunic();
39670 test_ret += test_xmlUCSIsShavian();
39671 test_ret += test_xmlUCSIsSinhala();
39672 test_ret += test_xmlUCSIsSmallFormVariants();
39673 test_ret += test_xmlUCSIsSpacingModifierLetters();
39674 test_ret += test_xmlUCSIsSpecials();
39675 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39676 test_ret += test_xmlUCSIsSupplementalArrowsA();
39677 test_ret += test_xmlUCSIsSupplementalArrowsB();
39678 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39679 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39680 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39681 test_ret += test_xmlUCSIsSyriac();
39682 test_ret += test_xmlUCSIsTagalog();
39683 test_ret += test_xmlUCSIsTagbanwa();
39684 test_ret += test_xmlUCSIsTags();
39685 test_ret += test_xmlUCSIsTaiLe();
39686 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39687 test_ret += test_xmlUCSIsTamil();
39688 test_ret += test_xmlUCSIsTelugu();
39689 test_ret += test_xmlUCSIsThaana();
39690 test_ret += test_xmlUCSIsThai();
39691 test_ret += test_xmlUCSIsTibetan();
39692 test_ret += test_xmlUCSIsUgaritic();
39693 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39694 test_ret += test_xmlUCSIsVariationSelectors();
39695 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39696 test_ret += test_xmlUCSIsYiRadicals();
39697 test_ret += test_xmlUCSIsYiSyllables();
39698 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039699
Daniel Veillard42595322004-11-08 10:52:06 +000039700 if (test_ret != 0)
39701 printf("Module xmlunicode: %d errors\n", test_ret);
39702 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039703}
39704
39705static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039706test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039708
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039709#ifdef LIBXML_WRITER_ENABLED
39710 int mem_base;
39711 xmlTextWriterPtr ret_val;
39712 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39713 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039714
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039715 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39716 mem_base = xmlMemBlocks();
39717 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039718
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039719 ret_val = xmlNewTextWriter(out);
39720 if (ret_val != NULL) out = NULL;
39721 desret_xmlTextWriterPtr(ret_val);
39722 call_tests++;
39723 des_xmlOutputBufferPtr(n_out, out, 0);
39724 xmlResetLastError();
39725 if (mem_base != xmlMemBlocks()) {
39726 printf("Leak of %d blocks found in xmlNewTextWriter",
39727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039728 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039729 printf(" %d", n_out);
39730 printf("\n");
39731 }
39732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039733 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039734#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039735
Daniel Veillard42595322004-11-08 10:52:06 +000039736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039737}
39738
39739
39740static int
39741test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039743
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039744#ifdef LIBXML_WRITER_ENABLED
39745 int mem_base;
39746 xmlTextWriterPtr ret_val;
39747 const char * uri; /* the URI of the resource for the output */
39748 int n_uri;
39749 int compression; /* compress the output? */
39750 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039751
Daniel Veillard42595322004-11-08 10:52:06 +000039752 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039753 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39754 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039755 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039756 compression = gen_int(n_compression, 1);
39757
39758 ret_val = xmlNewTextWriterFilename(uri, compression);
39759 desret_xmlTextWriterPtr(ret_val);
39760 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039761 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039762 des_int(n_compression, compression, 1);
39763 xmlResetLastError();
39764 if (mem_base != xmlMemBlocks()) {
39765 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039767 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039768 printf(" %d", n_uri);
39769 printf(" %d", n_compression);
39770 printf("\n");
39771 }
39772 }
39773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039774 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039775#endif
39776
Daniel Veillard42595322004-11-08 10:52:06 +000039777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039778}
39779
39780
39781static int
39782test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039784
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039785#ifdef LIBXML_WRITER_ENABLED
39786 int mem_base;
39787 xmlTextWriterPtr ret_val;
39788 xmlBufferPtr buf; /* xmlBufferPtr */
39789 int n_buf;
39790 int compression; /* compress the output? */
39791 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039792
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039793 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39794 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39795 mem_base = xmlMemBlocks();
39796 buf = gen_xmlBufferPtr(n_buf, 0);
39797 compression = gen_int(n_compression, 1);
39798
39799 ret_val = xmlNewTextWriterMemory(buf, compression);
39800 desret_xmlTextWriterPtr(ret_val);
39801 call_tests++;
39802 des_xmlBufferPtr(n_buf, buf, 0);
39803 des_int(n_compression, compression, 1);
39804 xmlResetLastError();
39805 if (mem_base != xmlMemBlocks()) {
39806 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039808 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039809 printf(" %d", n_buf);
39810 printf(" %d", n_compression);
39811 printf("\n");
39812 }
39813 }
39814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039815 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039816#endif
39817
Daniel Veillard42595322004-11-08 10:52:06 +000039818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039819}
39820
39821
39822static int
39823test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039825
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039826#ifdef LIBXML_WRITER_ENABLED
39827 int mem_base;
39828 xmlTextWriterPtr ret_val;
39829 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39830 int n_ctxt;
39831 int compression; /* compress the output? */
39832 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039833
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039834 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39835 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39836 mem_base = xmlMemBlocks();
39837 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39838 compression = gen_int(n_compression, 1);
39839
39840 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000039841 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039842 desret_xmlTextWriterPtr(ret_val);
39843 call_tests++;
39844 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39845 des_int(n_compression, compression, 1);
39846 xmlResetLastError();
39847 if (mem_base != xmlMemBlocks()) {
39848 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
39849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039850 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039851 printf(" %d", n_ctxt);
39852 printf(" %d", n_compression);
39853 printf("\n");
39854 }
39855 }
39856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039857 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039858#endif
39859
Daniel Veillard42595322004-11-08 10:52:06 +000039860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039861}
39862
39863
39864static int
39865test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039867
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039868#ifdef LIBXML_WRITER_ENABLED
39869 int mem_base;
39870 xmlTextWriterPtr ret_val;
39871 xmlDocPtr doc; /* xmlDocPtr */
39872 int n_doc;
39873 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
39874 int n_node;
39875 int compression; /* compress the output? */
39876 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039877
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039878 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
39879 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
39880 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39881 mem_base = xmlMemBlocks();
39882 doc = gen_xmlDocPtr(n_doc, 0);
39883 node = gen_xmlNodePtr(n_node, 1);
39884 compression = gen_int(n_compression, 2);
39885
39886 ret_val = xmlNewTextWriterTree(doc, node, compression);
39887 desret_xmlTextWriterPtr(ret_val);
39888 call_tests++;
39889 des_xmlDocPtr(n_doc, doc, 0);
39890 des_xmlNodePtr(n_node, node, 1);
39891 des_int(n_compression, compression, 2);
39892 xmlResetLastError();
39893 if (mem_base != xmlMemBlocks()) {
39894 printf("Leak of %d blocks found in xmlNewTextWriterTree",
39895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039896 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039897 printf(" %d", n_doc);
39898 printf(" %d", n_node);
39899 printf(" %d", n_compression);
39900 printf("\n");
39901 }
39902 }
39903 }
39904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039905 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039906#endif
39907
Daniel Veillard42595322004-11-08 10:52:06 +000039908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039909}
39910
39911
39912static int
39913test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039915
Daniel Veillarde43cc572004-11-03 11:50:29 +000039916#ifdef LIBXML_WRITER_ENABLED
39917 int mem_base;
39918 int ret_val;
39919 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39920 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039921
Daniel Veillarde43cc572004-11-03 11:50:29 +000039922 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039924 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039925
39926 ret_val = xmlTextWriterEndAttribute(writer);
39927 desret_int(ret_val);
39928 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039929 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039930 xmlResetLastError();
39931 if (mem_base != xmlMemBlocks()) {
39932 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
39933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039934 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039935 printf(" %d", n_writer);
39936 printf("\n");
39937 }
39938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039939 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039940#endif
39941
Daniel Veillard42595322004-11-08 10:52:06 +000039942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039943}
39944
39945
39946static int
39947test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039949
Daniel Veillarde43cc572004-11-03 11:50:29 +000039950#ifdef LIBXML_WRITER_ENABLED
39951 int mem_base;
39952 int ret_val;
39953 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39954 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039955
Daniel Veillarde43cc572004-11-03 11:50:29 +000039956 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039958 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039959
39960 ret_val = xmlTextWriterEndCDATA(writer);
39961 desret_int(ret_val);
39962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039963 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039964 xmlResetLastError();
39965 if (mem_base != xmlMemBlocks()) {
39966 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
39967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039968 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039969 printf(" %d", n_writer);
39970 printf("\n");
39971 }
39972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039973 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039974#endif
39975
Daniel Veillard42595322004-11-08 10:52:06 +000039976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039977}
39978
39979
39980static int
39981test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039983
Daniel Veillarde43cc572004-11-03 11:50:29 +000039984#ifdef LIBXML_WRITER_ENABLED
39985 int mem_base;
39986 int ret_val;
39987 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39988 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039989
Daniel Veillarde43cc572004-11-03 11:50:29 +000039990 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039992 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039993
39994 ret_val = xmlTextWriterEndComment(writer);
39995 desret_int(ret_val);
39996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039997 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039998 xmlResetLastError();
39999 if (mem_base != xmlMemBlocks()) {
40000 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040002 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040003 printf(" %d", n_writer);
40004 printf("\n");
40005 }
40006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040007 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040008#endif
40009
Daniel Veillard42595322004-11-08 10:52:06 +000040010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040011}
40012
40013
40014static int
40015test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040017
Daniel Veillarde43cc572004-11-03 11:50:29 +000040018#ifdef LIBXML_WRITER_ENABLED
40019 int mem_base;
40020 int ret_val;
40021 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40022 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040023
Daniel Veillarde43cc572004-11-03 11:50:29 +000040024 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40025 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040026 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040027
40028 ret_val = xmlTextWriterEndDTD(writer);
40029 desret_int(ret_val);
40030 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040031 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040032 xmlResetLastError();
40033 if (mem_base != xmlMemBlocks()) {
40034 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040036 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040037 printf(" %d", n_writer);
40038 printf("\n");
40039 }
40040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040041 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040042#endif
40043
Daniel Veillard42595322004-11-08 10:52:06 +000040044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040045}
40046
40047
40048static int
40049test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040051
Daniel Veillarde43cc572004-11-03 11:50:29 +000040052#ifdef LIBXML_WRITER_ENABLED
40053 int mem_base;
40054 int ret_val;
40055 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40056 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040057
Daniel Veillarde43cc572004-11-03 11:50:29 +000040058 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040060 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040061
40062 ret_val = xmlTextWriterEndDTDAttlist(writer);
40063 desret_int(ret_val);
40064 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040065 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040066 xmlResetLastError();
40067 if (mem_base != xmlMemBlocks()) {
40068 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040070 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040071 printf(" %d", n_writer);
40072 printf("\n");
40073 }
40074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040075 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040076#endif
40077
Daniel Veillard42595322004-11-08 10:52:06 +000040078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040079}
40080
40081
40082static int
40083test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040085
Daniel Veillarde43cc572004-11-03 11:50:29 +000040086#ifdef LIBXML_WRITER_ENABLED
40087 int mem_base;
40088 int ret_val;
40089 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40090 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040091
Daniel Veillarde43cc572004-11-03 11:50:29 +000040092 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40093 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040094 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040095
40096 ret_val = xmlTextWriterEndDTDElement(writer);
40097 desret_int(ret_val);
40098 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040099 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040100 xmlResetLastError();
40101 if (mem_base != xmlMemBlocks()) {
40102 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040104 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040105 printf(" %d", n_writer);
40106 printf("\n");
40107 }
40108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040109 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040110#endif
40111
Daniel Veillard42595322004-11-08 10:52:06 +000040112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040113}
40114
40115
40116static int
40117test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040119
Daniel Veillarde43cc572004-11-03 11:50:29 +000040120#ifdef LIBXML_WRITER_ENABLED
40121 int mem_base;
40122 int ret_val;
40123 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40124 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040125
Daniel Veillarde43cc572004-11-03 11:50:29 +000040126 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040128 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040129
40130 ret_val = xmlTextWriterEndDTDEntity(writer);
40131 desret_int(ret_val);
40132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040133 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040134 xmlResetLastError();
40135 if (mem_base != xmlMemBlocks()) {
40136 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040138 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040139 printf(" %d", n_writer);
40140 printf("\n");
40141 }
40142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040143 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040144#endif
40145
Daniel Veillard42595322004-11-08 10:52:06 +000040146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040147}
40148
40149
40150static int
40151test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040153
Daniel Veillarde43cc572004-11-03 11:50:29 +000040154#ifdef LIBXML_WRITER_ENABLED
40155 int mem_base;
40156 int ret_val;
40157 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40158 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040159
Daniel Veillarde43cc572004-11-03 11:50:29 +000040160 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40161 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040162 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040163
40164 ret_val = xmlTextWriterEndDocument(writer);
40165 desret_int(ret_val);
40166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040167 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040168 xmlResetLastError();
40169 if (mem_base != xmlMemBlocks()) {
40170 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040172 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040173 printf(" %d", n_writer);
40174 printf("\n");
40175 }
40176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040177 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040178#endif
40179
Daniel Veillard42595322004-11-08 10:52:06 +000040180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040181}
40182
40183
40184static int
40185test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040187
Daniel Veillarde43cc572004-11-03 11:50:29 +000040188#ifdef LIBXML_WRITER_ENABLED
40189 int mem_base;
40190 int ret_val;
40191 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40192 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040193
Daniel Veillarde43cc572004-11-03 11:50:29 +000040194 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040196 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040197
40198 ret_val = xmlTextWriterEndElement(writer);
40199 desret_int(ret_val);
40200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040201 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040202 xmlResetLastError();
40203 if (mem_base != xmlMemBlocks()) {
40204 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040206 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040207 printf(" %d", n_writer);
40208 printf("\n");
40209 }
40210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040211 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040212#endif
40213
Daniel Veillard42595322004-11-08 10:52:06 +000040214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040215}
40216
40217
40218static int
40219test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040221
Daniel Veillarde43cc572004-11-03 11:50:29 +000040222#ifdef LIBXML_WRITER_ENABLED
40223 int mem_base;
40224 int ret_val;
40225 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40226 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040227
Daniel Veillarde43cc572004-11-03 11:50:29 +000040228 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40229 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040230 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040231
40232 ret_val = xmlTextWriterEndPI(writer);
40233 desret_int(ret_val);
40234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040235 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040236 xmlResetLastError();
40237 if (mem_base != xmlMemBlocks()) {
40238 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040240 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040241 printf(" %d", n_writer);
40242 printf("\n");
40243 }
40244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040245 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040246#endif
40247
Daniel Veillard42595322004-11-08 10:52:06 +000040248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040249}
40250
40251
40252static int
40253test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040255
Daniel Veillarde43cc572004-11-03 11:50:29 +000040256#ifdef LIBXML_WRITER_ENABLED
40257 int mem_base;
40258 int ret_val;
40259 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40260 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040261
Daniel Veillarde43cc572004-11-03 11:50:29 +000040262 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40263 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040264 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040265
40266 ret_val = xmlTextWriterFlush(writer);
40267 desret_int(ret_val);
40268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040269 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040270 xmlResetLastError();
40271 if (mem_base != xmlMemBlocks()) {
40272 printf("Leak of %d blocks found in xmlTextWriterFlush",
40273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040274 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040275 printf(" %d", n_writer);
40276 printf("\n");
40277 }
40278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040279 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040280#endif
40281
Daniel Veillard42595322004-11-08 10:52:06 +000040282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040283}
40284
40285
40286static int
40287test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040289
Daniel Veillarde43cc572004-11-03 11:50:29 +000040290#ifdef LIBXML_WRITER_ENABLED
40291 int mem_base;
40292 int ret_val;
40293 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40294 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040295
Daniel Veillarde43cc572004-11-03 11:50:29 +000040296 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40297 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040298 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040299
40300 ret_val = xmlTextWriterFullEndElement(writer);
40301 desret_int(ret_val);
40302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040303 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040304 xmlResetLastError();
40305 if (mem_base != xmlMemBlocks()) {
40306 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040308 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040309 printf(" %d", n_writer);
40310 printf("\n");
40311 }
40312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040313 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040314#endif
40315
Daniel Veillard42595322004-11-08 10:52:06 +000040316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040317}
40318
40319
40320static int
40321test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040323
Daniel Veillarde43cc572004-11-03 11:50:29 +000040324#ifdef LIBXML_WRITER_ENABLED
40325 int mem_base;
40326 int ret_val;
40327 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40328 int n_writer;
40329 int indent; /* do indentation? */
40330 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040331
Daniel Veillarde43cc572004-11-03 11:50:29 +000040332 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40333 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040335 writer = gen_xmlTextWriterPtr(n_writer, 0);
40336 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040337
40338 ret_val = xmlTextWriterSetIndent(writer, indent);
40339 desret_int(ret_val);
40340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040341 des_xmlTextWriterPtr(n_writer, writer, 0);
40342 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040343 xmlResetLastError();
40344 if (mem_base != xmlMemBlocks()) {
40345 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040347 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040348 printf(" %d", n_writer);
40349 printf(" %d", n_indent);
40350 printf("\n");
40351 }
40352 }
40353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040354 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040355#endif
40356
Daniel Veillard42595322004-11-08 10:52:06 +000040357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040358}
40359
40360
40361static int
40362test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040364
Daniel Veillarde43cc572004-11-03 11:50:29 +000040365#ifdef LIBXML_WRITER_ENABLED
40366 int mem_base;
40367 int ret_val;
40368 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40369 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040370 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040371 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040372
Daniel Veillarde43cc572004-11-03 11:50:29 +000040373 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40374 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40375 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040376 writer = gen_xmlTextWriterPtr(n_writer, 0);
40377 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040378
William M. Brackf13f77f2004-11-12 16:03:48 +000040379 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040380 desret_int(ret_val);
40381 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040382 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040383 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040384 xmlResetLastError();
40385 if (mem_base != xmlMemBlocks()) {
40386 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040388 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040389 printf(" %d", n_writer);
40390 printf(" %d", n_str);
40391 printf("\n");
40392 }
40393 }
40394 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040395 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040396#endif
40397
Daniel Veillard42595322004-11-08 10:52:06 +000040398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040399}
40400
40401
40402static int
40403test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040405
Daniel Veillarde43cc572004-11-03 11:50:29 +000040406#ifdef LIBXML_WRITER_ENABLED
40407 int mem_base;
40408 int ret_val;
40409 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40410 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040411 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040412 int n_name;
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 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40416 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040417 writer = gen_xmlTextWriterPtr(n_writer, 0);
40418 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040419
William M. Brackf13f77f2004-11-12 16:03:48 +000040420 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040421 desret_int(ret_val);
40422 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040423 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040424 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040425 xmlResetLastError();
40426 if (mem_base != xmlMemBlocks()) {
40427 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040429 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040430 printf(" %d", n_writer);
40431 printf(" %d", n_name);
40432 printf("\n");
40433 }
40434 }
40435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040436 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040437#endif
40438
Daniel Veillard42595322004-11-08 10:52:06 +000040439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040440}
40441
40442
40443static int
40444test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040446
Daniel Veillarde43cc572004-11-03 11:50:29 +000040447#ifdef LIBXML_WRITER_ENABLED
40448 int mem_base;
40449 int ret_val;
40450 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40451 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040452 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040453 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040454 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040455 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040456 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040457 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040458
Daniel Veillarde43cc572004-11-03 11:50:29 +000040459 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40460 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40461 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40462 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40463 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040464 writer = gen_xmlTextWriterPtr(n_writer, 0);
40465 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40466 name = gen_const_xmlChar_ptr(n_name, 2);
40467 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040468
William M. Brackf13f77f2004-11-12 16:03:48 +000040469 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040470 desret_int(ret_val);
40471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040472 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040473 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40474 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40475 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040476 xmlResetLastError();
40477 if (mem_base != xmlMemBlocks()) {
40478 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040480 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040481 printf(" %d", n_writer);
40482 printf(" %d", n_prefix);
40483 printf(" %d", n_name);
40484 printf(" %d", n_namespaceURI);
40485 printf("\n");
40486 }
40487 }
40488 }
40489 }
40490 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040491 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040492#endif
40493
Daniel Veillard42595322004-11-08 10:52:06 +000040494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040495}
40496
40497
40498static int
40499test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040501
Daniel Veillarde43cc572004-11-03 11:50:29 +000040502#ifdef LIBXML_WRITER_ENABLED
40503 int mem_base;
40504 int ret_val;
40505 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40506 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040507
Daniel Veillarde43cc572004-11-03 11:50:29 +000040508 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40509 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040510 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040511
40512 ret_val = xmlTextWriterStartCDATA(writer);
40513 desret_int(ret_val);
40514 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040515 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040516 xmlResetLastError();
40517 if (mem_base != xmlMemBlocks()) {
40518 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040520 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040521 printf(" %d", n_writer);
40522 printf("\n");
40523 }
40524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040525 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040526#endif
40527
Daniel Veillard42595322004-11-08 10:52:06 +000040528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040529}
40530
40531
40532static int
40533test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040535
Daniel Veillarde43cc572004-11-03 11:50:29 +000040536#ifdef LIBXML_WRITER_ENABLED
40537 int mem_base;
40538 int ret_val;
40539 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40540 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040541
Daniel Veillarde43cc572004-11-03 11:50:29 +000040542 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40543 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040544 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040545
40546 ret_val = xmlTextWriterStartComment(writer);
40547 desret_int(ret_val);
40548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040549 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040550 xmlResetLastError();
40551 if (mem_base != xmlMemBlocks()) {
40552 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040554 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040555 printf(" %d", n_writer);
40556 printf("\n");
40557 }
40558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040559 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040560#endif
40561
Daniel Veillard42595322004-11-08 10:52:06 +000040562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040563}
40564
40565
40566static int
40567test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040569
Daniel Veillarde43cc572004-11-03 11:50:29 +000040570#ifdef LIBXML_WRITER_ENABLED
40571 int mem_base;
40572 int ret_val;
40573 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40574 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040575 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040576 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040577 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040578 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040579 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040580 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040581
Daniel Veillarde43cc572004-11-03 11:50:29 +000040582 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40583 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40584 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40585 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040587 writer = gen_xmlTextWriterPtr(n_writer, 0);
40588 name = gen_const_xmlChar_ptr(n_name, 1);
40589 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40590 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040591
William M. Brackf13f77f2004-11-12 16:03:48 +000040592 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040593 desret_int(ret_val);
40594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040595 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040596 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40597 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
40598 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040599 xmlResetLastError();
40600 if (mem_base != xmlMemBlocks()) {
40601 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040603 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040604 printf(" %d", n_writer);
40605 printf(" %d", n_name);
40606 printf(" %d", n_pubid);
40607 printf(" %d", n_sysid);
40608 printf("\n");
40609 }
40610 }
40611 }
40612 }
40613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040614 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040615#endif
40616
Daniel Veillard42595322004-11-08 10:52:06 +000040617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040618}
40619
40620
40621static int
40622test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040624
Daniel Veillarde43cc572004-11-03 11:50:29 +000040625#ifdef LIBXML_WRITER_ENABLED
40626 int mem_base;
40627 int ret_val;
40628 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40629 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040630 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040631 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040632
Daniel Veillarde43cc572004-11-03 11:50:29 +000040633 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40634 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040636 writer = gen_xmlTextWriterPtr(n_writer, 0);
40637 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040638
William M. Brackf13f77f2004-11-12 16:03:48 +000040639 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040640 desret_int(ret_val);
40641 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040642 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040643 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040644 xmlResetLastError();
40645 if (mem_base != xmlMemBlocks()) {
40646 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40647 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040648 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040649 printf(" %d", n_writer);
40650 printf(" %d", n_name);
40651 printf("\n");
40652 }
40653 }
40654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040655 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040656#endif
40657
Daniel Veillard42595322004-11-08 10:52:06 +000040658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040659}
40660
40661
40662static int
40663test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040665
Daniel Veillarde43cc572004-11-03 11:50:29 +000040666#ifdef LIBXML_WRITER_ENABLED
40667 int mem_base;
40668 int ret_val;
40669 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40670 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040671 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040672 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040673
Daniel Veillarde43cc572004-11-03 11:50:29 +000040674 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40675 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40676 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040677 writer = gen_xmlTextWriterPtr(n_writer, 0);
40678 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040679
William M. Brackf13f77f2004-11-12 16:03:48 +000040680 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040681 desret_int(ret_val);
40682 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040683 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040684 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040685 xmlResetLastError();
40686 if (mem_base != xmlMemBlocks()) {
40687 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040689 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040690 printf(" %d", n_writer);
40691 printf(" %d", n_name);
40692 printf("\n");
40693 }
40694 }
40695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040696 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040697#endif
40698
Daniel Veillard42595322004-11-08 10:52:06 +000040699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040700}
40701
40702
40703static int
40704test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040706
Daniel Veillarde43cc572004-11-03 11:50:29 +000040707#ifdef LIBXML_WRITER_ENABLED
40708 int mem_base;
40709 int ret_val;
40710 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40711 int n_writer;
40712 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40713 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040714 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040715 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040716
Daniel Veillarde43cc572004-11-03 11:50:29 +000040717 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40718 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40719 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40720 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040721 writer = gen_xmlTextWriterPtr(n_writer, 0);
40722 pe = gen_int(n_pe, 1);
40723 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040724
William M. Brackf13f77f2004-11-12 16:03:48 +000040725 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040726 desret_int(ret_val);
40727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040728 des_xmlTextWriterPtr(n_writer, writer, 0);
40729 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000040730 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040731 xmlResetLastError();
40732 if (mem_base != xmlMemBlocks()) {
40733 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040735 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040736 printf(" %d", n_writer);
40737 printf(" %d", n_pe);
40738 printf(" %d", n_name);
40739 printf("\n");
40740 }
40741 }
40742 }
40743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040744 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040745#endif
40746
Daniel Veillard42595322004-11-08 10:52:06 +000040747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040748}
40749
40750
40751static int
40752test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040754
Daniel Veillarde43cc572004-11-03 11:50:29 +000040755#ifdef LIBXML_WRITER_ENABLED
40756 int mem_base;
40757 int ret_val;
40758 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40759 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040760 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040762 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040763 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040764 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040765 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040766
Daniel Veillarde43cc572004-11-03 11:50:29 +000040767 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40768 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40769 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40770 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40771 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040772 writer = gen_xmlTextWriterPtr(n_writer, 0);
40773 version = gen_const_char_ptr(n_version, 1);
40774 encoding = gen_const_char_ptr(n_encoding, 2);
40775 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040776
William M. Brackf13f77f2004-11-12 16:03:48 +000040777 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040778 desret_int(ret_val);
40779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040780 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040781 des_const_char_ptr(n_version, (const char *)version, 1);
40782 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
40783 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040784 xmlResetLastError();
40785 if (mem_base != xmlMemBlocks()) {
40786 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040788 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040789 printf(" %d", n_writer);
40790 printf(" %d", n_version);
40791 printf(" %d", n_encoding);
40792 printf(" %d", n_standalone);
40793 printf("\n");
40794 }
40795 }
40796 }
40797 }
40798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040799 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040800#endif
40801
Daniel Veillard42595322004-11-08 10:52:06 +000040802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040803}
40804
40805
40806static int
40807test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040809
Daniel Veillarde43cc572004-11-03 11:50:29 +000040810#ifdef LIBXML_WRITER_ENABLED
40811 int mem_base;
40812 int ret_val;
40813 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40814 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040815 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040816 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040817
Daniel Veillarde43cc572004-11-03 11:50:29 +000040818 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40819 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40820 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040821 writer = gen_xmlTextWriterPtr(n_writer, 0);
40822 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040823
William M. Brackf13f77f2004-11-12 16:03:48 +000040824 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040825 desret_int(ret_val);
40826 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040827 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040828 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040829 xmlResetLastError();
40830 if (mem_base != xmlMemBlocks()) {
40831 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040833 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040834 printf(" %d", n_writer);
40835 printf(" %d", n_name);
40836 printf("\n");
40837 }
40838 }
40839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040840 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040841#endif
40842
Daniel Veillard42595322004-11-08 10:52:06 +000040843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040844}
40845
40846
40847static int
40848test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040850
Daniel Veillarde43cc572004-11-03 11:50:29 +000040851#ifdef LIBXML_WRITER_ENABLED
40852 int mem_base;
40853 int ret_val;
40854 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40855 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040856 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040857 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040858 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040859 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040860 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040861 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040862
Daniel Veillarde43cc572004-11-03 11:50:29 +000040863 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40864 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40865 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40866 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40867 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040868 writer = gen_xmlTextWriterPtr(n_writer, 0);
40869 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40870 name = gen_const_xmlChar_ptr(n_name, 2);
40871 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040872
William M. Brackf13f77f2004-11-12 16:03:48 +000040873 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040874 desret_int(ret_val);
40875 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040876 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040877 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40878 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40879 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040880 xmlResetLastError();
40881 if (mem_base != xmlMemBlocks()) {
40882 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
40883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040884 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040885 printf(" %d", n_writer);
40886 printf(" %d", n_prefix);
40887 printf(" %d", n_name);
40888 printf(" %d", n_namespaceURI);
40889 printf("\n");
40890 }
40891 }
40892 }
40893 }
40894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040895 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040896#endif
40897
Daniel Veillard42595322004-11-08 10:52:06 +000040898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040899}
40900
40901
40902static int
40903test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040905
Daniel Veillarde43cc572004-11-03 11:50:29 +000040906#ifdef LIBXML_WRITER_ENABLED
40907 int mem_base;
40908 int ret_val;
40909 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40910 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040911 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040912 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040913
Daniel Veillarde43cc572004-11-03 11:50:29 +000040914 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40915 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
40916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040917 writer = gen_xmlTextWriterPtr(n_writer, 0);
40918 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040919
William M. Brackf13f77f2004-11-12 16:03:48 +000040920 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040921 desret_int(ret_val);
40922 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040923 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040924 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040925 xmlResetLastError();
40926 if (mem_base != xmlMemBlocks()) {
40927 printf("Leak of %d blocks found in xmlTextWriterStartPI",
40928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040929 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040930 printf(" %d", n_writer);
40931 printf(" %d", n_target);
40932 printf("\n");
40933 }
40934 }
40935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040936 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040937#endif
40938
Daniel Veillard42595322004-11-08 10:52:06 +000040939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040940}
40941
40942
40943static int
40944test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040946
Daniel Veillarde43cc572004-11-03 11:50:29 +000040947#ifdef LIBXML_WRITER_ENABLED
40948 int mem_base;
40949 int ret_val;
40950 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40951 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040952 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040953 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040954 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040955 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040956
Daniel Veillarde43cc572004-11-03 11:50:29 +000040957 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40958 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40959 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040961 writer = gen_xmlTextWriterPtr(n_writer, 0);
40962 name = gen_const_xmlChar_ptr(n_name, 1);
40963 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040964
William M. Brackf13f77f2004-11-12 16:03:48 +000040965 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040966 desret_int(ret_val);
40967 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040968 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040969 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40970 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040971 xmlResetLastError();
40972 if (mem_base != xmlMemBlocks()) {
40973 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
40974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040975 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040976 printf(" %d", n_writer);
40977 printf(" %d", n_name);
40978 printf(" %d", n_content);
40979 printf("\n");
40980 }
40981 }
40982 }
40983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040984 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040985#endif
40986
Daniel Veillard42595322004-11-08 10:52:06 +000040987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040988}
40989
40990
40991static int
40992test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040994
Daniel Veillarde43cc572004-11-03 11:50:29 +000040995#ifdef LIBXML_WRITER_ENABLED
40996 int mem_base;
40997 int ret_val;
40998 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40999 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041000 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041001 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041002 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041003 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041004 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041005 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041006 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041007 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041008
Daniel Veillarde43cc572004-11-03 11:50:29 +000041009 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41010 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41011 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41012 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41013 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41014 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041015 writer = gen_xmlTextWriterPtr(n_writer, 0);
41016 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41017 name = gen_const_xmlChar_ptr(n_name, 2);
41018 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41019 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041020
William M. Brackf13f77f2004-11-12 16:03:48 +000041021 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022 desret_int(ret_val);
41023 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041024 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041025 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41026 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41027 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41028 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041029 xmlResetLastError();
41030 if (mem_base != xmlMemBlocks()) {
41031 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041033 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041034 printf(" %d", n_writer);
41035 printf(" %d", n_prefix);
41036 printf(" %d", n_name);
41037 printf(" %d", n_namespaceURI);
41038 printf(" %d", n_content);
41039 printf("\n");
41040 }
41041 }
41042 }
41043 }
41044 }
41045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041046 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041047#endif
41048
Daniel Veillard42595322004-11-08 10:52:06 +000041049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041050}
41051
41052
41053static int
41054test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041056
Daniel Veillarde43cc572004-11-03 11:50:29 +000041057#ifdef LIBXML_WRITER_ENABLED
41058 int mem_base;
41059 int ret_val;
41060 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41061 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041062 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041063 int n_data;
41064 int start; /* the position within the data of the first byte to encode */
41065 int n_start;
41066 int len; /* the number of bytes to encode */
41067 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041068
Daniel Veillarde43cc572004-11-03 11:50:29 +000041069 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41070 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41071 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41072 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041074 writer = gen_xmlTextWriterPtr(n_writer, 0);
41075 data = gen_const_char_ptr(n_data, 1);
41076 start = gen_int(n_start, 2);
41077 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041078
William M. Brackf13f77f2004-11-12 16:03:48 +000041079 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041080 desret_int(ret_val);
41081 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041082 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041083 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041084 des_int(n_start, start, 2);
41085 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041086 xmlResetLastError();
41087 if (mem_base != xmlMemBlocks()) {
41088 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041090 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041091 printf(" %d", n_writer);
41092 printf(" %d", n_data);
41093 printf(" %d", n_start);
41094 printf(" %d", n_len);
41095 printf("\n");
41096 }
41097 }
41098 }
41099 }
41100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041101 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041102#endif
41103
Daniel Veillard42595322004-11-08 10:52:06 +000041104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041105}
41106
41107
41108static int
41109test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041111
Daniel Veillarde43cc572004-11-03 11:50:29 +000041112#ifdef LIBXML_WRITER_ENABLED
41113 int mem_base;
41114 int ret_val;
41115 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41116 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041117 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041118 int n_data;
41119 int start; /* the position within the data of the first byte to encode */
41120 int n_start;
41121 int len; /* the number of bytes to encode */
41122 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041123
Daniel Veillarde43cc572004-11-03 11:50:29 +000041124 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41125 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41126 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41127 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041129 writer = gen_xmlTextWriterPtr(n_writer, 0);
41130 data = gen_const_char_ptr(n_data, 1);
41131 start = gen_int(n_start, 2);
41132 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041133
William M. Brackf13f77f2004-11-12 16:03:48 +000041134 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041135 desret_int(ret_val);
41136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041137 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041138 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041139 des_int(n_start, start, 2);
41140 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041141 xmlResetLastError();
41142 if (mem_base != xmlMemBlocks()) {
41143 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041145 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041146 printf(" %d", n_writer);
41147 printf(" %d", n_data);
41148 printf(" %d", n_start);
41149 printf(" %d", n_len);
41150 printf("\n");
41151 }
41152 }
41153 }
41154 }
41155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041156 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041157#endif
41158
Daniel Veillard42595322004-11-08 10:52:06 +000041159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041160}
41161
41162
41163static int
41164test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041166
Daniel Veillarde43cc572004-11-03 11:50:29 +000041167#ifdef LIBXML_WRITER_ENABLED
41168 int mem_base;
41169 int ret_val;
41170 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41171 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041172 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041173 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041174
Daniel Veillarde43cc572004-11-03 11:50:29 +000041175 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41176 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041178 writer = gen_xmlTextWriterPtr(n_writer, 0);
41179 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041180
William M. Brackf13f77f2004-11-12 16:03:48 +000041181 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041182 desret_int(ret_val);
41183 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041184 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041185 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041186 xmlResetLastError();
41187 if (mem_base != xmlMemBlocks()) {
41188 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041190 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041191 printf(" %d", n_writer);
41192 printf(" %d", n_content);
41193 printf("\n");
41194 }
41195 }
41196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041197 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041198#endif
41199
Daniel Veillard42595322004-11-08 10:52:06 +000041200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041201}
41202
41203
41204static int
41205test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041207
Daniel Veillarde43cc572004-11-03 11:50:29 +000041208#ifdef LIBXML_WRITER_ENABLED
41209 int mem_base;
41210 int ret_val;
41211 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41212 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041213 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041214 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041215
Daniel Veillarde43cc572004-11-03 11:50:29 +000041216 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41217 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41218 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041219 writer = gen_xmlTextWriterPtr(n_writer, 0);
41220 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041221
William M. Brackf13f77f2004-11-12 16:03:48 +000041222 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041223 desret_int(ret_val);
41224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041225 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041226 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041227 xmlResetLastError();
41228 if (mem_base != xmlMemBlocks()) {
41229 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041231 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041232 printf(" %d", n_writer);
41233 printf(" %d", n_content);
41234 printf("\n");
41235 }
41236 }
41237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041238 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041239#endif
41240
Daniel Veillard42595322004-11-08 10:52:06 +000041241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041242}
41243
41244
41245static int
41246test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041248
Daniel Veillarde43cc572004-11-03 11:50:29 +000041249#ifdef LIBXML_WRITER_ENABLED
41250 int mem_base;
41251 int ret_val;
41252 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41253 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041254 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041255 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041256 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041257 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041258 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041259 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041260 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041261 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041262
Daniel Veillarde43cc572004-11-03 11:50:29 +000041263 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41264 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41265 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41266 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41267 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41268 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041269 writer = gen_xmlTextWriterPtr(n_writer, 0);
41270 name = gen_const_xmlChar_ptr(n_name, 1);
41271 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41272 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41273 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041274
William M. Brackf13f77f2004-11-12 16:03:48 +000041275 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041276 desret_int(ret_val);
41277 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041278 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041279 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41280 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41281 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41282 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041283 xmlResetLastError();
41284 if (mem_base != xmlMemBlocks()) {
41285 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041287 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041288 printf(" %d", n_writer);
41289 printf(" %d", n_name);
41290 printf(" %d", n_pubid);
41291 printf(" %d", n_sysid);
41292 printf(" %d", n_subset);
41293 printf("\n");
41294 }
41295 }
41296 }
41297 }
41298 }
41299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041300 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041301#endif
41302
Daniel Veillard42595322004-11-08 10:52:06 +000041303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041304}
41305
41306
41307static int
41308test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041310
Daniel Veillarde43cc572004-11-03 11:50:29 +000041311#ifdef LIBXML_WRITER_ENABLED
41312 int mem_base;
41313 int ret_val;
41314 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41315 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041316 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041317 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041318 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041319 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041320
Daniel Veillarde43cc572004-11-03 11:50:29 +000041321 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41322 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41323 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041325 writer = gen_xmlTextWriterPtr(n_writer, 0);
41326 name = gen_const_xmlChar_ptr(n_name, 1);
41327 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041328
William M. Brackf13f77f2004-11-12 16:03:48 +000041329 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041330 desret_int(ret_val);
41331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041332 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041333 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41334 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041335 xmlResetLastError();
41336 if (mem_base != xmlMemBlocks()) {
41337 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041339 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041340 printf(" %d", n_writer);
41341 printf(" %d", n_name);
41342 printf(" %d", n_content);
41343 printf("\n");
41344 }
41345 }
41346 }
41347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041348 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041349#endif
41350
Daniel Veillard42595322004-11-08 10:52:06 +000041351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041352}
41353
41354
41355static int
41356test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041358
Daniel Veillarde43cc572004-11-03 11:50:29 +000041359#ifdef LIBXML_WRITER_ENABLED
41360 int mem_base;
41361 int ret_val;
41362 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41363 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041364 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041365 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041366 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041367 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041368
Daniel Veillarde43cc572004-11-03 11:50:29 +000041369 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41370 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41371 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041373 writer = gen_xmlTextWriterPtr(n_writer, 0);
41374 name = gen_const_xmlChar_ptr(n_name, 1);
41375 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041376
William M. Brackf13f77f2004-11-12 16:03:48 +000041377 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041378 desret_int(ret_val);
41379 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041380 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041381 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41382 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041383 xmlResetLastError();
41384 if (mem_base != xmlMemBlocks()) {
41385 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041387 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041388 printf(" %d", n_writer);
41389 printf(" %d", n_name);
41390 printf(" %d", n_content);
41391 printf("\n");
41392 }
41393 }
41394 }
41395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041396 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041397#endif
41398
Daniel Veillard42595322004-11-08 10:52:06 +000041399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041400}
41401
41402
41403static int
41404test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041406
Daniel Veillarde43cc572004-11-03 11:50:29 +000041407#ifdef LIBXML_WRITER_ENABLED
41408 int mem_base;
41409 int ret_val;
41410 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41411 int n_writer;
41412 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41413 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041414 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041415 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041416 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041417 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041418 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041419 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041420 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041421 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041422 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041423 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041424
Daniel Veillarde43cc572004-11-03 11:50:29 +000041425 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41426 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41427 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41428 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41429 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41430 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41431 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041433 writer = gen_xmlTextWriterPtr(n_writer, 0);
41434 pe = gen_int(n_pe, 1);
41435 name = gen_const_xmlChar_ptr(n_name, 2);
41436 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41437 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41438 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41439 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041440
William M. Brackf13f77f2004-11-12 16:03:48 +000041441 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 +000041442 desret_int(ret_val);
41443 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041444 des_xmlTextWriterPtr(n_writer, writer, 0);
41445 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041446 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41447 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41448 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41449 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41450 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041451 xmlResetLastError();
41452 if (mem_base != xmlMemBlocks()) {
41453 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041455 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041456 printf(" %d", n_writer);
41457 printf(" %d", n_pe);
41458 printf(" %d", n_name);
41459 printf(" %d", n_pubid);
41460 printf(" %d", n_sysid);
41461 printf(" %d", n_ndataid);
41462 printf(" %d", n_content);
41463 printf("\n");
41464 }
41465 }
41466 }
41467 }
41468 }
41469 }
41470 }
41471 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041472 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041473#endif
41474
Daniel Veillard42595322004-11-08 10:52:06 +000041475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041476}
41477
41478
41479static int
41480test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041482
Daniel Veillarde43cc572004-11-03 11:50:29 +000041483#ifdef LIBXML_WRITER_ENABLED
41484 int mem_base;
41485 int ret_val;
41486 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41487 int n_writer;
41488 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41489 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041490 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041491 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041492 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041493 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041494 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041495 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041496 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041497 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041498
Daniel Veillarde43cc572004-11-03 11:50:29 +000041499 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41500 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41501 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41502 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41503 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41504 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041506 writer = gen_xmlTextWriterPtr(n_writer, 0);
41507 pe = gen_int(n_pe, 1);
41508 name = gen_const_xmlChar_ptr(n_name, 2);
41509 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41510 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41511 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041512
William M. Brackf13f77f2004-11-12 16:03:48 +000041513 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041514 desret_int(ret_val);
41515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041516 des_xmlTextWriterPtr(n_writer, writer, 0);
41517 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041518 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41519 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41520 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41521 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041522 xmlResetLastError();
41523 if (mem_base != xmlMemBlocks()) {
41524 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041526 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041527 printf(" %d", n_writer);
41528 printf(" %d", n_pe);
41529 printf(" %d", n_name);
41530 printf(" %d", n_pubid);
41531 printf(" %d", n_sysid);
41532 printf(" %d", n_ndataid);
41533 printf("\n");
41534 }
41535 }
41536 }
41537 }
41538 }
41539 }
41540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041541 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041542#endif
41543
Daniel Veillard42595322004-11-08 10:52:06 +000041544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041545}
41546
41547
41548static int
41549test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041551
Daniel Veillarde43cc572004-11-03 11:50:29 +000041552#ifdef LIBXML_WRITER_ENABLED
41553 int mem_base;
41554 int ret_val;
41555 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41556 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041557 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041558 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041559 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041560 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041561 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041562 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041563
Daniel Veillarde43cc572004-11-03 11:50:29 +000041564 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41565 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41566 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41567 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041569 writer = gen_xmlTextWriterPtr(n_writer, 0);
41570 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41571 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41572 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041573
William M. Brackf13f77f2004-11-12 16:03:48 +000041574 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041575 desret_int(ret_val);
41576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041577 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041578 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41579 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41580 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041581 xmlResetLastError();
41582 if (mem_base != xmlMemBlocks()) {
41583 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041585 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041586 printf(" %d", n_writer);
41587 printf(" %d", n_pubid);
41588 printf(" %d", n_sysid);
41589 printf(" %d", n_ndataid);
41590 printf("\n");
41591 }
41592 }
41593 }
41594 }
41595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041596 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041597#endif
41598
Daniel Veillard42595322004-11-08 10:52:06 +000041599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041600}
41601
41602
41603static int
41604test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041606
Daniel Veillarde43cc572004-11-03 11:50:29 +000041607#ifdef LIBXML_WRITER_ENABLED
41608 int mem_base;
41609 int ret_val;
41610 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41611 int n_writer;
41612 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41613 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041614 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041615 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041616 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041617 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041618
Daniel Veillarde43cc572004-11-03 11:50:29 +000041619 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41620 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41621 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41622 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041624 writer = gen_xmlTextWriterPtr(n_writer, 0);
41625 pe = gen_int(n_pe, 1);
41626 name = gen_const_xmlChar_ptr(n_name, 2);
41627 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041628
William M. Brackf13f77f2004-11-12 16:03:48 +000041629 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041630 desret_int(ret_val);
41631 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041632 des_xmlTextWriterPtr(n_writer, writer, 0);
41633 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041634 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41635 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041636 xmlResetLastError();
41637 if (mem_base != xmlMemBlocks()) {
41638 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041640 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041641 printf(" %d", n_writer);
41642 printf(" %d", n_pe);
41643 printf(" %d", n_name);
41644 printf(" %d", n_content);
41645 printf("\n");
41646 }
41647 }
41648 }
41649 }
41650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041651 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041652#endif
41653
Daniel Veillard42595322004-11-08 10:52:06 +000041654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041655}
41656
41657
41658static int
41659test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041661
Daniel Veillarde43cc572004-11-03 11:50:29 +000041662#ifdef LIBXML_WRITER_ENABLED
41663 int mem_base;
41664 int ret_val;
41665 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41666 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041667 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041668 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041669 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041670 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041671 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041672 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041673
Daniel Veillarde43cc572004-11-03 11:50:29 +000041674 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41675 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41676 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41677 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041679 writer = gen_xmlTextWriterPtr(n_writer, 0);
41680 name = gen_const_xmlChar_ptr(n_name, 1);
41681 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41682 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041683
William M. Brackf13f77f2004-11-12 16:03:48 +000041684 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041685 desret_int(ret_val);
41686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041687 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041688 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41689 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41690 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041691 xmlResetLastError();
41692 if (mem_base != xmlMemBlocks()) {
41693 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041695 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041696 printf(" %d", n_writer);
41697 printf(" %d", n_name);
41698 printf(" %d", n_pubid);
41699 printf(" %d", n_sysid);
41700 printf("\n");
41701 }
41702 }
41703 }
41704 }
41705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041706 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041707#endif
41708
Daniel Veillard42595322004-11-08 10:52:06 +000041709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041710}
41711
41712
41713static int
41714test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041716
Daniel Veillarde43cc572004-11-03 11:50:29 +000041717#ifdef LIBXML_WRITER_ENABLED
41718 int mem_base;
41719 int ret_val;
41720 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41721 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041722 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041723 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041724 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041725 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041726
Daniel Veillarde43cc572004-11-03 11:50:29 +000041727 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41728 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41729 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41730 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041731 writer = gen_xmlTextWriterPtr(n_writer, 0);
41732 name = gen_const_xmlChar_ptr(n_name, 1);
41733 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041734
William M. Brackf13f77f2004-11-12 16:03:48 +000041735 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041736 desret_int(ret_val);
41737 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041738 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041739 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41740 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041741 xmlResetLastError();
41742 if (mem_base != xmlMemBlocks()) {
41743 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041745 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041746 printf(" %d", n_writer);
41747 printf(" %d", n_name);
41748 printf(" %d", n_content);
41749 printf("\n");
41750 }
41751 }
41752 }
41753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041754 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041755#endif
41756
Daniel Veillard42595322004-11-08 10:52:06 +000041757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041758}
41759
41760
41761static int
41762test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041764
Daniel Veillarde43cc572004-11-03 11:50:29 +000041765#ifdef LIBXML_WRITER_ENABLED
41766 int mem_base;
41767 int ret_val;
41768 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41769 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041770 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041771 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041772 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041773 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041774 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041775 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041776 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041777 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041778
Daniel Veillarde43cc572004-11-03 11:50:29 +000041779 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41780 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41781 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41782 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41783 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41784 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041785 writer = gen_xmlTextWriterPtr(n_writer, 0);
41786 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41787 name = gen_const_xmlChar_ptr(n_name, 2);
41788 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41789 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041790
William M. Brackf13f77f2004-11-12 16:03:48 +000041791 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041792 desret_int(ret_val);
41793 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041794 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041795 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41796 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41797 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41798 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041799 xmlResetLastError();
41800 if (mem_base != xmlMemBlocks()) {
41801 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041803 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041804 printf(" %d", n_writer);
41805 printf(" %d", n_prefix);
41806 printf(" %d", n_name);
41807 printf(" %d", n_namespaceURI);
41808 printf(" %d", n_content);
41809 printf("\n");
41810 }
41811 }
41812 }
41813 }
41814 }
41815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041816 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041817#endif
41818
Daniel Veillard42595322004-11-08 10:52:06 +000041819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041820}
41821
41822
41823static int
41824test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041826
41827
41828 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041830}
41831
41832
41833static int
41834test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041836
41837
41838 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041840}
41841
41842
41843static int
41844test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041846
41847
41848 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041850}
41851
41852
41853static int
41854test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041856
41857
41858 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041860}
41861
41862
41863static int
41864test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041866
41867
41868 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041870}
41871
41872
41873static int
41874test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041876
41877
41878 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041880}
41881
41882
41883static int
41884test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041886
41887
41888 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041890}
41891
41892
41893static int
41894test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041896
41897
41898 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041900}
41901
41902
41903static int
41904test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041906
41907
41908 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041910}
41911
41912
41913static int
41914test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041916
41917
41918 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041920}
41921
41922
41923static int
41924test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041926
41927
41928 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041930}
41931
41932
41933static int
41934test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041936
41937
41938 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041940}
41941
41942
41943static int
41944test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041946
41947
41948 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041950}
41951
41952
41953static int
41954test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041956
Daniel Veillarde43cc572004-11-03 11:50:29 +000041957#ifdef LIBXML_WRITER_ENABLED
41958 int mem_base;
41959 int ret_val;
41960 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41961 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041962 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041963 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041964 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041965 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041966
Daniel Veillarde43cc572004-11-03 11:50:29 +000041967 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41968 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41969 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41970 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041971 writer = gen_xmlTextWriterPtr(n_writer, 0);
41972 target = gen_const_xmlChar_ptr(n_target, 1);
41973 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041974
William M. Brackf13f77f2004-11-12 16:03:48 +000041975 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041976 desret_int(ret_val);
41977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041978 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041979 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
41980 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041981 xmlResetLastError();
41982 if (mem_base != xmlMemBlocks()) {
41983 printf("Leak of %d blocks found in xmlTextWriterWritePI",
41984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041985 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041986 printf(" %d", n_writer);
41987 printf(" %d", n_target);
41988 printf(" %d", n_content);
41989 printf("\n");
41990 }
41991 }
41992 }
41993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041994 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041995#endif
41996
Daniel Veillard42595322004-11-08 10:52:06 +000041997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041998}
41999
42000
42001static int
42002test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042004
Daniel Veillarde43cc572004-11-03 11:50:29 +000042005#ifdef LIBXML_WRITER_ENABLED
42006 int mem_base;
42007 int ret_val;
42008 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42009 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042010 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042011 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042012
Daniel Veillarde43cc572004-11-03 11:50:29 +000042013 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42014 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042016 writer = gen_xmlTextWriterPtr(n_writer, 0);
42017 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042018
William M. Brackf13f77f2004-11-12 16:03:48 +000042019 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042020 desret_int(ret_val);
42021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042022 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042023 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042024 xmlResetLastError();
42025 if (mem_base != xmlMemBlocks()) {
42026 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042028 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042029 printf(" %d", n_writer);
42030 printf(" %d", n_content);
42031 printf("\n");
42032 }
42033 }
42034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042035 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042036#endif
42037
Daniel Veillard42595322004-11-08 10:52:06 +000042038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042039}
42040
42041
42042static int
42043test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042045
Daniel Veillarde43cc572004-11-03 11:50:29 +000042046#ifdef LIBXML_WRITER_ENABLED
42047 int mem_base;
42048 int ret_val;
42049 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42050 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042051 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042052 int n_content;
42053 int len; /* length of the text string */
42054 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042055
Daniel Veillarde43cc572004-11-03 11:50:29 +000042056 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42057 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42058 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042060 writer = gen_xmlTextWriterPtr(n_writer, 0);
42061 content = gen_const_xmlChar_ptr(n_content, 1);
42062 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042063
William M. Brackf13f77f2004-11-12 16:03:48 +000042064 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042065 desret_int(ret_val);
42066 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042067 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042068 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042069 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042070 xmlResetLastError();
42071 if (mem_base != xmlMemBlocks()) {
42072 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042074 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042075 printf(" %d", n_writer);
42076 printf(" %d", n_content);
42077 printf(" %d", n_len);
42078 printf("\n");
42079 }
42080 }
42081 }
42082 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042083 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042084#endif
42085
Daniel Veillard42595322004-11-08 10:52:06 +000042086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042087}
42088
42089
42090static int
42091test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042093
Daniel Veillarde43cc572004-11-03 11:50:29 +000042094#ifdef LIBXML_WRITER_ENABLED
42095 int mem_base;
42096 int ret_val;
42097 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42098 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042099 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042100 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042101
Daniel Veillarde43cc572004-11-03 11:50:29 +000042102 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42103 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42104 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042105 writer = gen_xmlTextWriterPtr(n_writer, 0);
42106 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042107
William M. Brackf13f77f2004-11-12 16:03:48 +000042108 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042109 desret_int(ret_val);
42110 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042111 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042112 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042113 xmlResetLastError();
42114 if (mem_base != xmlMemBlocks()) {
42115 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042117 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042118 printf(" %d", n_writer);
42119 printf(" %d", n_content);
42120 printf("\n");
42121 }
42122 }
42123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042124 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042125#endif
42126
Daniel Veillard42595322004-11-08 10:52:06 +000042127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042128}
42129
42130
42131static int
42132test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042134
42135
42136 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042138}
42139
42140
42141static int
42142test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042144
42145
42146 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042148}
42149
42150
42151static int
42152test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042154
42155
42156 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042158}
42159
42160
42161static int
42162test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042164
42165
42166 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042168}
42169
42170
42171static int
42172test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042174
42175
42176 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042178}
42179
42180
42181static int
42182test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042184
42185
42186 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042188}
42189
42190
42191static int
42192test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042194
42195
42196 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042198}
42199
42200
42201static int
42202test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042204
42205
42206 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042208}
42209
42210
42211static int
42212test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042214
42215
42216 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042218}
42219
42220
42221static int
42222test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042224
42225
42226 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042228}
42229
42230
42231static int
42232test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042234
42235
42236 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042238}
42239
42240
42241static int
42242test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042244
42245
42246 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042248}
42249
42250
42251static int
42252test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042254
42255
42256 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042258}
42259
42260static int
42261test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042263
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042264 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042265 test_ret += test_xmlNewTextWriter();
42266 test_ret += test_xmlNewTextWriterFilename();
42267 test_ret += test_xmlNewTextWriterMemory();
42268 test_ret += test_xmlNewTextWriterPushParser();
42269 test_ret += test_xmlNewTextWriterTree();
42270 test_ret += test_xmlTextWriterEndAttribute();
42271 test_ret += test_xmlTextWriterEndCDATA();
42272 test_ret += test_xmlTextWriterEndComment();
42273 test_ret += test_xmlTextWriterEndDTD();
42274 test_ret += test_xmlTextWriterEndDTDAttlist();
42275 test_ret += test_xmlTextWriterEndDTDElement();
42276 test_ret += test_xmlTextWriterEndDTDEntity();
42277 test_ret += test_xmlTextWriterEndDocument();
42278 test_ret += test_xmlTextWriterEndElement();
42279 test_ret += test_xmlTextWriterEndPI();
42280 test_ret += test_xmlTextWriterFlush();
42281 test_ret += test_xmlTextWriterFullEndElement();
42282 test_ret += test_xmlTextWriterSetIndent();
42283 test_ret += test_xmlTextWriterSetIndentString();
42284 test_ret += test_xmlTextWriterStartAttribute();
42285 test_ret += test_xmlTextWriterStartAttributeNS();
42286 test_ret += test_xmlTextWriterStartCDATA();
42287 test_ret += test_xmlTextWriterStartComment();
42288 test_ret += test_xmlTextWriterStartDTD();
42289 test_ret += test_xmlTextWriterStartDTDAttlist();
42290 test_ret += test_xmlTextWriterStartDTDElement();
42291 test_ret += test_xmlTextWriterStartDTDEntity();
42292 test_ret += test_xmlTextWriterStartDocument();
42293 test_ret += test_xmlTextWriterStartElement();
42294 test_ret += test_xmlTextWriterStartElementNS();
42295 test_ret += test_xmlTextWriterStartPI();
42296 test_ret += test_xmlTextWriterWriteAttribute();
42297 test_ret += test_xmlTextWriterWriteAttributeNS();
42298 test_ret += test_xmlTextWriterWriteBase64();
42299 test_ret += test_xmlTextWriterWriteBinHex();
42300 test_ret += test_xmlTextWriterWriteCDATA();
42301 test_ret += test_xmlTextWriterWriteComment();
42302 test_ret += test_xmlTextWriterWriteDTD();
42303 test_ret += test_xmlTextWriterWriteDTDAttlist();
42304 test_ret += test_xmlTextWriterWriteDTDElement();
42305 test_ret += test_xmlTextWriterWriteDTDEntity();
42306 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42307 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42308 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42309 test_ret += test_xmlTextWriterWriteDTDNotation();
42310 test_ret += test_xmlTextWriterWriteElement();
42311 test_ret += test_xmlTextWriterWriteElementNS();
42312 test_ret += test_xmlTextWriterWriteFormatAttribute();
42313 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42314 test_ret += test_xmlTextWriterWriteFormatCDATA();
42315 test_ret += test_xmlTextWriterWriteFormatComment();
42316 test_ret += test_xmlTextWriterWriteFormatDTD();
42317 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42318 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42319 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42320 test_ret += test_xmlTextWriterWriteFormatElement();
42321 test_ret += test_xmlTextWriterWriteFormatElementNS();
42322 test_ret += test_xmlTextWriterWriteFormatPI();
42323 test_ret += test_xmlTextWriterWriteFormatRaw();
42324 test_ret += test_xmlTextWriterWriteFormatString();
42325 test_ret += test_xmlTextWriterWritePI();
42326 test_ret += test_xmlTextWriterWriteRaw();
42327 test_ret += test_xmlTextWriterWriteRawLen();
42328 test_ret += test_xmlTextWriterWriteString();
42329 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42330 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42331 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42332 test_ret += test_xmlTextWriterWriteVFormatComment();
42333 test_ret += test_xmlTextWriterWriteVFormatDTD();
42334 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42335 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42336 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42337 test_ret += test_xmlTextWriterWriteVFormatElement();
42338 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42339 test_ret += test_xmlTextWriterWriteVFormatPI();
42340 test_ret += test_xmlTextWriterWriteVFormatRaw();
42341 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042342
Daniel Veillard42595322004-11-08 10:52:06 +000042343 if (test_ret != 0)
42344 printf("Module xmlwriter: %d errors\n", test_ret);
42345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042346}
42347
42348static int
42349test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042351
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042352#ifdef LIBXML_XPATH_ENABLED
42353 int mem_base;
42354 double ret_val;
42355 int val; /* a boolean */
42356 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042357
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042358 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42359 mem_base = xmlMemBlocks();
42360 val = gen_int(n_val, 0);
42361
42362 ret_val = xmlXPathCastBooleanToNumber(val);
42363 desret_double(ret_val);
42364 call_tests++;
42365 des_int(n_val, val, 0);
42366 xmlResetLastError();
42367 if (mem_base != xmlMemBlocks()) {
42368 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42369 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042370 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042371 printf(" %d", n_val);
42372 printf("\n");
42373 }
42374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042375 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042376#endif
42377
Daniel Veillard42595322004-11-08 10:52:06 +000042378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042379}
42380
42381
42382static int
42383test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042385
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042386#ifdef LIBXML_XPATH_ENABLED
42387 int mem_base;
42388 xmlChar * ret_val;
42389 int val; /* a boolean */
42390 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042391
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042392 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042394 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042395
42396 ret_val = xmlXPathCastBooleanToString(val);
42397 desret_xmlChar_ptr(ret_val);
42398 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042399 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042400 xmlResetLastError();
42401 if (mem_base != xmlMemBlocks()) {
42402 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042404 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042405 printf(" %d", n_val);
42406 printf("\n");
42407 }
42408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042409 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042410#endif
42411
Daniel Veillard42595322004-11-08 10:52:06 +000042412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042413}
42414
42415
42416static int
42417test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042419
Daniel Veillardce682bc2004-11-05 17:22:25 +000042420#ifdef LIBXML_XPATH_ENABLED
42421 int mem_base;
42422 int ret_val;
42423 xmlNodeSetPtr ns; /* a node-set */
42424 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042425
Daniel Veillardce682bc2004-11-05 17:22:25 +000042426 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42427 mem_base = xmlMemBlocks();
42428 ns = gen_xmlNodeSetPtr(n_ns, 0);
42429
42430 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42431 desret_int(ret_val);
42432 call_tests++;
42433 des_xmlNodeSetPtr(n_ns, ns, 0);
42434 xmlResetLastError();
42435 if (mem_base != xmlMemBlocks()) {
42436 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042438 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042439 printf(" %d", n_ns);
42440 printf("\n");
42441 }
42442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042443 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042444#endif
42445
Daniel Veillard42595322004-11-08 10:52:06 +000042446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042447}
42448
42449
42450static int
42451test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042453
Daniel Veillardce682bc2004-11-05 17:22:25 +000042454#ifdef LIBXML_XPATH_ENABLED
42455 int mem_base;
42456 double ret_val;
42457 xmlNodeSetPtr ns; /* a node-set */
42458 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042459
Daniel Veillardce682bc2004-11-05 17:22:25 +000042460 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42461 mem_base = xmlMemBlocks();
42462 ns = gen_xmlNodeSetPtr(n_ns, 0);
42463
42464 ret_val = xmlXPathCastNodeSetToNumber(ns);
42465 desret_double(ret_val);
42466 call_tests++;
42467 des_xmlNodeSetPtr(n_ns, ns, 0);
42468 xmlResetLastError();
42469 if (mem_base != xmlMemBlocks()) {
42470 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042472 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042473 printf(" %d", n_ns);
42474 printf("\n");
42475 }
42476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042477 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042478#endif
42479
Daniel Veillard42595322004-11-08 10:52:06 +000042480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042481}
42482
42483
42484static int
42485test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042487
Daniel Veillardce682bc2004-11-05 17:22:25 +000042488#ifdef LIBXML_XPATH_ENABLED
42489 int mem_base;
42490 xmlChar * ret_val;
42491 xmlNodeSetPtr ns; /* a node-set */
42492 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042493
Daniel Veillardce682bc2004-11-05 17:22:25 +000042494 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42495 mem_base = xmlMemBlocks();
42496 ns = gen_xmlNodeSetPtr(n_ns, 0);
42497
42498 ret_val = xmlXPathCastNodeSetToString(ns);
42499 desret_xmlChar_ptr(ret_val);
42500 call_tests++;
42501 des_xmlNodeSetPtr(n_ns, ns, 0);
42502 xmlResetLastError();
42503 if (mem_base != xmlMemBlocks()) {
42504 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042506 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042507 printf(" %d", n_ns);
42508 printf("\n");
42509 }
42510 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042511 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042512#endif
42513
Daniel Veillard42595322004-11-08 10:52:06 +000042514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042515}
42516
42517
42518static int
42519test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042521
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042522#ifdef LIBXML_XPATH_ENABLED
42523 int mem_base;
42524 double ret_val;
42525 xmlNodePtr node; /* a node */
42526 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042527
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042528 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42529 mem_base = xmlMemBlocks();
42530 node = gen_xmlNodePtr(n_node, 0);
42531
42532 ret_val = xmlXPathCastNodeToNumber(node);
42533 desret_double(ret_val);
42534 call_tests++;
42535 des_xmlNodePtr(n_node, node, 0);
42536 xmlResetLastError();
42537 if (mem_base != xmlMemBlocks()) {
42538 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042540 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042541 printf(" %d", n_node);
42542 printf("\n");
42543 }
42544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042545 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042546#endif
42547
Daniel Veillard42595322004-11-08 10:52:06 +000042548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042549}
42550
42551
42552static int
42553test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042555
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042556#ifdef LIBXML_XPATH_ENABLED
42557 int mem_base;
42558 xmlChar * ret_val;
42559 xmlNodePtr node; /* a node */
42560 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042561
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042562 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42563 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042564 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042565
42566 ret_val = xmlXPathCastNodeToString(node);
42567 desret_xmlChar_ptr(ret_val);
42568 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042569 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042570 xmlResetLastError();
42571 if (mem_base != xmlMemBlocks()) {
42572 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042574 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042575 printf(" %d", n_node);
42576 printf("\n");
42577 }
42578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042579 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042580#endif
42581
Daniel Veillard42595322004-11-08 10:52:06 +000042582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042583}
42584
42585
42586static int
42587test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042589
Daniel Veillard3d95c732004-11-06 22:25:14 +000042590#ifdef LIBXML_XPATH_ENABLED
42591 int mem_base;
42592 int ret_val;
42593 double val; /* a number */
42594 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042595
Daniel Veillard3d95c732004-11-06 22:25:14 +000042596 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42597 mem_base = xmlMemBlocks();
42598 val = gen_double(n_val, 0);
42599
42600 ret_val = xmlXPathCastNumberToBoolean(val);
42601 desret_int(ret_val);
42602 call_tests++;
42603 des_double(n_val, val, 0);
42604 xmlResetLastError();
42605 if (mem_base != xmlMemBlocks()) {
42606 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042608 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042609 printf(" %d", n_val);
42610 printf("\n");
42611 }
42612 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042613 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042614#endif
42615
Daniel Veillard42595322004-11-08 10:52:06 +000042616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042617}
42618
42619
42620static int
42621test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042623
Daniel Veillard3d95c732004-11-06 22:25:14 +000042624#ifdef LIBXML_XPATH_ENABLED
42625 int mem_base;
42626 xmlChar * ret_val;
42627 double val; /* a number */
42628 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042629
Daniel Veillard3d95c732004-11-06 22:25:14 +000042630 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42631 mem_base = xmlMemBlocks();
42632 val = gen_double(n_val, 0);
42633
42634 ret_val = xmlXPathCastNumberToString(val);
42635 desret_xmlChar_ptr(ret_val);
42636 call_tests++;
42637 des_double(n_val, val, 0);
42638 xmlResetLastError();
42639 if (mem_base != xmlMemBlocks()) {
42640 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042642 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042643 printf(" %d", n_val);
42644 printf("\n");
42645 }
42646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042647 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042648#endif
42649
Daniel Veillard42595322004-11-08 10:52:06 +000042650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042651}
42652
42653
42654static int
42655test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042657
42658#ifdef LIBXML_XPATH_ENABLED
42659 int mem_base;
42660 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042661 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042662 int n_val;
42663
42664 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42665 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042666 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042667
William M. Brackf13f77f2004-11-12 16:03:48 +000042668 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042669 desret_int(ret_val);
42670 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042671 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042672 xmlResetLastError();
42673 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042674 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042676 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042677 printf(" %d", n_val);
42678 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042679 }
42680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042681 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042682#endif
42683
Daniel Veillard42595322004-11-08 10:52:06 +000042684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042685}
42686
42687
42688static int
42689test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042691
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042692#ifdef LIBXML_XPATH_ENABLED
42693 int mem_base;
42694 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042695 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042696 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042697
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042698 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42699 mem_base = xmlMemBlocks();
42700 val = gen_const_xmlChar_ptr(n_val, 0);
42701
William M. Brackf13f77f2004-11-12 16:03:48 +000042702 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042703 desret_double(ret_val);
42704 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042705 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042706 xmlResetLastError();
42707 if (mem_base != xmlMemBlocks()) {
42708 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42709 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042710 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042711 printf(" %d", n_val);
42712 printf("\n");
42713 }
42714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042715 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042716#endif
42717
Daniel Veillard42595322004-11-08 10:52:06 +000042718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042719}
42720
42721
42722static int
42723test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042725
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042726#ifdef LIBXML_XPATH_ENABLED
42727 int mem_base;
42728 int ret_val;
42729 xmlXPathObjectPtr val; /* an XPath object */
42730 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042731
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042732 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042734 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042735
42736 ret_val = xmlXPathCastToBoolean(val);
42737 desret_int(ret_val);
42738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042739 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042740 xmlResetLastError();
42741 if (mem_base != xmlMemBlocks()) {
42742 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042744 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042745 printf(" %d", n_val);
42746 printf("\n");
42747 }
42748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042749 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042750#endif
42751
Daniel Veillard42595322004-11-08 10:52:06 +000042752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042753}
42754
42755
42756static int
42757test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042759
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042760#ifdef LIBXML_XPATH_ENABLED
42761 int mem_base;
42762 double ret_val;
42763 xmlXPathObjectPtr val; /* an XPath object */
42764 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042765
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042766 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42767 mem_base = xmlMemBlocks();
42768 val = gen_xmlXPathObjectPtr(n_val, 0);
42769
42770 ret_val = xmlXPathCastToNumber(val);
42771 desret_double(ret_val);
42772 call_tests++;
42773 des_xmlXPathObjectPtr(n_val, val, 0);
42774 xmlResetLastError();
42775 if (mem_base != xmlMemBlocks()) {
42776 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042778 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042779 printf(" %d", n_val);
42780 printf("\n");
42781 }
42782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042783 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042784#endif
42785
Daniel Veillard42595322004-11-08 10:52:06 +000042786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042787}
42788
42789
42790static int
42791test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042793
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042794#ifdef LIBXML_XPATH_ENABLED
42795 int mem_base;
42796 xmlChar * ret_val;
42797 xmlXPathObjectPtr val; /* an XPath object */
42798 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042799
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042800 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42801 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042802 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042803
42804 ret_val = xmlXPathCastToString(val);
42805 desret_xmlChar_ptr(ret_val);
42806 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042807 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042808 xmlResetLastError();
42809 if (mem_base != xmlMemBlocks()) {
42810 printf("Leak of %d blocks found in xmlXPathCastToString",
42811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042812 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042813 printf(" %d", n_val);
42814 printf("\n");
42815 }
42816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042817 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042818#endif
42819
Daniel Veillard42595322004-11-08 10:52:06 +000042820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042821}
42822
42823
42824static int
42825test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042827
42828#ifdef LIBXML_XPATH_ENABLED
42829 int mem_base;
42830 int ret_val;
42831 xmlNodePtr node1; /* the first node */
42832 int n_node1;
42833 xmlNodePtr node2; /* the second node */
42834 int n_node2;
42835
42836 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42837 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42838 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042839 node1 = gen_xmlNodePtr(n_node1, 0);
42840 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042841
42842 ret_val = xmlXPathCmpNodes(node1, node2);
42843 desret_int(ret_val);
42844 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042845 des_xmlNodePtr(n_node1, node1, 0);
42846 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042847 xmlResetLastError();
42848 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042849 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042851 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042852 printf(" %d", n_node1);
42853 printf(" %d", n_node2);
42854 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042855 }
42856 }
42857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042858 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042859#endif
42860
Daniel Veillard42595322004-11-08 10:52:06 +000042861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042862}
42863
42864
42865static int
42866test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042868
42869
42870 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042872}
42873
Daniel Veillarda521d282004-11-09 14:59:59 +000042874#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000042875
Daniel Veillardce682bc2004-11-05 17:22:25 +000042876#define gen_nb_xmlXPathCompExprPtr 1
42877static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42878 return(NULL);
42879}
42880static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42881}
Daniel Veillarda521d282004-11-09 14:59:59 +000042882#endif
42883
42884#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000042885
42886#define gen_nb_xmlXPathContextPtr 1
42887static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42888 return(NULL);
42889}
42890static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42891}
Daniel Veillarda521d282004-11-09 14:59:59 +000042892#endif
42893
Daniel Veillardce682bc2004-11-05 17:22:25 +000042894
Daniel Veillardd93f6252004-11-02 15:53:51 +000042895static int
42896test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042898
Daniel Veillardce682bc2004-11-05 17:22:25 +000042899#ifdef LIBXML_XPATH_ENABLED
42900 int mem_base;
42901 xmlXPathObjectPtr ret_val;
42902 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
42903 int n_comp;
42904 xmlXPathContextPtr ctx; /* the XPath context */
42905 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042906
Daniel Veillardce682bc2004-11-05 17:22:25 +000042907 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
42908 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42909 mem_base = xmlMemBlocks();
42910 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
42911 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42912
42913 ret_val = xmlXPathCompiledEval(comp, ctx);
42914 desret_xmlXPathObjectPtr(ret_val);
42915 call_tests++;
42916 des_xmlXPathCompExprPtr(n_comp, comp, 0);
42917 des_xmlXPathContextPtr(n_ctx, ctx, 1);
42918 xmlResetLastError();
42919 if (mem_base != xmlMemBlocks()) {
42920 printf("Leak of %d blocks found in xmlXPathCompiledEval",
42921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042922 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042923 printf(" %d", n_comp);
42924 printf(" %d", n_ctx);
42925 printf("\n");
42926 }
42927 }
42928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042929 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042930#endif
42931
Daniel Veillard42595322004-11-08 10:52:06 +000042932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042933}
42934
42935
42936static int
42937test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042939
Daniel Veillard3d97e662004-11-04 10:49:00 +000042940#ifdef LIBXML_XPATH_ENABLED
42941 int mem_base;
42942 xmlXPathObjectPtr ret_val;
42943 xmlXPathObjectPtr val; /* an XPath object */
42944 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042945
Daniel Veillard3d97e662004-11-04 10:49:00 +000042946 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42947 mem_base = xmlMemBlocks();
42948 val = gen_xmlXPathObjectPtr(n_val, 0);
42949
42950 ret_val = xmlXPathConvertBoolean(val);
42951 val = NULL;
42952 desret_xmlXPathObjectPtr(ret_val);
42953 call_tests++;
42954 des_xmlXPathObjectPtr(n_val, val, 0);
42955 xmlResetLastError();
42956 if (mem_base != xmlMemBlocks()) {
42957 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
42958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042959 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042960 printf(" %d", n_val);
42961 printf("\n");
42962 }
42963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042964 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042965#endif
42966
Daniel Veillard42595322004-11-08 10:52:06 +000042967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042968}
42969
42970
42971static int
42972test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042974
Daniel Veillard3d97e662004-11-04 10:49:00 +000042975#ifdef LIBXML_XPATH_ENABLED
42976 int mem_base;
42977 xmlXPathObjectPtr ret_val;
42978 xmlXPathObjectPtr val; /* an XPath object */
42979 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042980
Daniel Veillard3d97e662004-11-04 10:49:00 +000042981 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42982 mem_base = xmlMemBlocks();
42983 val = gen_xmlXPathObjectPtr(n_val, 0);
42984
42985 ret_val = xmlXPathConvertNumber(val);
42986 val = NULL;
42987 desret_xmlXPathObjectPtr(ret_val);
42988 call_tests++;
42989 des_xmlXPathObjectPtr(n_val, val, 0);
42990 xmlResetLastError();
42991 if (mem_base != xmlMemBlocks()) {
42992 printf("Leak of %d blocks found in xmlXPathConvertNumber",
42993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042994 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042995 printf(" %d", n_val);
42996 printf("\n");
42997 }
42998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042999 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043000#endif
43001
Daniel Veillard42595322004-11-08 10:52:06 +000043002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043003}
43004
43005
43006static int
43007test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043009
Daniel Veillard3d97e662004-11-04 10:49:00 +000043010#ifdef LIBXML_XPATH_ENABLED
43011 int mem_base;
43012 xmlXPathObjectPtr ret_val;
43013 xmlXPathObjectPtr val; /* an XPath object */
43014 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043015
Daniel Veillard3d97e662004-11-04 10:49:00 +000043016 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43017 mem_base = xmlMemBlocks();
43018 val = gen_xmlXPathObjectPtr(n_val, 0);
43019
43020 ret_val = xmlXPathConvertString(val);
43021 val = NULL;
43022 desret_xmlXPathObjectPtr(ret_val);
43023 call_tests++;
43024 des_xmlXPathObjectPtr(n_val, val, 0);
43025 xmlResetLastError();
43026 if (mem_base != xmlMemBlocks()) {
43027 printf("Leak of %d blocks found in xmlXPathConvertString",
43028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043029 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043030 printf(" %d", n_val);
43031 printf("\n");
43032 }
43033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043034 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043035#endif
43036
Daniel Veillard42595322004-11-08 10:52:06 +000043037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043038}
43039
43040
43041static int
43042test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043044
43045
43046 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043048}
43049
43050
43051static int
43052test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043054
Daniel Veillardce682bc2004-11-05 17:22:25 +000043055#ifdef LIBXML_XPATH_ENABLED
43056 int mem_base;
43057 xmlXPathObjectPtr ret_val;
43058 xmlChar * str; /* the XPath expression */
43059 int n_str;
43060 xmlXPathContextPtr ctx; /* the XPath context */
43061 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043062
Daniel Veillardce682bc2004-11-05 17:22:25 +000043063 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43064 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43065 mem_base = xmlMemBlocks();
43066 str = gen_const_xmlChar_ptr(n_str, 0);
43067 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43068
William M. Brackf13f77f2004-11-12 16:03:48 +000043069 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043070 desret_xmlXPathObjectPtr(ret_val);
43071 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043072 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043073 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43074 xmlResetLastError();
43075 if (mem_base != xmlMemBlocks()) {
43076 printf("Leak of %d blocks found in xmlXPathEval",
43077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043078 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043079 printf(" %d", n_str);
43080 printf(" %d", n_ctx);
43081 printf("\n");
43082 }
43083 }
43084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043085 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043086#endif
43087
Daniel Veillard42595322004-11-08 10:52:06 +000043088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043089}
43090
43091
43092static int
43093test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043095
Daniel Veillardce682bc2004-11-05 17:22:25 +000043096#ifdef LIBXML_XPATH_ENABLED
43097 int mem_base;
43098 xmlXPathObjectPtr ret_val;
43099 xmlChar * str; /* the XPath expression */
43100 int n_str;
43101 xmlXPathContextPtr ctxt; /* the XPath context */
43102 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043103
Daniel Veillardce682bc2004-11-05 17:22:25 +000043104 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43105 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43106 mem_base = xmlMemBlocks();
43107 str = gen_const_xmlChar_ptr(n_str, 0);
43108 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43109
William M. Brackf13f77f2004-11-12 16:03:48 +000043110 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043111 desret_xmlXPathObjectPtr(ret_val);
43112 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043113 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043114 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43115 xmlResetLastError();
43116 if (mem_base != xmlMemBlocks()) {
43117 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043119 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043120 printf(" %d", n_str);
43121 printf(" %d", n_ctxt);
43122 printf("\n");
43123 }
43124 }
43125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043126 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043127#endif
43128
Daniel Veillard42595322004-11-08 10:52:06 +000043129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043130}
43131
43132
43133static int
43134test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043136
Daniel Veillardce682bc2004-11-05 17:22:25 +000043137#ifdef LIBXML_XPATH_ENABLED
43138 int mem_base;
43139 int ret_val;
43140 xmlXPathContextPtr ctxt; /* the XPath context */
43141 int n_ctxt;
43142 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43143 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043144
Daniel Veillardce682bc2004-11-05 17:22:25 +000043145 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43146 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43147 mem_base = xmlMemBlocks();
43148 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43149 res = gen_xmlXPathObjectPtr(n_res, 1);
43150
43151 ret_val = xmlXPathEvalPredicate(ctxt, res);
43152 desret_int(ret_val);
43153 call_tests++;
43154 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43155 des_xmlXPathObjectPtr(n_res, res, 1);
43156 xmlResetLastError();
43157 if (mem_base != xmlMemBlocks()) {
43158 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043160 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043161 printf(" %d", n_ctxt);
43162 printf(" %d", n_res);
43163 printf("\n");
43164 }
43165 }
43166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043167 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043168#endif
43169
Daniel Veillard42595322004-11-08 10:52:06 +000043170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043171}
43172
43173
43174static int
43175test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043177
43178#ifdef LIBXML_XPATH_ENABLED
43179 int mem_base;
43180
43181 mem_base = xmlMemBlocks();
43182
43183 xmlXPathInit();
43184 call_tests++;
43185 xmlResetLastError();
43186 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043187 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043189 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043190 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043192 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043193#endif
43194
Daniel Veillard42595322004-11-08 10:52:06 +000043195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043196}
43197
43198
43199static int
43200test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043202
Daniel Veillard3d95c732004-11-06 22:25:14 +000043203#ifdef LIBXML_XPATH_ENABLED
43204 int mem_base;
43205 int ret_val;
43206 double val; /* a double value */
43207 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043208
Daniel Veillard3d95c732004-11-06 22:25:14 +000043209 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43210 mem_base = xmlMemBlocks();
43211 val = gen_double(n_val, 0);
43212
43213 ret_val = xmlXPathIsInf(val);
43214 desret_int(ret_val);
43215 call_tests++;
43216 des_double(n_val, val, 0);
43217 xmlResetLastError();
43218 if (mem_base != xmlMemBlocks()) {
43219 printf("Leak of %d blocks found in xmlXPathIsInf",
43220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043221 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043222 printf(" %d", n_val);
43223 printf("\n");
43224 }
43225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043226 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043227#endif
43228
Daniel Veillard42595322004-11-08 10:52:06 +000043229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043230}
43231
43232
43233static int
43234test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043236
Daniel Veillard3d95c732004-11-06 22:25:14 +000043237#ifdef LIBXML_XPATH_ENABLED
43238 int mem_base;
43239 int ret_val;
43240 double val; /* a double value */
43241 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043242
Daniel Veillard3d95c732004-11-06 22:25:14 +000043243 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43244 mem_base = xmlMemBlocks();
43245 val = gen_double(n_val, 0);
43246
43247 ret_val = xmlXPathIsNaN(val);
43248 desret_int(ret_val);
43249 call_tests++;
43250 des_double(n_val, val, 0);
43251 xmlResetLastError();
43252 if (mem_base != xmlMemBlocks()) {
43253 printf("Leak of %d blocks found in xmlXPathIsNaN",
43254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043255 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043256 printf(" %d", n_val);
43257 printf("\n");
43258 }
43259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043260 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043261#endif
43262
Daniel Veillard42595322004-11-08 10:52:06 +000043263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043264}
43265
43266
43267static int
43268test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043270
43271
43272 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043274}
43275
43276
43277static int
43278test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043280
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043281#ifdef LIBXML_XPATH_ENABLED
43282 int mem_base;
43283 xmlNodeSetPtr ret_val;
43284 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43285 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043286
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043287 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43288 mem_base = xmlMemBlocks();
43289 val = gen_xmlNodePtr(n_val, 0);
43290
43291 ret_val = xmlXPathNodeSetCreate(val);
43292 desret_xmlNodeSetPtr(ret_val);
43293 call_tests++;
43294 des_xmlNodePtr(n_val, val, 0);
43295 xmlResetLastError();
43296 if (mem_base != xmlMemBlocks()) {
43297 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43298 xmlMemBlocks() - mem_base);
43299 test_ret++;
43300 printf(" %d", n_val);
43301 printf("\n");
43302 }
43303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043304 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043305#endif
43306
Daniel Veillard42595322004-11-08 10:52:06 +000043307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043308}
43309
43310
43311static int
43312test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043314
Daniel Veillard3d97e662004-11-04 10:49:00 +000043315#ifdef LIBXML_XPATH_ENABLED
43316 int mem_base;
43317 xmlXPathObjectPtr ret_val;
43318 xmlXPathObjectPtr val; /* the original object */
43319 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043320
Daniel Veillard3d97e662004-11-04 10:49:00 +000043321 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43322 mem_base = xmlMemBlocks();
43323 val = gen_xmlXPathObjectPtr(n_val, 0);
43324
43325 ret_val = xmlXPathObjectCopy(val);
43326 desret_xmlXPathObjectPtr(ret_val);
43327 call_tests++;
43328 des_xmlXPathObjectPtr(n_val, val, 0);
43329 xmlResetLastError();
43330 if (mem_base != xmlMemBlocks()) {
43331 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043333 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043334 printf(" %d", n_val);
43335 printf("\n");
43336 }
43337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043338 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043339#endif
43340
Daniel Veillard42595322004-11-08 10:52:06 +000043341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043342}
43343
43344
43345static int
43346test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043348
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043349#ifdef LIBXML_XPATH_ENABLED
43350 int mem_base;
43351 long ret_val;
43352 xmlDocPtr doc; /* an input document */
43353 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043354
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043355 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43356 mem_base = xmlMemBlocks();
43357 doc = gen_xmlDocPtr(n_doc, 0);
43358
43359 ret_val = xmlXPathOrderDocElems(doc);
43360 desret_long(ret_val);
43361 call_tests++;
43362 des_xmlDocPtr(n_doc, doc, 0);
43363 xmlResetLastError();
43364 if (mem_base != xmlMemBlocks()) {
43365 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043367 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043368 printf(" %d", n_doc);
43369 printf("\n");
43370 }
43371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043372 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043373#endif
43374
Daniel Veillard42595322004-11-08 10:52:06 +000043375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043376}
43377
43378static int
43379test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043381
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043382 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043383 test_ret += test_xmlXPathCastBooleanToNumber();
43384 test_ret += test_xmlXPathCastBooleanToString();
43385 test_ret += test_xmlXPathCastNodeSetToBoolean();
43386 test_ret += test_xmlXPathCastNodeSetToNumber();
43387 test_ret += test_xmlXPathCastNodeSetToString();
43388 test_ret += test_xmlXPathCastNodeToNumber();
43389 test_ret += test_xmlXPathCastNodeToString();
43390 test_ret += test_xmlXPathCastNumberToBoolean();
43391 test_ret += test_xmlXPathCastNumberToString();
43392 test_ret += test_xmlXPathCastStringToBoolean();
43393 test_ret += test_xmlXPathCastStringToNumber();
43394 test_ret += test_xmlXPathCastToBoolean();
43395 test_ret += test_xmlXPathCastToNumber();
43396 test_ret += test_xmlXPathCastToString();
43397 test_ret += test_xmlXPathCmpNodes();
43398 test_ret += test_xmlXPathCompile();
43399 test_ret += test_xmlXPathCompiledEval();
43400 test_ret += test_xmlXPathConvertBoolean();
43401 test_ret += test_xmlXPathConvertNumber();
43402 test_ret += test_xmlXPathConvertString();
43403 test_ret += test_xmlXPathCtxtCompile();
43404 test_ret += test_xmlXPathEval();
43405 test_ret += test_xmlXPathEvalExpression();
43406 test_ret += test_xmlXPathEvalPredicate();
43407 test_ret += test_xmlXPathInit();
43408 test_ret += test_xmlXPathIsInf();
43409 test_ret += test_xmlXPathIsNaN();
43410 test_ret += test_xmlXPathNewContext();
43411 test_ret += test_xmlXPathNodeSetCreate();
43412 test_ret += test_xmlXPathObjectCopy();
43413 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043414
Daniel Veillard42595322004-11-08 10:52:06 +000043415 if (test_ret != 0)
43416 printf("Module xpath: %d errors\n", test_ret);
43417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043418}
Daniel Veillarda521d282004-11-09 14:59:59 +000043419#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043420
Daniel Veillarda82b1822004-11-08 16:24:57 +000043421#define gen_nb_xmlXPathParserContextPtr 1
43422static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43423 return(NULL);
43424}
43425static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43426}
Daniel Veillarda521d282004-11-09 14:59:59 +000043427#endif
43428
Daniel Veillarda82b1822004-11-08 16:24:57 +000043429
43430static int
43431test_valuePop(void) {
43432 int test_ret = 0;
43433
43434#ifdef LIBXML_XPATH_ENABLED
43435 int mem_base;
43436 xmlXPathObjectPtr ret_val;
43437 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43438 int n_ctxt;
43439
43440 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43441 mem_base = xmlMemBlocks();
43442 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43443
43444 ret_val = valuePop(ctxt);
43445 desret_xmlXPathObjectPtr(ret_val);
43446 call_tests++;
43447 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43448 xmlResetLastError();
43449 if (mem_base != xmlMemBlocks()) {
43450 printf("Leak of %d blocks found in valuePop",
43451 xmlMemBlocks() - mem_base);
43452 test_ret++;
43453 printf(" %d", n_ctxt);
43454 printf("\n");
43455 }
43456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043457 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043458#endif
43459
Daniel Veillarda82b1822004-11-08 16:24:57 +000043460 return(test_ret);
43461}
43462
43463
43464static int
43465test_valuePush(void) {
43466 int test_ret = 0;
43467
43468#ifdef LIBXML_XPATH_ENABLED
43469 int mem_base;
43470 int ret_val;
43471 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43472 int n_ctxt;
43473 xmlXPathObjectPtr value; /* the XPath object */
43474 int n_value;
43475
43476 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43477 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43478 mem_base = xmlMemBlocks();
43479 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43480 value = gen_xmlXPathObjectPtr(n_value, 1);
43481
43482 ret_val = valuePush(ctxt, value);
43483 desret_int(ret_val);
43484 call_tests++;
43485 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43486 des_xmlXPathObjectPtr(n_value, value, 1);
43487 xmlResetLastError();
43488 if (mem_base != xmlMemBlocks()) {
43489 printf("Leak of %d blocks found in valuePush",
43490 xmlMemBlocks() - mem_base);
43491 test_ret++;
43492 printf(" %d", n_ctxt);
43493 printf(" %d", n_value);
43494 printf("\n");
43495 }
43496 }
43497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043498 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043499#endif
43500
Daniel Veillarda82b1822004-11-08 16:24:57 +000043501 return(test_ret);
43502}
43503
43504
43505static int
43506test_xmlXPathAddValues(void) {
43507 int test_ret = 0;
43508
43509#ifdef LIBXML_XPATH_ENABLED
43510 int mem_base;
43511 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43512 int n_ctxt;
43513
43514 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43515 mem_base = xmlMemBlocks();
43516 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43517
43518 xmlXPathAddValues(ctxt);
43519 call_tests++;
43520 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43521 xmlResetLastError();
43522 if (mem_base != xmlMemBlocks()) {
43523 printf("Leak of %d blocks found in xmlXPathAddValues",
43524 xmlMemBlocks() - mem_base);
43525 test_ret++;
43526 printf(" %d", n_ctxt);
43527 printf("\n");
43528 }
43529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043530 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043531#endif
43532
Daniel Veillarda82b1822004-11-08 16:24:57 +000043533 return(test_ret);
43534}
43535
43536
43537static int
43538test_xmlXPathBooleanFunction(void) {
43539 int test_ret = 0;
43540
43541#ifdef LIBXML_XPATH_ENABLED
43542 int mem_base;
43543 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43544 int n_ctxt;
43545 int nargs; /* the number of arguments */
43546 int n_nargs;
43547
43548 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43549 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43550 mem_base = xmlMemBlocks();
43551 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43552 nargs = gen_int(n_nargs, 1);
43553
43554 xmlXPathBooleanFunction(ctxt, nargs);
43555 call_tests++;
43556 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43557 des_int(n_nargs, nargs, 1);
43558 xmlResetLastError();
43559 if (mem_base != xmlMemBlocks()) {
43560 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43561 xmlMemBlocks() - mem_base);
43562 test_ret++;
43563 printf(" %d", n_ctxt);
43564 printf(" %d", n_nargs);
43565 printf("\n");
43566 }
43567 }
43568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043569 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043570#endif
43571
Daniel Veillarda82b1822004-11-08 16:24:57 +000043572 return(test_ret);
43573}
43574
43575
43576static int
43577test_xmlXPathCeilingFunction(void) {
43578 int test_ret = 0;
43579
43580#ifdef LIBXML_XPATH_ENABLED
43581 int mem_base;
43582 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43583 int n_ctxt;
43584 int nargs; /* the number of arguments */
43585 int n_nargs;
43586
43587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43588 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43589 mem_base = xmlMemBlocks();
43590 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43591 nargs = gen_int(n_nargs, 1);
43592
43593 xmlXPathCeilingFunction(ctxt, nargs);
43594 call_tests++;
43595 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43596 des_int(n_nargs, nargs, 1);
43597 xmlResetLastError();
43598 if (mem_base != xmlMemBlocks()) {
43599 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43600 xmlMemBlocks() - mem_base);
43601 test_ret++;
43602 printf(" %d", n_ctxt);
43603 printf(" %d", n_nargs);
43604 printf("\n");
43605 }
43606 }
43607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043608 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043609#endif
43610
Daniel Veillarda82b1822004-11-08 16:24:57 +000043611 return(test_ret);
43612}
43613
43614
43615static int
43616test_xmlXPathCompareValues(void) {
43617 int test_ret = 0;
43618
43619#ifdef LIBXML_XPATH_ENABLED
43620 int mem_base;
43621 int ret_val;
43622 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43623 int n_ctxt;
43624 int inf; /* less than (1) or greater than (0) */
43625 int n_inf;
43626 int strict; /* is the comparison strict */
43627 int n_strict;
43628
43629 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43630 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43631 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43632 mem_base = xmlMemBlocks();
43633 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43634 inf = gen_int(n_inf, 1);
43635 strict = gen_int(n_strict, 2);
43636
43637 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43638 desret_int(ret_val);
43639 call_tests++;
43640 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43641 des_int(n_inf, inf, 1);
43642 des_int(n_strict, strict, 2);
43643 xmlResetLastError();
43644 if (mem_base != xmlMemBlocks()) {
43645 printf("Leak of %d blocks found in xmlXPathCompareValues",
43646 xmlMemBlocks() - mem_base);
43647 test_ret++;
43648 printf(" %d", n_ctxt);
43649 printf(" %d", n_inf);
43650 printf(" %d", n_strict);
43651 printf("\n");
43652 }
43653 }
43654 }
43655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043656 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043657#endif
43658
Daniel Veillarda82b1822004-11-08 16:24:57 +000043659 return(test_ret);
43660}
43661
43662
43663static int
43664test_xmlXPathConcatFunction(void) {
43665 int test_ret = 0;
43666
43667#ifdef LIBXML_XPATH_ENABLED
43668 int mem_base;
43669 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43670 int n_ctxt;
43671 int nargs; /* the number of arguments */
43672 int n_nargs;
43673
43674 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43675 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43676 mem_base = xmlMemBlocks();
43677 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43678 nargs = gen_int(n_nargs, 1);
43679
43680 xmlXPathConcatFunction(ctxt, nargs);
43681 call_tests++;
43682 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43683 des_int(n_nargs, nargs, 1);
43684 xmlResetLastError();
43685 if (mem_base != xmlMemBlocks()) {
43686 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43687 xmlMemBlocks() - mem_base);
43688 test_ret++;
43689 printf(" %d", n_ctxt);
43690 printf(" %d", n_nargs);
43691 printf("\n");
43692 }
43693 }
43694 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043695 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043696#endif
43697
Daniel Veillarda82b1822004-11-08 16:24:57 +000043698 return(test_ret);
43699}
43700
43701
43702static int
43703test_xmlXPathContainsFunction(void) {
43704 int test_ret = 0;
43705
43706#ifdef LIBXML_XPATH_ENABLED
43707 int mem_base;
43708 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43709 int n_ctxt;
43710 int nargs; /* the number of arguments */
43711 int n_nargs;
43712
43713 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43714 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43715 mem_base = xmlMemBlocks();
43716 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43717 nargs = gen_int(n_nargs, 1);
43718
43719 xmlXPathContainsFunction(ctxt, nargs);
43720 call_tests++;
43721 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43722 des_int(n_nargs, nargs, 1);
43723 xmlResetLastError();
43724 if (mem_base != xmlMemBlocks()) {
43725 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43726 xmlMemBlocks() - mem_base);
43727 test_ret++;
43728 printf(" %d", n_ctxt);
43729 printf(" %d", n_nargs);
43730 printf("\n");
43731 }
43732 }
43733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043734 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043735#endif
43736
Daniel Veillarda82b1822004-11-08 16:24:57 +000043737 return(test_ret);
43738}
43739
43740
43741static int
43742test_xmlXPathCountFunction(void) {
43743 int test_ret = 0;
43744
43745#ifdef LIBXML_XPATH_ENABLED
43746 int mem_base;
43747 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43748 int n_ctxt;
43749 int nargs; /* the number of arguments */
43750 int n_nargs;
43751
43752 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43753 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43754 mem_base = xmlMemBlocks();
43755 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43756 nargs = gen_int(n_nargs, 1);
43757
43758 xmlXPathCountFunction(ctxt, nargs);
43759 call_tests++;
43760 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43761 des_int(n_nargs, nargs, 1);
43762 xmlResetLastError();
43763 if (mem_base != xmlMemBlocks()) {
43764 printf("Leak of %d blocks found in xmlXPathCountFunction",
43765 xmlMemBlocks() - mem_base);
43766 test_ret++;
43767 printf(" %d", n_ctxt);
43768 printf(" %d", n_nargs);
43769 printf("\n");
43770 }
43771 }
43772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043773 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043774#endif
43775
Daniel Veillarda82b1822004-11-08 16:24:57 +000043776 return(test_ret);
43777}
43778
43779
43780static int
43781test_xmlXPathDebugDumpCompExpr(void) {
43782 int test_ret = 0;
43783
43784#ifdef LIBXML_XPATH_ENABLED
43785#ifdef LIBXML_DEBUG_ENABLED
43786 int mem_base;
43787 FILE * output; /* the FILE * for the output */
43788 int n_output;
43789 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43790 int n_comp;
43791 int depth; /* the indentation level. */
43792 int n_depth;
43793
43794 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43795 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43796 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43797 mem_base = xmlMemBlocks();
43798 output = gen_FILE_ptr(n_output, 0);
43799 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43800 depth = gen_int(n_depth, 2);
43801
43802 xmlXPathDebugDumpCompExpr(output, comp, depth);
43803 call_tests++;
43804 des_FILE_ptr(n_output, output, 0);
43805 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43806 des_int(n_depth, depth, 2);
43807 xmlResetLastError();
43808 if (mem_base != xmlMemBlocks()) {
43809 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43810 xmlMemBlocks() - mem_base);
43811 test_ret++;
43812 printf(" %d", n_output);
43813 printf(" %d", n_comp);
43814 printf(" %d", n_depth);
43815 printf("\n");
43816 }
43817 }
43818 }
43819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043820 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043821#endif
43822#endif
43823
Daniel Veillarda82b1822004-11-08 16:24:57 +000043824 return(test_ret);
43825}
43826
43827
43828static int
43829test_xmlXPathDebugDumpObject(void) {
43830 int test_ret = 0;
43831
43832#ifdef LIBXML_XPATH_ENABLED
43833#ifdef LIBXML_DEBUG_ENABLED
43834 int mem_base;
43835 FILE * output; /* the FILE * to dump the output */
43836 int n_output;
43837 xmlXPathObjectPtr cur; /* the object to inspect */
43838 int n_cur;
43839 int depth; /* indentation level */
43840 int n_depth;
43841
43842 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43843 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43844 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43845 mem_base = xmlMemBlocks();
43846 output = gen_FILE_ptr(n_output, 0);
43847 cur = gen_xmlXPathObjectPtr(n_cur, 1);
43848 depth = gen_int(n_depth, 2);
43849
43850 xmlXPathDebugDumpObject(output, cur, depth);
43851 call_tests++;
43852 des_FILE_ptr(n_output, output, 0);
43853 des_xmlXPathObjectPtr(n_cur, cur, 1);
43854 des_int(n_depth, depth, 2);
43855 xmlResetLastError();
43856 if (mem_base != xmlMemBlocks()) {
43857 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
43858 xmlMemBlocks() - mem_base);
43859 test_ret++;
43860 printf(" %d", n_output);
43861 printf(" %d", n_cur);
43862 printf(" %d", n_depth);
43863 printf("\n");
43864 }
43865 }
43866 }
43867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043868 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043869#endif
43870#endif
43871
Daniel Veillarda82b1822004-11-08 16:24:57 +000043872 return(test_ret);
43873}
43874
43875
43876static int
43877test_xmlXPathDifference(void) {
43878 int test_ret = 0;
43879
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043880#ifdef LIBXML_XPATH_ENABLED
43881 int mem_base;
43882 xmlNodeSetPtr ret_val;
43883 xmlNodeSetPtr nodes1; /* a node-set */
43884 int n_nodes1;
43885 xmlNodeSetPtr nodes2; /* a node-set */
43886 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043887
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043888 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
43889 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
43890 mem_base = xmlMemBlocks();
43891 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
43892 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
43893
43894 ret_val = xmlXPathDifference(nodes1, nodes2);
43895 desret_xmlNodeSetPtr(ret_val);
43896 call_tests++;
43897 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
43898 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
43899 xmlResetLastError();
43900 if (mem_base != xmlMemBlocks()) {
43901 printf("Leak of %d blocks found in xmlXPathDifference",
43902 xmlMemBlocks() - mem_base);
43903 test_ret++;
43904 printf(" %d", n_nodes1);
43905 printf(" %d", n_nodes2);
43906 printf("\n");
43907 }
43908 }
43909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043910 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043911#endif
43912
Daniel Veillarda82b1822004-11-08 16:24:57 +000043913 return(test_ret);
43914}
43915
43916
43917static int
43918test_xmlXPathDistinct(void) {
43919 int test_ret = 0;
43920
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043921#ifdef LIBXML_XPATH_ENABLED
43922 int mem_base;
43923 xmlNodeSetPtr ret_val;
43924 xmlNodeSetPtr nodes; /* a node-set */
43925 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043926
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043927 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43928 mem_base = xmlMemBlocks();
43929 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43930
43931 ret_val = xmlXPathDistinct(nodes);
43932 desret_xmlNodeSetPtr(ret_val);
43933 call_tests++;
43934 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43935 xmlResetLastError();
43936 if (mem_base != xmlMemBlocks()) {
43937 printf("Leak of %d blocks found in xmlXPathDistinct",
43938 xmlMemBlocks() - mem_base);
43939 test_ret++;
43940 printf(" %d", n_nodes);
43941 printf("\n");
43942 }
43943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043944 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043945#endif
43946
Daniel Veillarda82b1822004-11-08 16:24:57 +000043947 return(test_ret);
43948}
43949
43950
43951static int
43952test_xmlXPathDistinctSorted(void) {
43953 int test_ret = 0;
43954
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043955#ifdef LIBXML_XPATH_ENABLED
43956 int mem_base;
43957 xmlNodeSetPtr ret_val;
43958 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
43959 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043960
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043961 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43962 mem_base = xmlMemBlocks();
43963 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43964
43965 ret_val = xmlXPathDistinctSorted(nodes);
43966 desret_xmlNodeSetPtr(ret_val);
43967 call_tests++;
43968 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43969 xmlResetLastError();
43970 if (mem_base != xmlMemBlocks()) {
43971 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
43972 xmlMemBlocks() - mem_base);
43973 test_ret++;
43974 printf(" %d", n_nodes);
43975 printf("\n");
43976 }
43977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043978 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043979#endif
43980
Daniel Veillarda82b1822004-11-08 16:24:57 +000043981 return(test_ret);
43982}
43983
43984
43985static int
43986test_xmlXPathDivValues(void) {
43987 int test_ret = 0;
43988
43989#ifdef LIBXML_XPATH_ENABLED
43990 int mem_base;
43991 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43992 int n_ctxt;
43993
43994 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43995 mem_base = xmlMemBlocks();
43996 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43997
43998 xmlXPathDivValues(ctxt);
43999 call_tests++;
44000 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44001 xmlResetLastError();
44002 if (mem_base != xmlMemBlocks()) {
44003 printf("Leak of %d blocks found in xmlXPathDivValues",
44004 xmlMemBlocks() - mem_base);
44005 test_ret++;
44006 printf(" %d", n_ctxt);
44007 printf("\n");
44008 }
44009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044010 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044011#endif
44012
Daniel Veillarda82b1822004-11-08 16:24:57 +000044013 return(test_ret);
44014}
44015
44016
44017static int
44018test_xmlXPathEqualValues(void) {
44019 int test_ret = 0;
44020
44021#ifdef LIBXML_XPATH_ENABLED
44022 int mem_base;
44023 int ret_val;
44024 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44025 int n_ctxt;
44026
44027 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44028 mem_base = xmlMemBlocks();
44029 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44030
44031 ret_val = xmlXPathEqualValues(ctxt);
44032 desret_int(ret_val);
44033 call_tests++;
44034 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44035 xmlResetLastError();
44036 if (mem_base != xmlMemBlocks()) {
44037 printf("Leak of %d blocks found in xmlXPathEqualValues",
44038 xmlMemBlocks() - mem_base);
44039 test_ret++;
44040 printf(" %d", n_ctxt);
44041 printf("\n");
44042 }
44043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044044 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044045#endif
44046
Daniel Veillarda82b1822004-11-08 16:24:57 +000044047 return(test_ret);
44048}
44049
44050
44051static int
44052test_xmlXPathErr(void) {
44053 int test_ret = 0;
44054
44055#ifdef LIBXML_XPATH_ENABLED
44056 int mem_base;
44057 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44058 int n_ctxt;
44059 int error; /* the error code */
44060 int n_error;
44061
44062 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44063 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44064 mem_base = xmlMemBlocks();
44065 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44066 error = gen_int(n_error, 1);
44067
44068 xmlXPathErr(ctxt, error);
44069 call_tests++;
44070 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44071 des_int(n_error, error, 1);
44072 xmlResetLastError();
44073 if (mem_base != xmlMemBlocks()) {
44074 printf("Leak of %d blocks found in xmlXPathErr",
44075 xmlMemBlocks() - mem_base);
44076 test_ret++;
44077 printf(" %d", n_ctxt);
44078 printf(" %d", n_error);
44079 printf("\n");
44080 }
44081 }
44082 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044083 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044084#endif
44085
Daniel Veillarda82b1822004-11-08 16:24:57 +000044086 return(test_ret);
44087}
44088
44089
44090static int
44091test_xmlXPathEvalExpr(void) {
44092 int test_ret = 0;
44093
44094#ifdef LIBXML_XPATH_ENABLED
44095 int mem_base;
44096 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44097 int n_ctxt;
44098
44099 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44100 mem_base = xmlMemBlocks();
44101 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44102
44103 xmlXPathEvalExpr(ctxt);
44104 call_tests++;
44105 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44106 xmlResetLastError();
44107 if (mem_base != xmlMemBlocks()) {
44108 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44109 xmlMemBlocks() - mem_base);
44110 test_ret++;
44111 printf(" %d", n_ctxt);
44112 printf("\n");
44113 }
44114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044115 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044116#endif
44117
Daniel Veillarda82b1822004-11-08 16:24:57 +000044118 return(test_ret);
44119}
44120
44121
44122static int
44123test_xmlXPathEvaluatePredicateResult(void) {
44124 int test_ret = 0;
44125
44126#ifdef LIBXML_XPATH_ENABLED
44127 int mem_base;
44128 int ret_val;
44129 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44130 int n_ctxt;
44131 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44132 int n_res;
44133
44134 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44135 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44136 mem_base = xmlMemBlocks();
44137 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44138 res = gen_xmlXPathObjectPtr(n_res, 1);
44139
44140 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44141 desret_int(ret_val);
44142 call_tests++;
44143 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44144 des_xmlXPathObjectPtr(n_res, res, 1);
44145 xmlResetLastError();
44146 if (mem_base != xmlMemBlocks()) {
44147 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44148 xmlMemBlocks() - mem_base);
44149 test_ret++;
44150 printf(" %d", n_ctxt);
44151 printf(" %d", n_res);
44152 printf("\n");
44153 }
44154 }
44155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044156 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044157#endif
44158
Daniel Veillarda82b1822004-11-08 16:24:57 +000044159 return(test_ret);
44160}
44161
44162
44163static int
44164test_xmlXPathFalseFunction(void) {
44165 int test_ret = 0;
44166
44167#ifdef LIBXML_XPATH_ENABLED
44168 int mem_base;
44169 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44170 int n_ctxt;
44171 int nargs; /* the number of arguments */
44172 int n_nargs;
44173
44174 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44175 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44176 mem_base = xmlMemBlocks();
44177 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44178 nargs = gen_int(n_nargs, 1);
44179
44180 xmlXPathFalseFunction(ctxt, nargs);
44181 call_tests++;
44182 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44183 des_int(n_nargs, nargs, 1);
44184 xmlResetLastError();
44185 if (mem_base != xmlMemBlocks()) {
44186 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44187 xmlMemBlocks() - mem_base);
44188 test_ret++;
44189 printf(" %d", n_ctxt);
44190 printf(" %d", n_nargs);
44191 printf("\n");
44192 }
44193 }
44194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044195 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044196#endif
44197
Daniel Veillarda82b1822004-11-08 16:24:57 +000044198 return(test_ret);
44199}
44200
44201
44202static int
44203test_xmlXPathFloorFunction(void) {
44204 int test_ret = 0;
44205
44206#ifdef LIBXML_XPATH_ENABLED
44207 int mem_base;
44208 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44209 int n_ctxt;
44210 int nargs; /* the number of arguments */
44211 int n_nargs;
44212
44213 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44214 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44215 mem_base = xmlMemBlocks();
44216 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44217 nargs = gen_int(n_nargs, 1);
44218
44219 xmlXPathFloorFunction(ctxt, nargs);
44220 call_tests++;
44221 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44222 des_int(n_nargs, nargs, 1);
44223 xmlResetLastError();
44224 if (mem_base != xmlMemBlocks()) {
44225 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44226 xmlMemBlocks() - mem_base);
44227 test_ret++;
44228 printf(" %d", n_ctxt);
44229 printf(" %d", n_nargs);
44230 printf("\n");
44231 }
44232 }
44233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044234 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044235#endif
44236
Daniel Veillarda82b1822004-11-08 16:24:57 +000044237 return(test_ret);
44238}
44239
44240
44241static int
44242test_xmlXPathFunctionLookup(void) {
44243 int test_ret = 0;
44244
44245
44246 /* missing type support */
44247 return(test_ret);
44248}
44249
44250
44251static int
44252test_xmlXPathFunctionLookupNS(void) {
44253 int test_ret = 0;
44254
44255
44256 /* missing type support */
44257 return(test_ret);
44258}
44259
44260
44261static int
44262test_xmlXPathHasSameNodes(void) {
44263 int test_ret = 0;
44264
44265#ifdef LIBXML_XPATH_ENABLED
44266 int mem_base;
44267 int ret_val;
44268 xmlNodeSetPtr nodes1; /* a node-set */
44269 int n_nodes1;
44270 xmlNodeSetPtr nodes2; /* a node-set */
44271 int n_nodes2;
44272
44273 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44274 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44275 mem_base = xmlMemBlocks();
44276 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44277 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44278
44279 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44280 desret_int(ret_val);
44281 call_tests++;
44282 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44283 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44284 xmlResetLastError();
44285 if (mem_base != xmlMemBlocks()) {
44286 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44287 xmlMemBlocks() - mem_base);
44288 test_ret++;
44289 printf(" %d", n_nodes1);
44290 printf(" %d", n_nodes2);
44291 printf("\n");
44292 }
44293 }
44294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044295 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044296#endif
44297
Daniel Veillarda82b1822004-11-08 16:24:57 +000044298 return(test_ret);
44299}
44300
44301
44302static int
44303test_xmlXPathIdFunction(void) {
44304 int test_ret = 0;
44305
44306#ifdef LIBXML_XPATH_ENABLED
44307 int mem_base;
44308 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44309 int n_ctxt;
44310 int nargs; /* the number of arguments */
44311 int n_nargs;
44312
44313 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44314 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44315 mem_base = xmlMemBlocks();
44316 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44317 nargs = gen_int(n_nargs, 1);
44318
44319 xmlXPathIdFunction(ctxt, nargs);
44320 call_tests++;
44321 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44322 des_int(n_nargs, nargs, 1);
44323 xmlResetLastError();
44324 if (mem_base != xmlMemBlocks()) {
44325 printf("Leak of %d blocks found in xmlXPathIdFunction",
44326 xmlMemBlocks() - mem_base);
44327 test_ret++;
44328 printf(" %d", n_ctxt);
44329 printf(" %d", n_nargs);
44330 printf("\n");
44331 }
44332 }
44333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044334 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044335#endif
44336
Daniel Veillarda82b1822004-11-08 16:24:57 +000044337 return(test_ret);
44338}
44339
44340
44341static int
44342test_xmlXPathIntersection(void) {
44343 int test_ret = 0;
44344
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044345#ifdef LIBXML_XPATH_ENABLED
44346 int mem_base;
44347 xmlNodeSetPtr ret_val;
44348 xmlNodeSetPtr nodes1; /* a node-set */
44349 int n_nodes1;
44350 xmlNodeSetPtr nodes2; /* a node-set */
44351 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044352
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044353 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44354 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44355 mem_base = xmlMemBlocks();
44356 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44357 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44358
44359 ret_val = xmlXPathIntersection(nodes1, nodes2);
44360 desret_xmlNodeSetPtr(ret_val);
44361 call_tests++;
44362 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44363 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44364 xmlResetLastError();
44365 if (mem_base != xmlMemBlocks()) {
44366 printf("Leak of %d blocks found in xmlXPathIntersection",
44367 xmlMemBlocks() - mem_base);
44368 test_ret++;
44369 printf(" %d", n_nodes1);
44370 printf(" %d", n_nodes2);
44371 printf("\n");
44372 }
44373 }
44374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044375 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044376#endif
44377
Daniel Veillarda82b1822004-11-08 16:24:57 +000044378 return(test_ret);
44379}
44380
44381
44382static int
44383test_xmlXPathIsNodeType(void) {
44384 int test_ret = 0;
44385
44386#ifdef LIBXML_XPATH_ENABLED
44387 int mem_base;
44388 int ret_val;
44389 xmlChar * name; /* a name string */
44390 int n_name;
44391
44392 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44393 mem_base = xmlMemBlocks();
44394 name = gen_const_xmlChar_ptr(n_name, 0);
44395
William M. Brackf13f77f2004-11-12 16:03:48 +000044396 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044397 desret_int(ret_val);
44398 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044399 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044400 xmlResetLastError();
44401 if (mem_base != xmlMemBlocks()) {
44402 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44403 xmlMemBlocks() - mem_base);
44404 test_ret++;
44405 printf(" %d", n_name);
44406 printf("\n");
44407 }
44408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044409 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044410#endif
44411
Daniel Veillarda82b1822004-11-08 16:24:57 +000044412 return(test_ret);
44413}
44414
44415
44416static int
44417test_xmlXPathLangFunction(void) {
44418 int test_ret = 0;
44419
44420#ifdef LIBXML_XPATH_ENABLED
44421 int mem_base;
44422 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44423 int n_ctxt;
44424 int nargs; /* the number of arguments */
44425 int n_nargs;
44426
44427 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44428 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44429 mem_base = xmlMemBlocks();
44430 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44431 nargs = gen_int(n_nargs, 1);
44432
44433 xmlXPathLangFunction(ctxt, nargs);
44434 call_tests++;
44435 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44436 des_int(n_nargs, nargs, 1);
44437 xmlResetLastError();
44438 if (mem_base != xmlMemBlocks()) {
44439 printf("Leak of %d blocks found in xmlXPathLangFunction",
44440 xmlMemBlocks() - mem_base);
44441 test_ret++;
44442 printf(" %d", n_ctxt);
44443 printf(" %d", n_nargs);
44444 printf("\n");
44445 }
44446 }
44447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044448 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044449#endif
44450
Daniel Veillarda82b1822004-11-08 16:24:57 +000044451 return(test_ret);
44452}
44453
44454
44455static int
44456test_xmlXPathLastFunction(void) {
44457 int test_ret = 0;
44458
44459#ifdef LIBXML_XPATH_ENABLED
44460 int mem_base;
44461 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44462 int n_ctxt;
44463 int nargs; /* the number of arguments */
44464 int n_nargs;
44465
44466 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44467 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44468 mem_base = xmlMemBlocks();
44469 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44470 nargs = gen_int(n_nargs, 1);
44471
44472 xmlXPathLastFunction(ctxt, nargs);
44473 call_tests++;
44474 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44475 des_int(n_nargs, nargs, 1);
44476 xmlResetLastError();
44477 if (mem_base != xmlMemBlocks()) {
44478 printf("Leak of %d blocks found in xmlXPathLastFunction",
44479 xmlMemBlocks() - mem_base);
44480 test_ret++;
44481 printf(" %d", n_ctxt);
44482 printf(" %d", n_nargs);
44483 printf("\n");
44484 }
44485 }
44486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044487 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044488#endif
44489
Daniel Veillarda82b1822004-11-08 16:24:57 +000044490 return(test_ret);
44491}
44492
44493
44494static int
44495test_xmlXPathLeading(void) {
44496 int test_ret = 0;
44497
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044498#ifdef LIBXML_XPATH_ENABLED
44499 int mem_base;
44500 xmlNodeSetPtr ret_val;
44501 xmlNodeSetPtr nodes1; /* a node-set */
44502 int n_nodes1;
44503 xmlNodeSetPtr nodes2; /* a node-set */
44504 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044505
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044506 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44507 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44508 mem_base = xmlMemBlocks();
44509 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44510 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44511
44512 ret_val = xmlXPathLeading(nodes1, nodes2);
44513 desret_xmlNodeSetPtr(ret_val);
44514 call_tests++;
44515 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44516 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44517 xmlResetLastError();
44518 if (mem_base != xmlMemBlocks()) {
44519 printf("Leak of %d blocks found in xmlXPathLeading",
44520 xmlMemBlocks() - mem_base);
44521 test_ret++;
44522 printf(" %d", n_nodes1);
44523 printf(" %d", n_nodes2);
44524 printf("\n");
44525 }
44526 }
44527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044528 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044529#endif
44530
Daniel Veillarda82b1822004-11-08 16:24:57 +000044531 return(test_ret);
44532}
44533
44534
44535static int
44536test_xmlXPathLeadingSorted(void) {
44537 int test_ret = 0;
44538
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044539#ifdef LIBXML_XPATH_ENABLED
44540 int mem_base;
44541 xmlNodeSetPtr ret_val;
44542 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44543 int n_nodes1;
44544 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44545 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044546
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044547 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44548 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44549 mem_base = xmlMemBlocks();
44550 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44551 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44552
44553 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44554 desret_xmlNodeSetPtr(ret_val);
44555 call_tests++;
44556 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44557 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44558 xmlResetLastError();
44559 if (mem_base != xmlMemBlocks()) {
44560 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44561 xmlMemBlocks() - mem_base);
44562 test_ret++;
44563 printf(" %d", n_nodes1);
44564 printf(" %d", n_nodes2);
44565 printf("\n");
44566 }
44567 }
44568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044569 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044570#endif
44571
Daniel Veillarda82b1822004-11-08 16:24:57 +000044572 return(test_ret);
44573}
44574
44575
44576static int
44577test_xmlXPathLocalNameFunction(void) {
44578 int test_ret = 0;
44579
44580#ifdef LIBXML_XPATH_ENABLED
44581 int mem_base;
44582 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44583 int n_ctxt;
44584 int nargs; /* the number of arguments */
44585 int n_nargs;
44586
44587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44588 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44589 mem_base = xmlMemBlocks();
44590 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44591 nargs = gen_int(n_nargs, 1);
44592
44593 xmlXPathLocalNameFunction(ctxt, nargs);
44594 call_tests++;
44595 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44596 des_int(n_nargs, nargs, 1);
44597 xmlResetLastError();
44598 if (mem_base != xmlMemBlocks()) {
44599 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44600 xmlMemBlocks() - mem_base);
44601 test_ret++;
44602 printf(" %d", n_ctxt);
44603 printf(" %d", n_nargs);
44604 printf("\n");
44605 }
44606 }
44607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044608 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044609#endif
44610
Daniel Veillarda82b1822004-11-08 16:24:57 +000044611 return(test_ret);
44612}
44613
44614
44615static int
44616test_xmlXPathModValues(void) {
44617 int test_ret = 0;
44618
44619#ifdef LIBXML_XPATH_ENABLED
44620 int mem_base;
44621 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44622 int n_ctxt;
44623
44624 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44625 mem_base = xmlMemBlocks();
44626 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44627
44628 xmlXPathModValues(ctxt);
44629 call_tests++;
44630 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44631 xmlResetLastError();
44632 if (mem_base != xmlMemBlocks()) {
44633 printf("Leak of %d blocks found in xmlXPathModValues",
44634 xmlMemBlocks() - mem_base);
44635 test_ret++;
44636 printf(" %d", n_ctxt);
44637 printf("\n");
44638 }
44639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044640 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044641#endif
44642
Daniel Veillarda82b1822004-11-08 16:24:57 +000044643 return(test_ret);
44644}
44645
44646
44647static int
44648test_xmlXPathMultValues(void) {
44649 int test_ret = 0;
44650
44651#ifdef LIBXML_XPATH_ENABLED
44652 int mem_base;
44653 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44654 int n_ctxt;
44655
44656 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44657 mem_base = xmlMemBlocks();
44658 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44659
44660 xmlXPathMultValues(ctxt);
44661 call_tests++;
44662 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44663 xmlResetLastError();
44664 if (mem_base != xmlMemBlocks()) {
44665 printf("Leak of %d blocks found in xmlXPathMultValues",
44666 xmlMemBlocks() - mem_base);
44667 test_ret++;
44668 printf(" %d", n_ctxt);
44669 printf("\n");
44670 }
44671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044672 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044673#endif
44674
Daniel Veillarda82b1822004-11-08 16:24:57 +000044675 return(test_ret);
44676}
44677
44678
44679static int
44680test_xmlXPathNamespaceURIFunction(void) {
44681 int test_ret = 0;
44682
44683#ifdef LIBXML_XPATH_ENABLED
44684 int mem_base;
44685 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44686 int n_ctxt;
44687 int nargs; /* the number of arguments */
44688 int n_nargs;
44689
44690 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44691 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44692 mem_base = xmlMemBlocks();
44693 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44694 nargs = gen_int(n_nargs, 1);
44695
44696 xmlXPathNamespaceURIFunction(ctxt, nargs);
44697 call_tests++;
44698 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44699 des_int(n_nargs, nargs, 1);
44700 xmlResetLastError();
44701 if (mem_base != xmlMemBlocks()) {
44702 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44703 xmlMemBlocks() - mem_base);
44704 test_ret++;
44705 printf(" %d", n_ctxt);
44706 printf(" %d", n_nargs);
44707 printf("\n");
44708 }
44709 }
44710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044711 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044712#endif
44713
Daniel Veillarda82b1822004-11-08 16:24:57 +000044714 return(test_ret);
44715}
44716
44717
44718static int
44719test_xmlXPathNewBoolean(void) {
44720 int test_ret = 0;
44721
44722#ifdef LIBXML_XPATH_ENABLED
44723 int mem_base;
44724 xmlXPathObjectPtr ret_val;
44725 int val; /* the boolean value */
44726 int n_val;
44727
44728 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44729 mem_base = xmlMemBlocks();
44730 val = gen_int(n_val, 0);
44731
44732 ret_val = xmlXPathNewBoolean(val);
44733 desret_xmlXPathObjectPtr(ret_val);
44734 call_tests++;
44735 des_int(n_val, val, 0);
44736 xmlResetLastError();
44737 if (mem_base != xmlMemBlocks()) {
44738 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44739 xmlMemBlocks() - mem_base);
44740 test_ret++;
44741 printf(" %d", n_val);
44742 printf("\n");
44743 }
44744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044745 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044746#endif
44747
Daniel Veillarda82b1822004-11-08 16:24:57 +000044748 return(test_ret);
44749}
44750
44751
44752static int
44753test_xmlXPathNewCString(void) {
44754 int test_ret = 0;
44755
44756#ifdef LIBXML_XPATH_ENABLED
44757 int mem_base;
44758 xmlXPathObjectPtr ret_val;
44759 char * val; /* the char * value */
44760 int n_val;
44761
44762 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44763 mem_base = xmlMemBlocks();
44764 val = gen_const_char_ptr(n_val, 0);
44765
William M. Brackf13f77f2004-11-12 16:03:48 +000044766 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044767 desret_xmlXPathObjectPtr(ret_val);
44768 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044769 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044770 xmlResetLastError();
44771 if (mem_base != xmlMemBlocks()) {
44772 printf("Leak of %d blocks found in xmlXPathNewCString",
44773 xmlMemBlocks() - mem_base);
44774 test_ret++;
44775 printf(" %d", n_val);
44776 printf("\n");
44777 }
44778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044779 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044780#endif
44781
Daniel Veillarda82b1822004-11-08 16:24:57 +000044782 return(test_ret);
44783}
44784
44785
44786static int
44787test_xmlXPathNewFloat(void) {
44788 int test_ret = 0;
44789
44790#ifdef LIBXML_XPATH_ENABLED
44791 int mem_base;
44792 xmlXPathObjectPtr ret_val;
44793 double val; /* the double value */
44794 int n_val;
44795
44796 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44797 mem_base = xmlMemBlocks();
44798 val = gen_double(n_val, 0);
44799
44800 ret_val = xmlXPathNewFloat(val);
44801 desret_xmlXPathObjectPtr(ret_val);
44802 call_tests++;
44803 des_double(n_val, val, 0);
44804 xmlResetLastError();
44805 if (mem_base != xmlMemBlocks()) {
44806 printf("Leak of %d blocks found in xmlXPathNewFloat",
44807 xmlMemBlocks() - mem_base);
44808 test_ret++;
44809 printf(" %d", n_val);
44810 printf("\n");
44811 }
44812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044813 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044814#endif
44815
Daniel Veillarda82b1822004-11-08 16:24:57 +000044816 return(test_ret);
44817}
44818
44819
44820static int
44821test_xmlXPathNewNodeSet(void) {
44822 int test_ret = 0;
44823
44824#ifdef LIBXML_XPATH_ENABLED
44825 int mem_base;
44826 xmlXPathObjectPtr ret_val;
44827 xmlNodePtr val; /* the NodePtr value */
44828 int n_val;
44829
44830 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44831 mem_base = xmlMemBlocks();
44832 val = gen_xmlNodePtr(n_val, 0);
44833
44834 ret_val = xmlXPathNewNodeSet(val);
44835 desret_xmlXPathObjectPtr(ret_val);
44836 call_tests++;
44837 des_xmlNodePtr(n_val, val, 0);
44838 xmlResetLastError();
44839 if (mem_base != xmlMemBlocks()) {
44840 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44841 xmlMemBlocks() - mem_base);
44842 test_ret++;
44843 printf(" %d", n_val);
44844 printf("\n");
44845 }
44846 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044847 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044848#endif
44849
Daniel Veillarda82b1822004-11-08 16:24:57 +000044850 return(test_ret);
44851}
44852
44853
44854static int
44855test_xmlXPathNewNodeSetList(void) {
44856 int test_ret = 0;
44857
44858#ifdef LIBXML_XPATH_ENABLED
44859 int mem_base;
44860 xmlXPathObjectPtr ret_val;
44861 xmlNodeSetPtr val; /* an existing NodeSet */
44862 int n_val;
44863
44864 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
44865 mem_base = xmlMemBlocks();
44866 val = gen_xmlNodeSetPtr(n_val, 0);
44867
44868 ret_val = xmlXPathNewNodeSetList(val);
44869 desret_xmlXPathObjectPtr(ret_val);
44870 call_tests++;
44871 des_xmlNodeSetPtr(n_val, val, 0);
44872 xmlResetLastError();
44873 if (mem_base != xmlMemBlocks()) {
44874 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
44875 xmlMemBlocks() - mem_base);
44876 test_ret++;
44877 printf(" %d", n_val);
44878 printf("\n");
44879 }
44880 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044881 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044882#endif
44883
Daniel Veillarda82b1822004-11-08 16:24:57 +000044884 return(test_ret);
44885}
44886
44887
44888static int
44889test_xmlXPathNewParserContext(void) {
44890 int test_ret = 0;
44891
44892
44893 /* missing type support */
44894 return(test_ret);
44895}
44896
44897
44898static int
44899test_xmlXPathNewString(void) {
44900 int test_ret = 0;
44901
44902#ifdef LIBXML_XPATH_ENABLED
44903 int mem_base;
44904 xmlXPathObjectPtr ret_val;
44905 xmlChar * val; /* the xmlChar * value */
44906 int n_val;
44907
44908 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
44909 mem_base = xmlMemBlocks();
44910 val = gen_const_xmlChar_ptr(n_val, 0);
44911
William M. Brackf13f77f2004-11-12 16:03:48 +000044912 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044913 desret_xmlXPathObjectPtr(ret_val);
44914 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044915 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044916 xmlResetLastError();
44917 if (mem_base != xmlMemBlocks()) {
44918 printf("Leak of %d blocks found in xmlXPathNewString",
44919 xmlMemBlocks() - mem_base);
44920 test_ret++;
44921 printf(" %d", n_val);
44922 printf("\n");
44923 }
44924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044925 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044926#endif
44927
Daniel Veillarda82b1822004-11-08 16:24:57 +000044928 return(test_ret);
44929}
44930
44931
44932static int
44933test_xmlXPathNextAncestor(void) {
44934 int test_ret = 0;
44935
44936#ifdef LIBXML_XPATH_ENABLED
44937 int mem_base;
44938 xmlNodePtr ret_val;
44939 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44940 int n_ctxt;
44941 xmlNodePtr cur; /* the current node in the traversal */
44942 int n_cur;
44943
44944 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44945 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44946 mem_base = xmlMemBlocks();
44947 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44948 cur = gen_xmlNodePtr(n_cur, 1);
44949
44950 ret_val = xmlXPathNextAncestor(ctxt, cur);
44951 desret_xmlNodePtr(ret_val);
44952 call_tests++;
44953 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44954 des_xmlNodePtr(n_cur, cur, 1);
44955 xmlResetLastError();
44956 if (mem_base != xmlMemBlocks()) {
44957 printf("Leak of %d blocks found in xmlXPathNextAncestor",
44958 xmlMemBlocks() - mem_base);
44959 test_ret++;
44960 printf(" %d", n_ctxt);
44961 printf(" %d", n_cur);
44962 printf("\n");
44963 }
44964 }
44965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044966 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044967#endif
44968
Daniel Veillarda82b1822004-11-08 16:24:57 +000044969 return(test_ret);
44970}
44971
44972
44973static int
44974test_xmlXPathNextAncestorOrSelf(void) {
44975 int test_ret = 0;
44976
44977#ifdef LIBXML_XPATH_ENABLED
44978 int mem_base;
44979 xmlNodePtr ret_val;
44980 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44981 int n_ctxt;
44982 xmlNodePtr cur; /* the current node in the traversal */
44983 int n_cur;
44984
44985 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44986 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44987 mem_base = xmlMemBlocks();
44988 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44989 cur = gen_xmlNodePtr(n_cur, 1);
44990
44991 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
44992 desret_xmlNodePtr(ret_val);
44993 call_tests++;
44994 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44995 des_xmlNodePtr(n_cur, cur, 1);
44996 xmlResetLastError();
44997 if (mem_base != xmlMemBlocks()) {
44998 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
44999 xmlMemBlocks() - mem_base);
45000 test_ret++;
45001 printf(" %d", n_ctxt);
45002 printf(" %d", n_cur);
45003 printf("\n");
45004 }
45005 }
45006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045007 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045008#endif
45009
Daniel Veillarda82b1822004-11-08 16:24:57 +000045010 return(test_ret);
45011}
45012
45013
45014static int
45015test_xmlXPathNextAttribute(void) {
45016 int test_ret = 0;
45017
45018#ifdef LIBXML_XPATH_ENABLED
45019 int mem_base;
45020 xmlNodePtr ret_val;
45021 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45022 int n_ctxt;
45023 xmlNodePtr cur; /* the current attribute in the traversal */
45024 int n_cur;
45025
45026 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45027 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45028 mem_base = xmlMemBlocks();
45029 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45030 cur = gen_xmlNodePtr(n_cur, 1);
45031
45032 ret_val = xmlXPathNextAttribute(ctxt, cur);
45033 desret_xmlNodePtr(ret_val);
45034 call_tests++;
45035 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45036 des_xmlNodePtr(n_cur, cur, 1);
45037 xmlResetLastError();
45038 if (mem_base != xmlMemBlocks()) {
45039 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45040 xmlMemBlocks() - mem_base);
45041 test_ret++;
45042 printf(" %d", n_ctxt);
45043 printf(" %d", n_cur);
45044 printf("\n");
45045 }
45046 }
45047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045048 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045049#endif
45050
Daniel Veillarda82b1822004-11-08 16:24:57 +000045051 return(test_ret);
45052}
45053
45054
45055static int
45056test_xmlXPathNextChild(void) {
45057 int test_ret = 0;
45058
45059#ifdef LIBXML_XPATH_ENABLED
45060 int mem_base;
45061 xmlNodePtr ret_val;
45062 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45063 int n_ctxt;
45064 xmlNodePtr cur; /* the current node in the traversal */
45065 int n_cur;
45066
45067 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45068 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45069 mem_base = xmlMemBlocks();
45070 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45071 cur = gen_xmlNodePtr(n_cur, 1);
45072
45073 ret_val = xmlXPathNextChild(ctxt, cur);
45074 desret_xmlNodePtr(ret_val);
45075 call_tests++;
45076 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45077 des_xmlNodePtr(n_cur, cur, 1);
45078 xmlResetLastError();
45079 if (mem_base != xmlMemBlocks()) {
45080 printf("Leak of %d blocks found in xmlXPathNextChild",
45081 xmlMemBlocks() - mem_base);
45082 test_ret++;
45083 printf(" %d", n_ctxt);
45084 printf(" %d", n_cur);
45085 printf("\n");
45086 }
45087 }
45088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045089 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045090#endif
45091
Daniel Veillarda82b1822004-11-08 16:24:57 +000045092 return(test_ret);
45093}
45094
45095
45096static int
45097test_xmlXPathNextDescendant(void) {
45098 int test_ret = 0;
45099
45100#ifdef LIBXML_XPATH_ENABLED
45101 int mem_base;
45102 xmlNodePtr ret_val;
45103 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45104 int n_ctxt;
45105 xmlNodePtr cur; /* the current node in the traversal */
45106 int n_cur;
45107
45108 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45109 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45110 mem_base = xmlMemBlocks();
45111 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45112 cur = gen_xmlNodePtr(n_cur, 1);
45113
45114 ret_val = xmlXPathNextDescendant(ctxt, cur);
45115 desret_xmlNodePtr(ret_val);
45116 call_tests++;
45117 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45118 des_xmlNodePtr(n_cur, cur, 1);
45119 xmlResetLastError();
45120 if (mem_base != xmlMemBlocks()) {
45121 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45122 xmlMemBlocks() - mem_base);
45123 test_ret++;
45124 printf(" %d", n_ctxt);
45125 printf(" %d", n_cur);
45126 printf("\n");
45127 }
45128 }
45129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045130 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045131#endif
45132
Daniel Veillarda82b1822004-11-08 16:24:57 +000045133 return(test_ret);
45134}
45135
45136
45137static int
45138test_xmlXPathNextDescendantOrSelf(void) {
45139 int test_ret = 0;
45140
45141#ifdef LIBXML_XPATH_ENABLED
45142 int mem_base;
45143 xmlNodePtr ret_val;
45144 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45145 int n_ctxt;
45146 xmlNodePtr cur; /* the current node in the traversal */
45147 int n_cur;
45148
45149 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45150 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45151 mem_base = xmlMemBlocks();
45152 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45153 cur = gen_xmlNodePtr(n_cur, 1);
45154
45155 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45156 desret_xmlNodePtr(ret_val);
45157 call_tests++;
45158 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45159 des_xmlNodePtr(n_cur, cur, 1);
45160 xmlResetLastError();
45161 if (mem_base != xmlMemBlocks()) {
45162 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45163 xmlMemBlocks() - mem_base);
45164 test_ret++;
45165 printf(" %d", n_ctxt);
45166 printf(" %d", n_cur);
45167 printf("\n");
45168 }
45169 }
45170 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045171 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045172#endif
45173
Daniel Veillarda82b1822004-11-08 16:24:57 +000045174 return(test_ret);
45175}
45176
45177
45178static int
45179test_xmlXPathNextFollowing(void) {
45180 int test_ret = 0;
45181
45182#ifdef LIBXML_XPATH_ENABLED
45183 int mem_base;
45184 xmlNodePtr ret_val;
45185 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45186 int n_ctxt;
45187 xmlNodePtr cur; /* the current node in the traversal */
45188 int n_cur;
45189
45190 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45191 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45192 mem_base = xmlMemBlocks();
45193 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45194 cur = gen_xmlNodePtr(n_cur, 1);
45195
45196 ret_val = xmlXPathNextFollowing(ctxt, cur);
45197 desret_xmlNodePtr(ret_val);
45198 call_tests++;
45199 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45200 des_xmlNodePtr(n_cur, cur, 1);
45201 xmlResetLastError();
45202 if (mem_base != xmlMemBlocks()) {
45203 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45204 xmlMemBlocks() - mem_base);
45205 test_ret++;
45206 printf(" %d", n_ctxt);
45207 printf(" %d", n_cur);
45208 printf("\n");
45209 }
45210 }
45211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045212 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045213#endif
45214
Daniel Veillarda82b1822004-11-08 16:24:57 +000045215 return(test_ret);
45216}
45217
45218
45219static int
45220test_xmlXPathNextFollowingSibling(void) {
45221 int test_ret = 0;
45222
45223#ifdef LIBXML_XPATH_ENABLED
45224 int mem_base;
45225 xmlNodePtr ret_val;
45226 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45227 int n_ctxt;
45228 xmlNodePtr cur; /* the current node in the traversal */
45229 int n_cur;
45230
45231 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45232 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45233 mem_base = xmlMemBlocks();
45234 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45235 cur = gen_xmlNodePtr(n_cur, 1);
45236
45237 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45238 desret_xmlNodePtr(ret_val);
45239 call_tests++;
45240 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45241 des_xmlNodePtr(n_cur, cur, 1);
45242 xmlResetLastError();
45243 if (mem_base != xmlMemBlocks()) {
45244 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45245 xmlMemBlocks() - mem_base);
45246 test_ret++;
45247 printf(" %d", n_ctxt);
45248 printf(" %d", n_cur);
45249 printf("\n");
45250 }
45251 }
45252 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045253 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045254#endif
45255
Daniel Veillarda82b1822004-11-08 16:24:57 +000045256 return(test_ret);
45257}
45258
45259
45260static int
45261test_xmlXPathNextNamespace(void) {
45262 int test_ret = 0;
45263
45264#ifdef LIBXML_XPATH_ENABLED
45265 int mem_base;
45266 xmlNodePtr ret_val;
45267 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45268 int n_ctxt;
45269 xmlNodePtr cur; /* the current attribute in the traversal */
45270 int n_cur;
45271
45272 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45273 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45274 mem_base = xmlMemBlocks();
45275 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45276 cur = gen_xmlNodePtr(n_cur, 1);
45277
45278 ret_val = xmlXPathNextNamespace(ctxt, cur);
45279 desret_xmlNodePtr(ret_val);
45280 call_tests++;
45281 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45282 des_xmlNodePtr(n_cur, cur, 1);
45283 xmlResetLastError();
45284 if (mem_base != xmlMemBlocks()) {
45285 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45286 xmlMemBlocks() - mem_base);
45287 test_ret++;
45288 printf(" %d", n_ctxt);
45289 printf(" %d", n_cur);
45290 printf("\n");
45291 }
45292 }
45293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045294 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045295#endif
45296
Daniel Veillarda82b1822004-11-08 16:24:57 +000045297 return(test_ret);
45298}
45299
45300
45301static int
45302test_xmlXPathNextParent(void) {
45303 int test_ret = 0;
45304
45305#ifdef LIBXML_XPATH_ENABLED
45306 int mem_base;
45307 xmlNodePtr ret_val;
45308 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45309 int n_ctxt;
45310 xmlNodePtr cur; /* the current node in the traversal */
45311 int n_cur;
45312
45313 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45314 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45315 mem_base = xmlMemBlocks();
45316 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45317 cur = gen_xmlNodePtr(n_cur, 1);
45318
45319 ret_val = xmlXPathNextParent(ctxt, cur);
45320 desret_xmlNodePtr(ret_val);
45321 call_tests++;
45322 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45323 des_xmlNodePtr(n_cur, cur, 1);
45324 xmlResetLastError();
45325 if (mem_base != xmlMemBlocks()) {
45326 printf("Leak of %d blocks found in xmlXPathNextParent",
45327 xmlMemBlocks() - mem_base);
45328 test_ret++;
45329 printf(" %d", n_ctxt);
45330 printf(" %d", n_cur);
45331 printf("\n");
45332 }
45333 }
45334 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045335 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045336#endif
45337
Daniel Veillarda82b1822004-11-08 16:24:57 +000045338 return(test_ret);
45339}
45340
45341
45342static int
45343test_xmlXPathNextPreceding(void) {
45344 int test_ret = 0;
45345
45346#ifdef LIBXML_XPATH_ENABLED
45347 int mem_base;
45348 xmlNodePtr ret_val;
45349 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45350 int n_ctxt;
45351 xmlNodePtr cur; /* the current node in the traversal */
45352 int n_cur;
45353
45354 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45355 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45356 mem_base = xmlMemBlocks();
45357 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45358 cur = gen_xmlNodePtr(n_cur, 1);
45359
45360 ret_val = xmlXPathNextPreceding(ctxt, cur);
45361 desret_xmlNodePtr(ret_val);
45362 call_tests++;
45363 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45364 des_xmlNodePtr(n_cur, cur, 1);
45365 xmlResetLastError();
45366 if (mem_base != xmlMemBlocks()) {
45367 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45368 xmlMemBlocks() - mem_base);
45369 test_ret++;
45370 printf(" %d", n_ctxt);
45371 printf(" %d", n_cur);
45372 printf("\n");
45373 }
45374 }
45375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045376 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045377#endif
45378
Daniel Veillarda82b1822004-11-08 16:24:57 +000045379 return(test_ret);
45380}
45381
45382
45383static int
45384test_xmlXPathNextPrecedingSibling(void) {
45385 int test_ret = 0;
45386
45387#ifdef LIBXML_XPATH_ENABLED
45388 int mem_base;
45389 xmlNodePtr ret_val;
45390 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45391 int n_ctxt;
45392 xmlNodePtr cur; /* the current node in the traversal */
45393 int n_cur;
45394
45395 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45396 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45397 mem_base = xmlMemBlocks();
45398 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45399 cur = gen_xmlNodePtr(n_cur, 1);
45400
45401 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45402 desret_xmlNodePtr(ret_val);
45403 call_tests++;
45404 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45405 des_xmlNodePtr(n_cur, cur, 1);
45406 xmlResetLastError();
45407 if (mem_base != xmlMemBlocks()) {
45408 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45409 xmlMemBlocks() - mem_base);
45410 test_ret++;
45411 printf(" %d", n_ctxt);
45412 printf(" %d", n_cur);
45413 printf("\n");
45414 }
45415 }
45416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045417 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045418#endif
45419
Daniel Veillarda82b1822004-11-08 16:24:57 +000045420 return(test_ret);
45421}
45422
45423
45424static int
45425test_xmlXPathNextSelf(void) {
45426 int test_ret = 0;
45427
45428#ifdef LIBXML_XPATH_ENABLED
45429 int mem_base;
45430 xmlNodePtr ret_val;
45431 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45432 int n_ctxt;
45433 xmlNodePtr cur; /* the current node in the traversal */
45434 int n_cur;
45435
45436 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45437 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45438 mem_base = xmlMemBlocks();
45439 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45440 cur = gen_xmlNodePtr(n_cur, 1);
45441
45442 ret_val = xmlXPathNextSelf(ctxt, cur);
45443 desret_xmlNodePtr(ret_val);
45444 call_tests++;
45445 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45446 des_xmlNodePtr(n_cur, cur, 1);
45447 xmlResetLastError();
45448 if (mem_base != xmlMemBlocks()) {
45449 printf("Leak of %d blocks found in xmlXPathNextSelf",
45450 xmlMemBlocks() - mem_base);
45451 test_ret++;
45452 printf(" %d", n_ctxt);
45453 printf(" %d", n_cur);
45454 printf("\n");
45455 }
45456 }
45457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045458 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045459#endif
45460
Daniel Veillarda82b1822004-11-08 16:24:57 +000045461 return(test_ret);
45462}
45463
45464
45465static int
45466test_xmlXPathNodeLeading(void) {
45467 int test_ret = 0;
45468
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045469#ifdef LIBXML_XPATH_ENABLED
45470 int mem_base;
45471 xmlNodeSetPtr ret_val;
45472 xmlNodeSetPtr nodes; /* a node-set */
45473 int n_nodes;
45474 xmlNodePtr node; /* a node */
45475 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045476
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045477 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45478 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45479 mem_base = xmlMemBlocks();
45480 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45481 node = gen_xmlNodePtr(n_node, 1);
45482
45483 ret_val = xmlXPathNodeLeading(nodes, node);
45484 desret_xmlNodeSetPtr(ret_val);
45485 call_tests++;
45486 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45487 des_xmlNodePtr(n_node, node, 1);
45488 xmlResetLastError();
45489 if (mem_base != xmlMemBlocks()) {
45490 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45491 xmlMemBlocks() - mem_base);
45492 test_ret++;
45493 printf(" %d", n_nodes);
45494 printf(" %d", n_node);
45495 printf("\n");
45496 }
45497 }
45498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045499 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045500#endif
45501
Daniel Veillarda82b1822004-11-08 16:24:57 +000045502 return(test_ret);
45503}
45504
45505
45506static int
45507test_xmlXPathNodeLeadingSorted(void) {
45508 int test_ret = 0;
45509
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045510#ifdef LIBXML_XPATH_ENABLED
45511 int mem_base;
45512 xmlNodeSetPtr ret_val;
45513 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45514 int n_nodes;
45515 xmlNodePtr node; /* a node */
45516 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045517
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045518 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45519 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45520 mem_base = xmlMemBlocks();
45521 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45522 node = gen_xmlNodePtr(n_node, 1);
45523
45524 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45525 desret_xmlNodeSetPtr(ret_val);
45526 call_tests++;
45527 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45528 des_xmlNodePtr(n_node, node, 1);
45529 xmlResetLastError();
45530 if (mem_base != xmlMemBlocks()) {
45531 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45532 xmlMemBlocks() - mem_base);
45533 test_ret++;
45534 printf(" %d", n_nodes);
45535 printf(" %d", n_node);
45536 printf("\n");
45537 }
45538 }
45539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045540 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045541#endif
45542
Daniel Veillarda82b1822004-11-08 16:24:57 +000045543 return(test_ret);
45544}
45545
45546
45547static int
45548test_xmlXPathNodeSetAdd(void) {
45549 int test_ret = 0;
45550
45551#ifdef LIBXML_XPATH_ENABLED
45552 int mem_base;
45553 xmlNodeSetPtr cur; /* the initial node set */
45554 int n_cur;
45555 xmlNodePtr val; /* a new xmlNodePtr */
45556 int n_val;
45557
45558 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45559 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45560 mem_base = xmlMemBlocks();
45561 cur = gen_xmlNodeSetPtr(n_cur, 0);
45562 val = gen_xmlNodePtr(n_val, 1);
45563
45564 xmlXPathNodeSetAdd(cur, val);
45565 call_tests++;
45566 des_xmlNodeSetPtr(n_cur, cur, 0);
45567 des_xmlNodePtr(n_val, val, 1);
45568 xmlResetLastError();
45569 if (mem_base != xmlMemBlocks()) {
45570 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45571 xmlMemBlocks() - mem_base);
45572 test_ret++;
45573 printf(" %d", n_cur);
45574 printf(" %d", n_val);
45575 printf("\n");
45576 }
45577 }
45578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045579 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045580#endif
45581
Daniel Veillarda82b1822004-11-08 16:24:57 +000045582 return(test_ret);
45583}
45584
45585
45586static int
45587test_xmlXPathNodeSetAddNs(void) {
45588 int test_ret = 0;
45589
45590#ifdef LIBXML_XPATH_ENABLED
45591 int mem_base;
45592 xmlNodeSetPtr cur; /* the initial node set */
45593 int n_cur;
45594 xmlNodePtr node; /* the hosting node */
45595 int n_node;
45596 xmlNsPtr ns; /* a the namespace node */
45597 int n_ns;
45598
45599 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45600 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45601 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45602 mem_base = xmlMemBlocks();
45603 cur = gen_xmlNodeSetPtr(n_cur, 0);
45604 node = gen_xmlNodePtr(n_node, 1);
45605 ns = gen_xmlNsPtr(n_ns, 2);
45606
45607 xmlXPathNodeSetAddNs(cur, node, ns);
45608 call_tests++;
45609 des_xmlNodeSetPtr(n_cur, cur, 0);
45610 des_xmlNodePtr(n_node, node, 1);
45611 des_xmlNsPtr(n_ns, ns, 2);
45612 xmlResetLastError();
45613 if (mem_base != xmlMemBlocks()) {
45614 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45615 xmlMemBlocks() - mem_base);
45616 test_ret++;
45617 printf(" %d", n_cur);
45618 printf(" %d", n_node);
45619 printf(" %d", n_ns);
45620 printf("\n");
45621 }
45622 }
45623 }
45624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045625 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045626#endif
45627
Daniel Veillarda82b1822004-11-08 16:24:57 +000045628 return(test_ret);
45629}
45630
45631
45632static int
45633test_xmlXPathNodeSetAddUnique(void) {
45634 int test_ret = 0;
45635
45636#ifdef LIBXML_XPATH_ENABLED
45637 int mem_base;
45638 xmlNodeSetPtr cur; /* the initial node set */
45639 int n_cur;
45640 xmlNodePtr val; /* a new xmlNodePtr */
45641 int n_val;
45642
45643 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45644 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45645 mem_base = xmlMemBlocks();
45646 cur = gen_xmlNodeSetPtr(n_cur, 0);
45647 val = gen_xmlNodePtr(n_val, 1);
45648
45649 xmlXPathNodeSetAddUnique(cur, val);
45650 call_tests++;
45651 des_xmlNodeSetPtr(n_cur, cur, 0);
45652 des_xmlNodePtr(n_val, val, 1);
45653 xmlResetLastError();
45654 if (mem_base != xmlMemBlocks()) {
45655 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45656 xmlMemBlocks() - mem_base);
45657 test_ret++;
45658 printf(" %d", n_cur);
45659 printf(" %d", n_val);
45660 printf("\n");
45661 }
45662 }
45663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045664 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045665#endif
45666
Daniel Veillarda82b1822004-11-08 16:24:57 +000045667 return(test_ret);
45668}
45669
45670
45671static int
45672test_xmlXPathNodeSetContains(void) {
45673 int test_ret = 0;
45674
45675#ifdef LIBXML_XPATH_ENABLED
45676 int mem_base;
45677 int ret_val;
45678 xmlNodeSetPtr cur; /* the node-set */
45679 int n_cur;
45680 xmlNodePtr val; /* the node */
45681 int n_val;
45682
45683 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45684 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45685 mem_base = xmlMemBlocks();
45686 cur = gen_xmlNodeSetPtr(n_cur, 0);
45687 val = gen_xmlNodePtr(n_val, 1);
45688
45689 ret_val = xmlXPathNodeSetContains(cur, val);
45690 desret_int(ret_val);
45691 call_tests++;
45692 des_xmlNodeSetPtr(n_cur, cur, 0);
45693 des_xmlNodePtr(n_val, val, 1);
45694 xmlResetLastError();
45695 if (mem_base != xmlMemBlocks()) {
45696 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45697 xmlMemBlocks() - mem_base);
45698 test_ret++;
45699 printf(" %d", n_cur);
45700 printf(" %d", n_val);
45701 printf("\n");
45702 }
45703 }
45704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045705 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045706#endif
45707
Daniel Veillarda82b1822004-11-08 16:24:57 +000045708 return(test_ret);
45709}
45710
45711
45712static int
45713test_xmlXPathNodeSetDel(void) {
45714 int test_ret = 0;
45715
45716#ifdef LIBXML_XPATH_ENABLED
45717 int mem_base;
45718 xmlNodeSetPtr cur; /* the initial node set */
45719 int n_cur;
45720 xmlNodePtr val; /* an xmlNodePtr */
45721 int n_val;
45722
45723 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45724 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45725 mem_base = xmlMemBlocks();
45726 cur = gen_xmlNodeSetPtr(n_cur, 0);
45727 val = gen_xmlNodePtr(n_val, 1);
45728
45729 xmlXPathNodeSetDel(cur, val);
45730 call_tests++;
45731 des_xmlNodeSetPtr(n_cur, cur, 0);
45732 des_xmlNodePtr(n_val, val, 1);
45733 xmlResetLastError();
45734 if (mem_base != xmlMemBlocks()) {
45735 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45736 xmlMemBlocks() - mem_base);
45737 test_ret++;
45738 printf(" %d", n_cur);
45739 printf(" %d", n_val);
45740 printf("\n");
45741 }
45742 }
45743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045744 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045745#endif
45746
Daniel Veillarda82b1822004-11-08 16:24:57 +000045747 return(test_ret);
45748}
45749
45750
45751static int
45752test_xmlXPathNodeSetMerge(void) {
45753 int test_ret = 0;
45754
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045755#ifdef LIBXML_XPATH_ENABLED
45756 int mem_base;
45757 xmlNodeSetPtr ret_val;
45758 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45759 int n_val1;
45760 xmlNodeSetPtr val2; /* the second NodeSet */
45761 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045762
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045763 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45764 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45765 mem_base = xmlMemBlocks();
45766 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45767 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45768
45769 ret_val = xmlXPathNodeSetMerge(val1, val2);
45770 desret_xmlNodeSetPtr(ret_val);
45771 call_tests++;
45772 des_xmlNodeSetPtr(n_val1, val1, 0);
45773 des_xmlNodeSetPtr(n_val2, val2, 1);
45774 xmlResetLastError();
45775 if (mem_base != xmlMemBlocks()) {
45776 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45777 xmlMemBlocks() - mem_base);
45778 test_ret++;
45779 printf(" %d", n_val1);
45780 printf(" %d", n_val2);
45781 printf("\n");
45782 }
45783 }
45784 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045785 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045786#endif
45787
Daniel Veillarda82b1822004-11-08 16:24:57 +000045788 return(test_ret);
45789}
45790
45791
45792static int
45793test_xmlXPathNodeSetRemove(void) {
45794 int test_ret = 0;
45795
45796#ifdef LIBXML_XPATH_ENABLED
45797 int mem_base;
45798 xmlNodeSetPtr cur; /* the initial node set */
45799 int n_cur;
45800 int val; /* the index to remove */
45801 int n_val;
45802
45803 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45804 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45805 mem_base = xmlMemBlocks();
45806 cur = gen_xmlNodeSetPtr(n_cur, 0);
45807 val = gen_int(n_val, 1);
45808
45809 xmlXPathNodeSetRemove(cur, val);
45810 call_tests++;
45811 des_xmlNodeSetPtr(n_cur, cur, 0);
45812 des_int(n_val, val, 1);
45813 xmlResetLastError();
45814 if (mem_base != xmlMemBlocks()) {
45815 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45816 xmlMemBlocks() - mem_base);
45817 test_ret++;
45818 printf(" %d", n_cur);
45819 printf(" %d", n_val);
45820 printf("\n");
45821 }
45822 }
45823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045824 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045825#endif
45826
Daniel Veillarda82b1822004-11-08 16:24:57 +000045827 return(test_ret);
45828}
45829
45830
45831static int
45832test_xmlXPathNodeSetSort(void) {
45833 int test_ret = 0;
45834
45835#ifdef LIBXML_XPATH_ENABLED
45836 int mem_base;
45837 xmlNodeSetPtr set; /* the node set */
45838 int n_set;
45839
45840 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45841 mem_base = xmlMemBlocks();
45842 set = gen_xmlNodeSetPtr(n_set, 0);
45843
45844 xmlXPathNodeSetSort(set);
45845 call_tests++;
45846 des_xmlNodeSetPtr(n_set, set, 0);
45847 xmlResetLastError();
45848 if (mem_base != xmlMemBlocks()) {
45849 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
45850 xmlMemBlocks() - mem_base);
45851 test_ret++;
45852 printf(" %d", n_set);
45853 printf("\n");
45854 }
45855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045856 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045857#endif
45858
Daniel Veillarda82b1822004-11-08 16:24:57 +000045859 return(test_ret);
45860}
45861
45862
45863static int
45864test_xmlXPathNodeTrailing(void) {
45865 int test_ret = 0;
45866
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045867#ifdef LIBXML_XPATH_ENABLED
45868 int mem_base;
45869 xmlNodeSetPtr ret_val;
45870 xmlNodeSetPtr nodes; /* a node-set */
45871 int n_nodes;
45872 xmlNodePtr node; /* a node */
45873 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045874
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045875 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45876 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45877 mem_base = xmlMemBlocks();
45878 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45879 node = gen_xmlNodePtr(n_node, 1);
45880
45881 ret_val = xmlXPathNodeTrailing(nodes, node);
45882 desret_xmlNodeSetPtr(ret_val);
45883 call_tests++;
45884 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45885 des_xmlNodePtr(n_node, node, 1);
45886 xmlResetLastError();
45887 if (mem_base != xmlMemBlocks()) {
45888 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
45889 xmlMemBlocks() - mem_base);
45890 test_ret++;
45891 printf(" %d", n_nodes);
45892 printf(" %d", n_node);
45893 printf("\n");
45894 }
45895 }
45896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045897 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045898#endif
45899
Daniel Veillarda82b1822004-11-08 16:24:57 +000045900 return(test_ret);
45901}
45902
45903
45904static int
45905test_xmlXPathNodeTrailingSorted(void) {
45906 int test_ret = 0;
45907
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045908#ifdef LIBXML_XPATH_ENABLED
45909 int mem_base;
45910 xmlNodeSetPtr ret_val;
45911 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45912 int n_nodes;
45913 xmlNodePtr node; /* a node */
45914 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045915
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045916 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45917 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45918 mem_base = xmlMemBlocks();
45919 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45920 node = gen_xmlNodePtr(n_node, 1);
45921
45922 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
45923 desret_xmlNodeSetPtr(ret_val);
45924 call_tests++;
45925 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45926 des_xmlNodePtr(n_node, node, 1);
45927 xmlResetLastError();
45928 if (mem_base != xmlMemBlocks()) {
45929 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
45930 xmlMemBlocks() - mem_base);
45931 test_ret++;
45932 printf(" %d", n_nodes);
45933 printf(" %d", n_node);
45934 printf("\n");
45935 }
45936 }
45937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045938 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045939#endif
45940
Daniel Veillarda82b1822004-11-08 16:24:57 +000045941 return(test_ret);
45942}
45943
45944
45945static int
45946test_xmlXPathNormalizeFunction(void) {
45947 int test_ret = 0;
45948
45949#ifdef LIBXML_XPATH_ENABLED
45950 int mem_base;
45951 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45952 int n_ctxt;
45953 int nargs; /* the number of arguments */
45954 int n_nargs;
45955
45956 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45957 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45958 mem_base = xmlMemBlocks();
45959 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45960 nargs = gen_int(n_nargs, 1);
45961
45962 xmlXPathNormalizeFunction(ctxt, nargs);
45963 call_tests++;
45964 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45965 des_int(n_nargs, nargs, 1);
45966 xmlResetLastError();
45967 if (mem_base != xmlMemBlocks()) {
45968 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
45969 xmlMemBlocks() - mem_base);
45970 test_ret++;
45971 printf(" %d", n_ctxt);
45972 printf(" %d", n_nargs);
45973 printf("\n");
45974 }
45975 }
45976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045977 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045978#endif
45979
Daniel Veillarda82b1822004-11-08 16:24:57 +000045980 return(test_ret);
45981}
45982
45983
45984static int
45985test_xmlXPathNotEqualValues(void) {
45986 int test_ret = 0;
45987
45988#ifdef LIBXML_XPATH_ENABLED
45989 int mem_base;
45990 int ret_val;
45991 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45992 int n_ctxt;
45993
45994 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45995 mem_base = xmlMemBlocks();
45996 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45997
45998 ret_val = xmlXPathNotEqualValues(ctxt);
45999 desret_int(ret_val);
46000 call_tests++;
46001 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46002 xmlResetLastError();
46003 if (mem_base != xmlMemBlocks()) {
46004 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46005 xmlMemBlocks() - mem_base);
46006 test_ret++;
46007 printf(" %d", n_ctxt);
46008 printf("\n");
46009 }
46010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046011 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046012#endif
46013
Daniel Veillarda82b1822004-11-08 16:24:57 +000046014 return(test_ret);
46015}
46016
46017
46018static int
46019test_xmlXPathNotFunction(void) {
46020 int test_ret = 0;
46021
46022#ifdef LIBXML_XPATH_ENABLED
46023 int mem_base;
46024 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46025 int n_ctxt;
46026 int nargs; /* the number of arguments */
46027 int n_nargs;
46028
46029 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46030 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46031 mem_base = xmlMemBlocks();
46032 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46033 nargs = gen_int(n_nargs, 1);
46034
46035 xmlXPathNotFunction(ctxt, nargs);
46036 call_tests++;
46037 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46038 des_int(n_nargs, nargs, 1);
46039 xmlResetLastError();
46040 if (mem_base != xmlMemBlocks()) {
46041 printf("Leak of %d blocks found in xmlXPathNotFunction",
46042 xmlMemBlocks() - mem_base);
46043 test_ret++;
46044 printf(" %d", n_ctxt);
46045 printf(" %d", n_nargs);
46046 printf("\n");
46047 }
46048 }
46049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046050 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046051#endif
46052
Daniel Veillarda82b1822004-11-08 16:24:57 +000046053 return(test_ret);
46054}
46055
46056
46057static int
46058test_xmlXPathNsLookup(void) {
46059 int test_ret = 0;
46060
46061#ifdef LIBXML_XPATH_ENABLED
46062 int mem_base;
46063 const xmlChar * ret_val;
46064 xmlXPathContextPtr ctxt; /* the XPath context */
46065 int n_ctxt;
46066 xmlChar * prefix; /* the namespace prefix value */
46067 int n_prefix;
46068
46069 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46070 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46071 mem_base = xmlMemBlocks();
46072 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46073 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46074
William M. Brackf13f77f2004-11-12 16:03:48 +000046075 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046076 desret_const_xmlChar_ptr(ret_val);
46077 call_tests++;
46078 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046079 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046080 xmlResetLastError();
46081 if (mem_base != xmlMemBlocks()) {
46082 printf("Leak of %d blocks found in xmlXPathNsLookup",
46083 xmlMemBlocks() - mem_base);
46084 test_ret++;
46085 printf(" %d", n_ctxt);
46086 printf(" %d", n_prefix);
46087 printf("\n");
46088 }
46089 }
46090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046091 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046092#endif
46093
Daniel Veillarda82b1822004-11-08 16:24:57 +000046094 return(test_ret);
46095}
46096
46097
46098static int
46099test_xmlXPathNumberFunction(void) {
46100 int test_ret = 0;
46101
46102#ifdef LIBXML_XPATH_ENABLED
46103 int mem_base;
46104 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46105 int n_ctxt;
46106 int nargs; /* the number of arguments */
46107 int n_nargs;
46108
46109 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46110 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46111 mem_base = xmlMemBlocks();
46112 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46113 nargs = gen_int(n_nargs, 1);
46114
46115 xmlXPathNumberFunction(ctxt, nargs);
46116 call_tests++;
46117 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46118 des_int(n_nargs, nargs, 1);
46119 xmlResetLastError();
46120 if (mem_base != xmlMemBlocks()) {
46121 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46122 xmlMemBlocks() - mem_base);
46123 test_ret++;
46124 printf(" %d", n_ctxt);
46125 printf(" %d", n_nargs);
46126 printf("\n");
46127 }
46128 }
46129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046130 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046131#endif
46132
Daniel Veillarda82b1822004-11-08 16:24:57 +000046133 return(test_ret);
46134}
46135
46136
46137static int
46138test_xmlXPathParseNCName(void) {
46139 int test_ret = 0;
46140
46141#ifdef LIBXML_XPATH_ENABLED
46142 int mem_base;
46143 xmlChar * ret_val;
46144 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46145 int n_ctxt;
46146
46147 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46148 mem_base = xmlMemBlocks();
46149 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46150
46151 ret_val = xmlXPathParseNCName(ctxt);
46152 desret_xmlChar_ptr(ret_val);
46153 call_tests++;
46154 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46155 xmlResetLastError();
46156 if (mem_base != xmlMemBlocks()) {
46157 printf("Leak of %d blocks found in xmlXPathParseNCName",
46158 xmlMemBlocks() - mem_base);
46159 test_ret++;
46160 printf(" %d", n_ctxt);
46161 printf("\n");
46162 }
46163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046164 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046165#endif
46166
Daniel Veillarda82b1822004-11-08 16:24:57 +000046167 return(test_ret);
46168}
46169
46170
46171static int
46172test_xmlXPathParseName(void) {
46173 int test_ret = 0;
46174
46175#ifdef LIBXML_XPATH_ENABLED
46176 int mem_base;
46177 xmlChar * ret_val;
46178 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46179 int n_ctxt;
46180
46181 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46182 mem_base = xmlMemBlocks();
46183 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46184
46185 ret_val = xmlXPathParseName(ctxt);
46186 desret_xmlChar_ptr(ret_val);
46187 call_tests++;
46188 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46189 xmlResetLastError();
46190 if (mem_base != xmlMemBlocks()) {
46191 printf("Leak of %d blocks found in xmlXPathParseName",
46192 xmlMemBlocks() - mem_base);
46193 test_ret++;
46194 printf(" %d", n_ctxt);
46195 printf("\n");
46196 }
46197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046198 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046199#endif
46200
Daniel Veillarda82b1822004-11-08 16:24:57 +000046201 return(test_ret);
46202}
46203
46204
46205static int
46206test_xmlXPathPopBoolean(void) {
46207 int test_ret = 0;
46208
46209#ifdef LIBXML_XPATH_ENABLED
46210 int mem_base;
46211 int ret_val;
46212 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46213 int n_ctxt;
46214
46215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46216 mem_base = xmlMemBlocks();
46217 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46218
46219 ret_val = xmlXPathPopBoolean(ctxt);
46220 desret_int(ret_val);
46221 call_tests++;
46222 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46223 xmlResetLastError();
46224 if (mem_base != xmlMemBlocks()) {
46225 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46226 xmlMemBlocks() - mem_base);
46227 test_ret++;
46228 printf(" %d", n_ctxt);
46229 printf("\n");
46230 }
46231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046232 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046233#endif
46234
Daniel Veillarda82b1822004-11-08 16:24:57 +000046235 return(test_ret);
46236}
46237
46238
46239static int
46240test_xmlXPathPopExternal(void) {
46241 int test_ret = 0;
46242
46243#ifdef LIBXML_XPATH_ENABLED
46244 int mem_base;
46245 void * ret_val;
46246 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46247 int n_ctxt;
46248
46249 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46250 mem_base = xmlMemBlocks();
46251 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46252
46253 ret_val = xmlXPathPopExternal(ctxt);
46254 desret_void_ptr(ret_val);
46255 call_tests++;
46256 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46257 xmlResetLastError();
46258 if (mem_base != xmlMemBlocks()) {
46259 printf("Leak of %d blocks found in xmlXPathPopExternal",
46260 xmlMemBlocks() - mem_base);
46261 test_ret++;
46262 printf(" %d", n_ctxt);
46263 printf("\n");
46264 }
46265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046266 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046267#endif
46268
Daniel Veillarda82b1822004-11-08 16:24:57 +000046269 return(test_ret);
46270}
46271
46272
46273static int
46274test_xmlXPathPopNodeSet(void) {
46275 int test_ret = 0;
46276
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046277#ifdef LIBXML_XPATH_ENABLED
46278 int mem_base;
46279 xmlNodeSetPtr ret_val;
46280 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46281 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046282
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046283 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46284 mem_base = xmlMemBlocks();
46285 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46286
46287 ret_val = xmlXPathPopNodeSet(ctxt);
46288 desret_xmlNodeSetPtr(ret_val);
46289 call_tests++;
46290 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46291 xmlResetLastError();
46292 if (mem_base != xmlMemBlocks()) {
46293 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46294 xmlMemBlocks() - mem_base);
46295 test_ret++;
46296 printf(" %d", n_ctxt);
46297 printf("\n");
46298 }
46299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046300 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046301#endif
46302
Daniel Veillarda82b1822004-11-08 16:24:57 +000046303 return(test_ret);
46304}
46305
46306
46307static int
46308test_xmlXPathPopNumber(void) {
46309 int test_ret = 0;
46310
46311#ifdef LIBXML_XPATH_ENABLED
46312 int mem_base;
46313 double ret_val;
46314 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46315 int n_ctxt;
46316
46317 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46318 mem_base = xmlMemBlocks();
46319 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46320
46321 ret_val = xmlXPathPopNumber(ctxt);
46322 desret_double(ret_val);
46323 call_tests++;
46324 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46325 xmlResetLastError();
46326 if (mem_base != xmlMemBlocks()) {
46327 printf("Leak of %d blocks found in xmlXPathPopNumber",
46328 xmlMemBlocks() - mem_base);
46329 test_ret++;
46330 printf(" %d", n_ctxt);
46331 printf("\n");
46332 }
46333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046334 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046335#endif
46336
Daniel Veillarda82b1822004-11-08 16:24:57 +000046337 return(test_ret);
46338}
46339
46340
46341static int
46342test_xmlXPathPopString(void) {
46343 int test_ret = 0;
46344
46345#ifdef LIBXML_XPATH_ENABLED
46346 int mem_base;
46347 xmlChar * ret_val;
46348 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46349 int n_ctxt;
46350
46351 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46352 mem_base = xmlMemBlocks();
46353 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46354
46355 ret_val = xmlXPathPopString(ctxt);
46356 desret_xmlChar_ptr(ret_val);
46357 call_tests++;
46358 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46359 xmlResetLastError();
46360 if (mem_base != xmlMemBlocks()) {
46361 printf("Leak of %d blocks found in xmlXPathPopString",
46362 xmlMemBlocks() - mem_base);
46363 test_ret++;
46364 printf(" %d", n_ctxt);
46365 printf("\n");
46366 }
46367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046368 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046369#endif
46370
Daniel Veillarda82b1822004-11-08 16:24:57 +000046371 return(test_ret);
46372}
46373
46374
46375static int
46376test_xmlXPathPositionFunction(void) {
46377 int test_ret = 0;
46378
46379#ifdef LIBXML_XPATH_ENABLED
46380 int mem_base;
46381 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46382 int n_ctxt;
46383 int nargs; /* the number of arguments */
46384 int n_nargs;
46385
46386 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46387 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46388 mem_base = xmlMemBlocks();
46389 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46390 nargs = gen_int(n_nargs, 1);
46391
46392 xmlXPathPositionFunction(ctxt, nargs);
46393 call_tests++;
46394 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46395 des_int(n_nargs, nargs, 1);
46396 xmlResetLastError();
46397 if (mem_base != xmlMemBlocks()) {
46398 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46399 xmlMemBlocks() - mem_base);
46400 test_ret++;
46401 printf(" %d", n_ctxt);
46402 printf(" %d", n_nargs);
46403 printf("\n");
46404 }
46405 }
46406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046407 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046408#endif
46409
Daniel Veillarda82b1822004-11-08 16:24:57 +000046410 return(test_ret);
46411}
46412
46413
46414static int
46415test_xmlXPathRegisterAllFunctions(void) {
46416 int test_ret = 0;
46417
46418#ifdef LIBXML_XPATH_ENABLED
46419 int mem_base;
46420 xmlXPathContextPtr ctxt; /* the XPath context */
46421 int n_ctxt;
46422
46423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46424 mem_base = xmlMemBlocks();
46425 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46426
46427 xmlXPathRegisterAllFunctions(ctxt);
46428 call_tests++;
46429 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46430 xmlResetLastError();
46431 if (mem_base != xmlMemBlocks()) {
46432 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46433 xmlMemBlocks() - mem_base);
46434 test_ret++;
46435 printf(" %d", n_ctxt);
46436 printf("\n");
46437 }
46438 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046439 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046440#endif
46441
Daniel Veillarda82b1822004-11-08 16:24:57 +000046442 return(test_ret);
46443}
46444
46445
46446static int
46447test_xmlXPathRegisterFunc(void) {
46448 int test_ret = 0;
46449
46450
46451 /* missing type support */
46452 return(test_ret);
46453}
46454
46455
46456static int
46457test_xmlXPathRegisterFuncLookup(void) {
46458 int test_ret = 0;
46459
46460
46461 /* missing type support */
46462 return(test_ret);
46463}
46464
46465
46466static int
46467test_xmlXPathRegisterFuncNS(void) {
46468 int test_ret = 0;
46469
46470
46471 /* missing type support */
46472 return(test_ret);
46473}
46474
46475
46476static int
46477test_xmlXPathRegisterNs(void) {
46478 int test_ret = 0;
46479
46480#ifdef LIBXML_XPATH_ENABLED
46481 int mem_base;
46482 int ret_val;
46483 xmlXPathContextPtr ctxt; /* the XPath context */
46484 int n_ctxt;
46485 xmlChar * prefix; /* the namespace prefix */
46486 int n_prefix;
46487 xmlChar * ns_uri; /* the namespace name */
46488 int n_ns_uri;
46489
46490 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46491 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46492 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46493 mem_base = xmlMemBlocks();
46494 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46495 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46496 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46497
William M. Brackf13f77f2004-11-12 16:03:48 +000046498 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046499 desret_int(ret_val);
46500 call_tests++;
46501 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046502 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46503 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046504 xmlResetLastError();
46505 if (mem_base != xmlMemBlocks()) {
46506 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46507 xmlMemBlocks() - mem_base);
46508 test_ret++;
46509 printf(" %d", n_ctxt);
46510 printf(" %d", n_prefix);
46511 printf(" %d", n_ns_uri);
46512 printf("\n");
46513 }
46514 }
46515 }
46516 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046517 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046518#endif
46519
Daniel Veillarda82b1822004-11-08 16:24:57 +000046520 return(test_ret);
46521}
46522
46523
46524static int
46525test_xmlXPathRegisterVariable(void) {
46526 int test_ret = 0;
46527
46528#ifdef LIBXML_XPATH_ENABLED
46529 int mem_base;
46530 int ret_val;
46531 xmlXPathContextPtr ctxt; /* the XPath context */
46532 int n_ctxt;
46533 xmlChar * name; /* the variable name */
46534 int n_name;
46535 xmlXPathObjectPtr value; /* the variable value or NULL */
46536 int n_value;
46537
46538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46539 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46540 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46541 mem_base = xmlMemBlocks();
46542 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46543 name = gen_const_xmlChar_ptr(n_name, 1);
46544 value = gen_xmlXPathObjectPtr(n_value, 2);
46545
William M. Brackf13f77f2004-11-12 16:03:48 +000046546 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046547 desret_int(ret_val);
46548 call_tests++;
46549 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046550 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046551 des_xmlXPathObjectPtr(n_value, value, 2);
46552 xmlResetLastError();
46553 if (mem_base != xmlMemBlocks()) {
46554 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46555 xmlMemBlocks() - mem_base);
46556 test_ret++;
46557 printf(" %d", n_ctxt);
46558 printf(" %d", n_name);
46559 printf(" %d", n_value);
46560 printf("\n");
46561 }
46562 }
46563 }
46564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046565 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046566#endif
46567
Daniel Veillarda82b1822004-11-08 16:24:57 +000046568 return(test_ret);
46569}
46570
46571
46572static int
46573test_xmlXPathRegisterVariableLookup(void) {
46574 int test_ret = 0;
46575
46576
46577 /* missing type support */
46578 return(test_ret);
46579}
46580
46581
46582static int
46583test_xmlXPathRegisterVariableNS(void) {
46584 int test_ret = 0;
46585
46586#ifdef LIBXML_XPATH_ENABLED
46587 int mem_base;
46588 int ret_val;
46589 xmlXPathContextPtr ctxt; /* the XPath context */
46590 int n_ctxt;
46591 xmlChar * name; /* the variable name */
46592 int n_name;
46593 xmlChar * ns_uri; /* the variable namespace URI */
46594 int n_ns_uri;
46595 xmlXPathObjectPtr value; /* the variable value or NULL */
46596 int n_value;
46597
46598 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46599 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46600 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46601 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46602 mem_base = xmlMemBlocks();
46603 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46604 name = gen_const_xmlChar_ptr(n_name, 1);
46605 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46606 value = gen_xmlXPathObjectPtr(n_value, 3);
46607
William M. Brackf13f77f2004-11-12 16:03:48 +000046608 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046609 desret_int(ret_val);
46610 call_tests++;
46611 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046612 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
46613 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046614 des_xmlXPathObjectPtr(n_value, value, 3);
46615 xmlResetLastError();
46616 if (mem_base != xmlMemBlocks()) {
46617 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46618 xmlMemBlocks() - mem_base);
46619 test_ret++;
46620 printf(" %d", n_ctxt);
46621 printf(" %d", n_name);
46622 printf(" %d", n_ns_uri);
46623 printf(" %d", n_value);
46624 printf("\n");
46625 }
46626 }
46627 }
46628 }
46629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046630 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046631#endif
46632
Daniel Veillarda82b1822004-11-08 16:24:57 +000046633 return(test_ret);
46634}
46635
46636
46637static int
46638test_xmlXPathRegisteredFuncsCleanup(void) {
46639 int test_ret = 0;
46640
46641#ifdef LIBXML_XPATH_ENABLED
46642 int mem_base;
46643 xmlXPathContextPtr ctxt; /* the XPath context */
46644 int n_ctxt;
46645
46646 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46647 mem_base = xmlMemBlocks();
46648 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46649
46650 xmlXPathRegisteredFuncsCleanup(ctxt);
46651 call_tests++;
46652 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46653 xmlResetLastError();
46654 if (mem_base != xmlMemBlocks()) {
46655 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46656 xmlMemBlocks() - mem_base);
46657 test_ret++;
46658 printf(" %d", n_ctxt);
46659 printf("\n");
46660 }
46661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046662 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046663#endif
46664
Daniel Veillarda82b1822004-11-08 16:24:57 +000046665 return(test_ret);
46666}
46667
46668
46669static int
46670test_xmlXPathRegisteredNsCleanup(void) {
46671 int test_ret = 0;
46672
46673#ifdef LIBXML_XPATH_ENABLED
46674 int mem_base;
46675 xmlXPathContextPtr ctxt; /* the XPath context */
46676 int n_ctxt;
46677
46678 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46679 mem_base = xmlMemBlocks();
46680 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46681
46682 xmlXPathRegisteredNsCleanup(ctxt);
46683 call_tests++;
46684 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46685 xmlResetLastError();
46686 if (mem_base != xmlMemBlocks()) {
46687 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46688 xmlMemBlocks() - mem_base);
46689 test_ret++;
46690 printf(" %d", n_ctxt);
46691 printf("\n");
46692 }
46693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046694 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046695#endif
46696
Daniel Veillarda82b1822004-11-08 16:24:57 +000046697 return(test_ret);
46698}
46699
46700
46701static int
46702test_xmlXPathRegisteredVariablesCleanup(void) {
46703 int test_ret = 0;
46704
46705#ifdef LIBXML_XPATH_ENABLED
46706 int mem_base;
46707 xmlXPathContextPtr ctxt; /* the XPath context */
46708 int n_ctxt;
46709
46710 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46711 mem_base = xmlMemBlocks();
46712 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46713
46714 xmlXPathRegisteredVariablesCleanup(ctxt);
46715 call_tests++;
46716 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46717 xmlResetLastError();
46718 if (mem_base != xmlMemBlocks()) {
46719 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46720 xmlMemBlocks() - mem_base);
46721 test_ret++;
46722 printf(" %d", n_ctxt);
46723 printf("\n");
46724 }
46725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046726 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046727#endif
46728
Daniel Veillarda82b1822004-11-08 16:24:57 +000046729 return(test_ret);
46730}
46731
46732
46733static int
46734test_xmlXPathRoot(void) {
46735 int test_ret = 0;
46736
46737#ifdef LIBXML_XPATH_ENABLED
46738 int mem_base;
46739 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46740 int n_ctxt;
46741
46742 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46743 mem_base = xmlMemBlocks();
46744 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46745
46746 xmlXPathRoot(ctxt);
46747 call_tests++;
46748 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46749 xmlResetLastError();
46750 if (mem_base != xmlMemBlocks()) {
46751 printf("Leak of %d blocks found in xmlXPathRoot",
46752 xmlMemBlocks() - mem_base);
46753 test_ret++;
46754 printf(" %d", n_ctxt);
46755 printf("\n");
46756 }
46757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046758 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046759#endif
46760
Daniel Veillarda82b1822004-11-08 16:24:57 +000046761 return(test_ret);
46762}
46763
46764
46765static int
46766test_xmlXPathRoundFunction(void) {
46767 int test_ret = 0;
46768
46769#ifdef LIBXML_XPATH_ENABLED
46770 int mem_base;
46771 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46772 int n_ctxt;
46773 int nargs; /* the number of arguments */
46774 int n_nargs;
46775
46776 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46777 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46778 mem_base = xmlMemBlocks();
46779 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46780 nargs = gen_int(n_nargs, 1);
46781
46782 xmlXPathRoundFunction(ctxt, nargs);
46783 call_tests++;
46784 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46785 des_int(n_nargs, nargs, 1);
46786 xmlResetLastError();
46787 if (mem_base != xmlMemBlocks()) {
46788 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46789 xmlMemBlocks() - mem_base);
46790 test_ret++;
46791 printf(" %d", n_ctxt);
46792 printf(" %d", n_nargs);
46793 printf("\n");
46794 }
46795 }
46796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046797 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046798#endif
46799
Daniel Veillarda82b1822004-11-08 16:24:57 +000046800 return(test_ret);
46801}
46802
46803
46804static int
46805test_xmlXPathStartsWithFunction(void) {
46806 int test_ret = 0;
46807
46808#ifdef LIBXML_XPATH_ENABLED
46809 int mem_base;
46810 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46811 int n_ctxt;
46812 int nargs; /* the number of arguments */
46813 int n_nargs;
46814
46815 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46816 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46817 mem_base = xmlMemBlocks();
46818 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46819 nargs = gen_int(n_nargs, 1);
46820
46821 xmlXPathStartsWithFunction(ctxt, nargs);
46822 call_tests++;
46823 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46824 des_int(n_nargs, nargs, 1);
46825 xmlResetLastError();
46826 if (mem_base != xmlMemBlocks()) {
46827 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46828 xmlMemBlocks() - mem_base);
46829 test_ret++;
46830 printf(" %d", n_ctxt);
46831 printf(" %d", n_nargs);
46832 printf("\n");
46833 }
46834 }
46835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046836 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046837#endif
46838
Daniel Veillarda82b1822004-11-08 16:24:57 +000046839 return(test_ret);
46840}
46841
46842
46843static int
46844test_xmlXPathStringEvalNumber(void) {
46845 int test_ret = 0;
46846
46847#ifdef LIBXML_XPATH_ENABLED
46848 int mem_base;
46849 double ret_val;
46850 xmlChar * str; /* A string to scan */
46851 int n_str;
46852
46853 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
46854 mem_base = xmlMemBlocks();
46855 str = gen_const_xmlChar_ptr(n_str, 0);
46856
William M. Brackf13f77f2004-11-12 16:03:48 +000046857 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046858 desret_double(ret_val);
46859 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000046860 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046861 xmlResetLastError();
46862 if (mem_base != xmlMemBlocks()) {
46863 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
46864 xmlMemBlocks() - mem_base);
46865 test_ret++;
46866 printf(" %d", n_str);
46867 printf("\n");
46868 }
46869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046870 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046871#endif
46872
Daniel Veillarda82b1822004-11-08 16:24:57 +000046873 return(test_ret);
46874}
46875
46876
46877static int
46878test_xmlXPathStringFunction(void) {
46879 int test_ret = 0;
46880
46881#ifdef LIBXML_XPATH_ENABLED
46882 int mem_base;
46883 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46884 int n_ctxt;
46885 int nargs; /* the number of arguments */
46886 int n_nargs;
46887
46888 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46889 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46890 mem_base = xmlMemBlocks();
46891 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46892 nargs = gen_int(n_nargs, 1);
46893
46894 xmlXPathStringFunction(ctxt, nargs);
46895 call_tests++;
46896 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46897 des_int(n_nargs, nargs, 1);
46898 xmlResetLastError();
46899 if (mem_base != xmlMemBlocks()) {
46900 printf("Leak of %d blocks found in xmlXPathStringFunction",
46901 xmlMemBlocks() - mem_base);
46902 test_ret++;
46903 printf(" %d", n_ctxt);
46904 printf(" %d", n_nargs);
46905 printf("\n");
46906 }
46907 }
46908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046909 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046910#endif
46911
Daniel Veillarda82b1822004-11-08 16:24:57 +000046912 return(test_ret);
46913}
46914
46915
46916static int
46917test_xmlXPathStringLengthFunction(void) {
46918 int test_ret = 0;
46919
46920#ifdef LIBXML_XPATH_ENABLED
46921 int mem_base;
46922 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46923 int n_ctxt;
46924 int nargs; /* the number of arguments */
46925 int n_nargs;
46926
46927 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46928 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46929 mem_base = xmlMemBlocks();
46930 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46931 nargs = gen_int(n_nargs, 1);
46932
46933 xmlXPathStringLengthFunction(ctxt, nargs);
46934 call_tests++;
46935 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46936 des_int(n_nargs, nargs, 1);
46937 xmlResetLastError();
46938 if (mem_base != xmlMemBlocks()) {
46939 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
46940 xmlMemBlocks() - mem_base);
46941 test_ret++;
46942 printf(" %d", n_ctxt);
46943 printf(" %d", n_nargs);
46944 printf("\n");
46945 }
46946 }
46947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046948 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046949#endif
46950
Daniel Veillarda82b1822004-11-08 16:24:57 +000046951 return(test_ret);
46952}
46953
46954
46955static int
46956test_xmlXPathSubValues(void) {
46957 int test_ret = 0;
46958
46959#ifdef LIBXML_XPATH_ENABLED
46960 int mem_base;
46961 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46962 int n_ctxt;
46963
46964 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46965 mem_base = xmlMemBlocks();
46966 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46967
46968 xmlXPathSubValues(ctxt);
46969 call_tests++;
46970 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46971 xmlResetLastError();
46972 if (mem_base != xmlMemBlocks()) {
46973 printf("Leak of %d blocks found in xmlXPathSubValues",
46974 xmlMemBlocks() - mem_base);
46975 test_ret++;
46976 printf(" %d", n_ctxt);
46977 printf("\n");
46978 }
46979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046980 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046981#endif
46982
Daniel Veillarda82b1822004-11-08 16:24:57 +000046983 return(test_ret);
46984}
46985
46986
46987static int
46988test_xmlXPathSubstringAfterFunction(void) {
46989 int test_ret = 0;
46990
46991#ifdef LIBXML_XPATH_ENABLED
46992 int mem_base;
46993 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46994 int n_ctxt;
46995 int nargs; /* the number of arguments */
46996 int n_nargs;
46997
46998 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46999 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47000 mem_base = xmlMemBlocks();
47001 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47002 nargs = gen_int(n_nargs, 1);
47003
47004 xmlXPathSubstringAfterFunction(ctxt, nargs);
47005 call_tests++;
47006 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47007 des_int(n_nargs, nargs, 1);
47008 xmlResetLastError();
47009 if (mem_base != xmlMemBlocks()) {
47010 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47011 xmlMemBlocks() - mem_base);
47012 test_ret++;
47013 printf(" %d", n_ctxt);
47014 printf(" %d", n_nargs);
47015 printf("\n");
47016 }
47017 }
47018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047019 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047020#endif
47021
Daniel Veillarda82b1822004-11-08 16:24:57 +000047022 return(test_ret);
47023}
47024
47025
47026static int
47027test_xmlXPathSubstringBeforeFunction(void) {
47028 int test_ret = 0;
47029
47030#ifdef LIBXML_XPATH_ENABLED
47031 int mem_base;
47032 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47033 int n_ctxt;
47034 int nargs; /* the number of arguments */
47035 int n_nargs;
47036
47037 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47038 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47039 mem_base = xmlMemBlocks();
47040 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47041 nargs = gen_int(n_nargs, 1);
47042
47043 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47044 call_tests++;
47045 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47046 des_int(n_nargs, nargs, 1);
47047 xmlResetLastError();
47048 if (mem_base != xmlMemBlocks()) {
47049 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47050 xmlMemBlocks() - mem_base);
47051 test_ret++;
47052 printf(" %d", n_ctxt);
47053 printf(" %d", n_nargs);
47054 printf("\n");
47055 }
47056 }
47057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047058 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047059#endif
47060
Daniel Veillarda82b1822004-11-08 16:24:57 +000047061 return(test_ret);
47062}
47063
47064
47065static int
47066test_xmlXPathSubstringFunction(void) {
47067 int test_ret = 0;
47068
47069#ifdef LIBXML_XPATH_ENABLED
47070 int mem_base;
47071 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47072 int n_ctxt;
47073 int nargs; /* the number of arguments */
47074 int n_nargs;
47075
47076 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47077 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47078 mem_base = xmlMemBlocks();
47079 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47080 nargs = gen_int(n_nargs, 1);
47081
47082 xmlXPathSubstringFunction(ctxt, nargs);
47083 call_tests++;
47084 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47085 des_int(n_nargs, nargs, 1);
47086 xmlResetLastError();
47087 if (mem_base != xmlMemBlocks()) {
47088 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47089 xmlMemBlocks() - mem_base);
47090 test_ret++;
47091 printf(" %d", n_ctxt);
47092 printf(" %d", n_nargs);
47093 printf("\n");
47094 }
47095 }
47096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047097 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047098#endif
47099
Daniel Veillarda82b1822004-11-08 16:24:57 +000047100 return(test_ret);
47101}
47102
47103
47104static int
47105test_xmlXPathSumFunction(void) {
47106 int test_ret = 0;
47107
47108#ifdef LIBXML_XPATH_ENABLED
47109 int mem_base;
47110 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47111 int n_ctxt;
47112 int nargs; /* the number of arguments */
47113 int n_nargs;
47114
47115 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47116 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47117 mem_base = xmlMemBlocks();
47118 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47119 nargs = gen_int(n_nargs, 1);
47120
47121 xmlXPathSumFunction(ctxt, nargs);
47122 call_tests++;
47123 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47124 des_int(n_nargs, nargs, 1);
47125 xmlResetLastError();
47126 if (mem_base != xmlMemBlocks()) {
47127 printf("Leak of %d blocks found in xmlXPathSumFunction",
47128 xmlMemBlocks() - mem_base);
47129 test_ret++;
47130 printf(" %d", n_ctxt);
47131 printf(" %d", n_nargs);
47132 printf("\n");
47133 }
47134 }
47135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047136 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047137#endif
47138
Daniel Veillarda82b1822004-11-08 16:24:57 +000047139 return(test_ret);
47140}
47141
47142
47143static int
47144test_xmlXPathTrailing(void) {
47145 int test_ret = 0;
47146
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047147#ifdef LIBXML_XPATH_ENABLED
47148 int mem_base;
47149 xmlNodeSetPtr ret_val;
47150 xmlNodeSetPtr nodes1; /* a node-set */
47151 int n_nodes1;
47152 xmlNodeSetPtr nodes2; /* a node-set */
47153 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047154
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047155 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47156 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47157 mem_base = xmlMemBlocks();
47158 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47159 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47160
47161 ret_val = xmlXPathTrailing(nodes1, nodes2);
47162 desret_xmlNodeSetPtr(ret_val);
47163 call_tests++;
47164 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47165 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47166 xmlResetLastError();
47167 if (mem_base != xmlMemBlocks()) {
47168 printf("Leak of %d blocks found in xmlXPathTrailing",
47169 xmlMemBlocks() - mem_base);
47170 test_ret++;
47171 printf(" %d", n_nodes1);
47172 printf(" %d", n_nodes2);
47173 printf("\n");
47174 }
47175 }
47176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047177 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047178#endif
47179
Daniel Veillarda82b1822004-11-08 16:24:57 +000047180 return(test_ret);
47181}
47182
47183
47184static int
47185test_xmlXPathTrailingSorted(void) {
47186 int test_ret = 0;
47187
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047188#ifdef LIBXML_XPATH_ENABLED
47189 int mem_base;
47190 xmlNodeSetPtr ret_val;
47191 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47192 int n_nodes1;
47193 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47194 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047195
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047196 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47197 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47198 mem_base = xmlMemBlocks();
47199 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47200 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47201
47202 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47203 desret_xmlNodeSetPtr(ret_val);
47204 call_tests++;
47205 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47206 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47207 xmlResetLastError();
47208 if (mem_base != xmlMemBlocks()) {
47209 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47210 xmlMemBlocks() - mem_base);
47211 test_ret++;
47212 printf(" %d", n_nodes1);
47213 printf(" %d", n_nodes2);
47214 printf("\n");
47215 }
47216 }
47217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047218 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047219#endif
47220
Daniel Veillarda82b1822004-11-08 16:24:57 +000047221 return(test_ret);
47222}
47223
47224
47225static int
47226test_xmlXPathTranslateFunction(void) {
47227 int test_ret = 0;
47228
47229#ifdef LIBXML_XPATH_ENABLED
47230 int mem_base;
47231 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47232 int n_ctxt;
47233 int nargs; /* the number of arguments */
47234 int n_nargs;
47235
47236 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47237 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47238 mem_base = xmlMemBlocks();
47239 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47240 nargs = gen_int(n_nargs, 1);
47241
47242 xmlXPathTranslateFunction(ctxt, nargs);
47243 call_tests++;
47244 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47245 des_int(n_nargs, nargs, 1);
47246 xmlResetLastError();
47247 if (mem_base != xmlMemBlocks()) {
47248 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47249 xmlMemBlocks() - mem_base);
47250 test_ret++;
47251 printf(" %d", n_ctxt);
47252 printf(" %d", n_nargs);
47253 printf("\n");
47254 }
47255 }
47256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047257 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047258#endif
47259
Daniel Veillarda82b1822004-11-08 16:24:57 +000047260 return(test_ret);
47261}
47262
47263
47264static int
47265test_xmlXPathTrueFunction(void) {
47266 int test_ret = 0;
47267
47268#ifdef LIBXML_XPATH_ENABLED
47269 int mem_base;
47270 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47271 int n_ctxt;
47272 int nargs; /* the number of arguments */
47273 int n_nargs;
47274
47275 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47276 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47277 mem_base = xmlMemBlocks();
47278 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47279 nargs = gen_int(n_nargs, 1);
47280
47281 xmlXPathTrueFunction(ctxt, nargs);
47282 call_tests++;
47283 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47284 des_int(n_nargs, nargs, 1);
47285 xmlResetLastError();
47286 if (mem_base != xmlMemBlocks()) {
47287 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47288 xmlMemBlocks() - mem_base);
47289 test_ret++;
47290 printf(" %d", n_ctxt);
47291 printf(" %d", n_nargs);
47292 printf("\n");
47293 }
47294 }
47295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047296 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047297#endif
47298
Daniel Veillarda82b1822004-11-08 16:24:57 +000047299 return(test_ret);
47300}
47301
47302
47303static int
47304test_xmlXPathValueFlipSign(void) {
47305 int test_ret = 0;
47306
47307#ifdef LIBXML_XPATH_ENABLED
47308 int mem_base;
47309 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47310 int n_ctxt;
47311
47312 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47313 mem_base = xmlMemBlocks();
47314 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47315
47316 xmlXPathValueFlipSign(ctxt);
47317 call_tests++;
47318 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47319 xmlResetLastError();
47320 if (mem_base != xmlMemBlocks()) {
47321 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47322 xmlMemBlocks() - mem_base);
47323 test_ret++;
47324 printf(" %d", n_ctxt);
47325 printf("\n");
47326 }
47327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047328 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047329#endif
47330
Daniel Veillarda82b1822004-11-08 16:24:57 +000047331 return(test_ret);
47332}
47333
47334
47335static int
47336test_xmlXPathVariableLookup(void) {
47337 int test_ret = 0;
47338
47339#ifdef LIBXML_XPATH_ENABLED
47340 int mem_base;
47341 xmlXPathObjectPtr ret_val;
47342 xmlXPathContextPtr ctxt; /* the XPath context */
47343 int n_ctxt;
47344 xmlChar * name; /* the variable name */
47345 int n_name;
47346
47347 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47348 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47349 mem_base = xmlMemBlocks();
47350 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47351 name = gen_const_xmlChar_ptr(n_name, 1);
47352
William M. Brackf13f77f2004-11-12 16:03:48 +000047353 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047354 desret_xmlXPathObjectPtr(ret_val);
47355 call_tests++;
47356 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047357 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047358 xmlResetLastError();
47359 if (mem_base != xmlMemBlocks()) {
47360 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47361 xmlMemBlocks() - mem_base);
47362 test_ret++;
47363 printf(" %d", n_ctxt);
47364 printf(" %d", n_name);
47365 printf("\n");
47366 }
47367 }
47368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047369 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047370#endif
47371
Daniel Veillarda82b1822004-11-08 16:24:57 +000047372 return(test_ret);
47373}
47374
47375
47376static int
47377test_xmlXPathVariableLookupNS(void) {
47378 int test_ret = 0;
47379
47380#ifdef LIBXML_XPATH_ENABLED
47381 int mem_base;
47382 xmlXPathObjectPtr ret_val;
47383 xmlXPathContextPtr ctxt; /* the XPath context */
47384 int n_ctxt;
47385 xmlChar * name; /* the variable name */
47386 int n_name;
47387 xmlChar * ns_uri; /* the variable namespace URI */
47388 int n_ns_uri;
47389
47390 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47391 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47392 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47393 mem_base = xmlMemBlocks();
47394 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47395 name = gen_const_xmlChar_ptr(n_name, 1);
47396 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47397
William M. Brackf13f77f2004-11-12 16:03:48 +000047398 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047399 desret_xmlXPathObjectPtr(ret_val);
47400 call_tests++;
47401 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047402 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47403 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047404 xmlResetLastError();
47405 if (mem_base != xmlMemBlocks()) {
47406 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47407 xmlMemBlocks() - mem_base);
47408 test_ret++;
47409 printf(" %d", n_ctxt);
47410 printf(" %d", n_name);
47411 printf(" %d", n_ns_uri);
47412 printf("\n");
47413 }
47414 }
47415 }
47416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047417 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047418#endif
47419
Daniel Veillarda82b1822004-11-08 16:24:57 +000047420 return(test_ret);
47421}
47422
47423
47424static int
47425test_xmlXPathWrapCString(void) {
47426 int test_ret = 0;
47427
47428#ifdef LIBXML_XPATH_ENABLED
47429 int mem_base;
47430 xmlXPathObjectPtr ret_val;
47431 char * val; /* the char * value */
47432 int n_val;
47433
47434 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47435 mem_base = xmlMemBlocks();
47436 val = gen_char_ptr(n_val, 0);
47437
47438 ret_val = xmlXPathWrapCString(val);
47439 desret_xmlXPathObjectPtr(ret_val);
47440 call_tests++;
47441 des_char_ptr(n_val, val, 0);
47442 xmlResetLastError();
47443 if (mem_base != xmlMemBlocks()) {
47444 printf("Leak of %d blocks found in xmlXPathWrapCString",
47445 xmlMemBlocks() - mem_base);
47446 test_ret++;
47447 printf(" %d", n_val);
47448 printf("\n");
47449 }
47450 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047451 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047452#endif
47453
Daniel Veillarda82b1822004-11-08 16:24:57 +000047454 return(test_ret);
47455}
47456
47457
47458static int
47459test_xmlXPathWrapExternal(void) {
47460 int test_ret = 0;
47461
47462#ifdef LIBXML_XPATH_ENABLED
47463 int mem_base;
47464 xmlXPathObjectPtr ret_val;
47465 void * val; /* the user data */
47466 int n_val;
47467
47468 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47469 mem_base = xmlMemBlocks();
47470 val = gen_void_ptr(n_val, 0);
47471
47472 ret_val = xmlXPathWrapExternal(val);
47473 desret_xmlXPathObjectPtr(ret_val);
47474 call_tests++;
47475 des_void_ptr(n_val, val, 0);
47476 xmlResetLastError();
47477 if (mem_base != xmlMemBlocks()) {
47478 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47479 xmlMemBlocks() - mem_base);
47480 test_ret++;
47481 printf(" %d", n_val);
47482 printf("\n");
47483 }
47484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047485 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047486#endif
47487
Daniel Veillarda82b1822004-11-08 16:24:57 +000047488 return(test_ret);
47489}
47490
47491
47492static int
47493test_xmlXPathWrapNodeSet(void) {
47494 int test_ret = 0;
47495
47496#ifdef LIBXML_XPATH_ENABLED
47497 int mem_base;
47498 xmlXPathObjectPtr ret_val;
47499 xmlNodeSetPtr val; /* the NodePtr value */
47500 int n_val;
47501
47502 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47503 mem_base = xmlMemBlocks();
47504 val = gen_xmlNodeSetPtr(n_val, 0);
47505
47506 ret_val = xmlXPathWrapNodeSet(val);
47507 desret_xmlXPathObjectPtr(ret_val);
47508 call_tests++;
47509 des_xmlNodeSetPtr(n_val, val, 0);
47510 xmlResetLastError();
47511 if (mem_base != xmlMemBlocks()) {
47512 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47513 xmlMemBlocks() - mem_base);
47514 test_ret++;
47515 printf(" %d", n_val);
47516 printf("\n");
47517 }
47518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047519 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047520#endif
47521
Daniel Veillarda82b1822004-11-08 16:24:57 +000047522 return(test_ret);
47523}
47524
47525
47526static int
47527test_xmlXPatherror(void) {
47528 int test_ret = 0;
47529
47530#ifdef LIBXML_XPATH_ENABLED
47531 int mem_base;
47532 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47533 int n_ctxt;
47534 const char * file; /* the file name */
47535 int n_file;
47536 int line; /* the line number */
47537 int n_line;
47538 int no; /* the error number */
47539 int n_no;
47540
47541 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47542 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47543 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47544 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47545 mem_base = xmlMemBlocks();
47546 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47547 file = gen_filepath(n_file, 1);
47548 line = gen_int(n_line, 2);
47549 no = gen_int(n_no, 3);
47550
47551 xmlXPatherror(ctxt, file, line, no);
47552 call_tests++;
47553 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47554 des_filepath(n_file, file, 1);
47555 des_int(n_line, line, 2);
47556 des_int(n_no, no, 3);
47557 xmlResetLastError();
47558 if (mem_base != xmlMemBlocks()) {
47559 printf("Leak of %d blocks found in xmlXPatherror",
47560 xmlMemBlocks() - mem_base);
47561 test_ret++;
47562 printf(" %d", n_ctxt);
47563 printf(" %d", n_file);
47564 printf(" %d", n_line);
47565 printf(" %d", n_no);
47566 printf("\n");
47567 }
47568 }
47569 }
47570 }
47571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047572 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047573#endif
47574
Daniel Veillarda82b1822004-11-08 16:24:57 +000047575 return(test_ret);
47576}
47577
47578static int
47579test_xpathInternals(void) {
47580 int test_ret = 0;
47581
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047582 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047583 test_ret += test_valuePop();
47584 test_ret += test_valuePush();
47585 test_ret += test_xmlXPathAddValues();
47586 test_ret += test_xmlXPathBooleanFunction();
47587 test_ret += test_xmlXPathCeilingFunction();
47588 test_ret += test_xmlXPathCompareValues();
47589 test_ret += test_xmlXPathConcatFunction();
47590 test_ret += test_xmlXPathContainsFunction();
47591 test_ret += test_xmlXPathCountFunction();
47592 test_ret += test_xmlXPathDebugDumpCompExpr();
47593 test_ret += test_xmlXPathDebugDumpObject();
47594 test_ret += test_xmlXPathDifference();
47595 test_ret += test_xmlXPathDistinct();
47596 test_ret += test_xmlXPathDistinctSorted();
47597 test_ret += test_xmlXPathDivValues();
47598 test_ret += test_xmlXPathEqualValues();
47599 test_ret += test_xmlXPathErr();
47600 test_ret += test_xmlXPathEvalExpr();
47601 test_ret += test_xmlXPathEvaluatePredicateResult();
47602 test_ret += test_xmlXPathFalseFunction();
47603 test_ret += test_xmlXPathFloorFunction();
47604 test_ret += test_xmlXPathFunctionLookup();
47605 test_ret += test_xmlXPathFunctionLookupNS();
47606 test_ret += test_xmlXPathHasSameNodes();
47607 test_ret += test_xmlXPathIdFunction();
47608 test_ret += test_xmlXPathIntersection();
47609 test_ret += test_xmlXPathIsNodeType();
47610 test_ret += test_xmlXPathLangFunction();
47611 test_ret += test_xmlXPathLastFunction();
47612 test_ret += test_xmlXPathLeading();
47613 test_ret += test_xmlXPathLeadingSorted();
47614 test_ret += test_xmlXPathLocalNameFunction();
47615 test_ret += test_xmlXPathModValues();
47616 test_ret += test_xmlXPathMultValues();
47617 test_ret += test_xmlXPathNamespaceURIFunction();
47618 test_ret += test_xmlXPathNewBoolean();
47619 test_ret += test_xmlXPathNewCString();
47620 test_ret += test_xmlXPathNewFloat();
47621 test_ret += test_xmlXPathNewNodeSet();
47622 test_ret += test_xmlXPathNewNodeSetList();
47623 test_ret += test_xmlXPathNewParserContext();
47624 test_ret += test_xmlXPathNewString();
47625 test_ret += test_xmlXPathNextAncestor();
47626 test_ret += test_xmlXPathNextAncestorOrSelf();
47627 test_ret += test_xmlXPathNextAttribute();
47628 test_ret += test_xmlXPathNextChild();
47629 test_ret += test_xmlXPathNextDescendant();
47630 test_ret += test_xmlXPathNextDescendantOrSelf();
47631 test_ret += test_xmlXPathNextFollowing();
47632 test_ret += test_xmlXPathNextFollowingSibling();
47633 test_ret += test_xmlXPathNextNamespace();
47634 test_ret += test_xmlXPathNextParent();
47635 test_ret += test_xmlXPathNextPreceding();
47636 test_ret += test_xmlXPathNextPrecedingSibling();
47637 test_ret += test_xmlXPathNextSelf();
47638 test_ret += test_xmlXPathNodeLeading();
47639 test_ret += test_xmlXPathNodeLeadingSorted();
47640 test_ret += test_xmlXPathNodeSetAdd();
47641 test_ret += test_xmlXPathNodeSetAddNs();
47642 test_ret += test_xmlXPathNodeSetAddUnique();
47643 test_ret += test_xmlXPathNodeSetContains();
47644 test_ret += test_xmlXPathNodeSetDel();
47645 test_ret += test_xmlXPathNodeSetMerge();
47646 test_ret += test_xmlXPathNodeSetRemove();
47647 test_ret += test_xmlXPathNodeSetSort();
47648 test_ret += test_xmlXPathNodeTrailing();
47649 test_ret += test_xmlXPathNodeTrailingSorted();
47650 test_ret += test_xmlXPathNormalizeFunction();
47651 test_ret += test_xmlXPathNotEqualValues();
47652 test_ret += test_xmlXPathNotFunction();
47653 test_ret += test_xmlXPathNsLookup();
47654 test_ret += test_xmlXPathNumberFunction();
47655 test_ret += test_xmlXPathParseNCName();
47656 test_ret += test_xmlXPathParseName();
47657 test_ret += test_xmlXPathPopBoolean();
47658 test_ret += test_xmlXPathPopExternal();
47659 test_ret += test_xmlXPathPopNodeSet();
47660 test_ret += test_xmlXPathPopNumber();
47661 test_ret += test_xmlXPathPopString();
47662 test_ret += test_xmlXPathPositionFunction();
47663 test_ret += test_xmlXPathRegisterAllFunctions();
47664 test_ret += test_xmlXPathRegisterFunc();
47665 test_ret += test_xmlXPathRegisterFuncLookup();
47666 test_ret += test_xmlXPathRegisterFuncNS();
47667 test_ret += test_xmlXPathRegisterNs();
47668 test_ret += test_xmlXPathRegisterVariable();
47669 test_ret += test_xmlXPathRegisterVariableLookup();
47670 test_ret += test_xmlXPathRegisterVariableNS();
47671 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47672 test_ret += test_xmlXPathRegisteredNsCleanup();
47673 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47674 test_ret += test_xmlXPathRoot();
47675 test_ret += test_xmlXPathRoundFunction();
47676 test_ret += test_xmlXPathStartsWithFunction();
47677 test_ret += test_xmlXPathStringEvalNumber();
47678 test_ret += test_xmlXPathStringFunction();
47679 test_ret += test_xmlXPathStringLengthFunction();
47680 test_ret += test_xmlXPathSubValues();
47681 test_ret += test_xmlXPathSubstringAfterFunction();
47682 test_ret += test_xmlXPathSubstringBeforeFunction();
47683 test_ret += test_xmlXPathSubstringFunction();
47684 test_ret += test_xmlXPathSumFunction();
47685 test_ret += test_xmlXPathTrailing();
47686 test_ret += test_xmlXPathTrailingSorted();
47687 test_ret += test_xmlXPathTranslateFunction();
47688 test_ret += test_xmlXPathTrueFunction();
47689 test_ret += test_xmlXPathValueFlipSign();
47690 test_ret += test_xmlXPathVariableLookup();
47691 test_ret += test_xmlXPathVariableLookupNS();
47692 test_ret += test_xmlXPathWrapCString();
47693 test_ret += test_xmlXPathWrapExternal();
47694 test_ret += test_xmlXPathWrapNodeSet();
47695 test_ret += test_xmlXPatherror();
47696
47697 if (test_ret != 0)
47698 printf("Module xpathInternals: %d errors\n", test_ret);
47699 return(test_ret);
47700}
47701
Daniel Veillardd93f6252004-11-02 15:53:51 +000047702static int
47703test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047705
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047706#ifdef LIBXML_XPTR_ENABLED
47707 int mem_base;
47708 xmlNodePtr ret_val;
47709 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47710 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047711
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047712 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47713 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047714 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047715
47716 ret_val = xmlXPtrBuildNodeList(obj);
47717 desret_xmlNodePtr(ret_val);
47718 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047719 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047720 xmlResetLastError();
47721 if (mem_base != xmlMemBlocks()) {
47722 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047724 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047725 printf(" %d", n_obj);
47726 printf("\n");
47727 }
47728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047729 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047730#endif
47731
Daniel Veillard42595322004-11-08 10:52:06 +000047732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047733}
47734
47735
47736static int
47737test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047739
Daniel Veillardce682bc2004-11-05 17:22:25 +000047740#ifdef LIBXML_XPTR_ENABLED
47741 int mem_base;
47742 xmlXPathObjectPtr ret_val;
47743 xmlChar * str; /* the XPointer expression */
47744 int n_str;
47745 xmlXPathContextPtr ctx; /* the XPointer context */
47746 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047747
Daniel Veillardce682bc2004-11-05 17:22:25 +000047748 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47749 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47750 mem_base = xmlMemBlocks();
47751 str = gen_const_xmlChar_ptr(n_str, 0);
47752 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47753
William M. Brackf13f77f2004-11-12 16:03:48 +000047754 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047755 desret_xmlXPathObjectPtr(ret_val);
47756 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047757 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047758 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47759 xmlResetLastError();
47760 if (mem_base != xmlMemBlocks()) {
47761 printf("Leak of %d blocks found in xmlXPtrEval",
47762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047763 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047764 printf(" %d", n_str);
47765 printf(" %d", n_ctx);
47766 printf("\n");
47767 }
47768 }
47769 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047770 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047771#endif
47772
Daniel Veillard42595322004-11-08 10:52:06 +000047773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047774}
47775
47776
47777static int
47778test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047780
Daniel Veillardce682bc2004-11-05 17:22:25 +000047781#ifdef LIBXML_XPTR_ENABLED
47782 int mem_base;
47783 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47784 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047785
Daniel Veillardce682bc2004-11-05 17:22:25 +000047786 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47787 mem_base = xmlMemBlocks();
47788 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47789
47790 xmlXPtrEvalRangePredicate(ctxt);
47791 call_tests++;
47792 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47793 xmlResetLastError();
47794 if (mem_base != xmlMemBlocks()) {
47795 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047797 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047798 printf(" %d", n_ctxt);
47799 printf("\n");
47800 }
47801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047802 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047803#endif
47804
Daniel Veillard42595322004-11-08 10:52:06 +000047805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047806}
47807
Daniel Veillarda521d282004-11-09 14:59:59 +000047808#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000047809
Daniel Veillardce682bc2004-11-05 17:22:25 +000047810#define gen_nb_xmlLocationSetPtr 1
47811static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47812 return(NULL);
47813}
47814static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47815}
Daniel Veillarda521d282004-11-09 14:59:59 +000047816#endif
47817
Daniel Veillardce682bc2004-11-05 17:22:25 +000047818
Daniel Veillardd93f6252004-11-02 15:53:51 +000047819static int
47820test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047822
Daniel Veillardce682bc2004-11-05 17:22:25 +000047823#ifdef LIBXML_XPTR_ENABLED
47824 int mem_base;
47825 xmlLocationSetPtr cur; /* the initial range set */
47826 int n_cur;
47827 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
47828 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047829
Daniel Veillardce682bc2004-11-05 17:22:25 +000047830 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47831 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47832 mem_base = xmlMemBlocks();
47833 cur = gen_xmlLocationSetPtr(n_cur, 0);
47834 val = gen_xmlXPathObjectPtr(n_val, 1);
47835
47836 xmlXPtrLocationSetAdd(cur, val);
47837 call_tests++;
47838 des_xmlLocationSetPtr(n_cur, cur, 0);
47839 des_xmlXPathObjectPtr(n_val, val, 1);
47840 xmlResetLastError();
47841 if (mem_base != xmlMemBlocks()) {
47842 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
47843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047844 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047845 printf(" %d", n_cur);
47846 printf(" %d", n_val);
47847 printf("\n");
47848 }
47849 }
47850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047851 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047852#endif
47853
Daniel Veillard42595322004-11-08 10:52:06 +000047854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047855}
47856
47857
47858static int
47859test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047861
47862
47863 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047865}
47866
47867
47868static int
47869test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047871
Daniel Veillardce682bc2004-11-05 17:22:25 +000047872#ifdef LIBXML_XPTR_ENABLED
47873 int mem_base;
47874 xmlLocationSetPtr cur; /* the initial range set */
47875 int n_cur;
47876 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
47877 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047878
Daniel Veillardce682bc2004-11-05 17:22:25 +000047879 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47880 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47881 mem_base = xmlMemBlocks();
47882 cur = gen_xmlLocationSetPtr(n_cur, 0);
47883 val = gen_xmlXPathObjectPtr(n_val, 1);
47884
47885 xmlXPtrLocationSetDel(cur, val);
47886 call_tests++;
47887 des_xmlLocationSetPtr(n_cur, cur, 0);
47888 des_xmlXPathObjectPtr(n_val, val, 1);
47889 xmlResetLastError();
47890 if (mem_base != xmlMemBlocks()) {
47891 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
47892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047893 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047894 printf(" %d", n_cur);
47895 printf(" %d", n_val);
47896 printf("\n");
47897 }
47898 }
47899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047900 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047901#endif
47902
Daniel Veillard42595322004-11-08 10:52:06 +000047903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047904}
47905
47906
47907static int
47908test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047910
47911
47912 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047914}
47915
47916
47917static int
47918test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047920
Daniel Veillardce682bc2004-11-05 17:22:25 +000047921#ifdef LIBXML_XPTR_ENABLED
47922 int mem_base;
47923 xmlLocationSetPtr cur; /* the initial range set */
47924 int n_cur;
47925 int val; /* the index to remove */
47926 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047927
Daniel Veillardce682bc2004-11-05 17:22:25 +000047928 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47929 for (n_val = 0;n_val < gen_nb_int;n_val++) {
47930 mem_base = xmlMemBlocks();
47931 cur = gen_xmlLocationSetPtr(n_cur, 0);
47932 val = gen_int(n_val, 1);
47933
47934 xmlXPtrLocationSetRemove(cur, val);
47935 call_tests++;
47936 des_xmlLocationSetPtr(n_cur, cur, 0);
47937 des_int(n_val, val, 1);
47938 xmlResetLastError();
47939 if (mem_base != xmlMemBlocks()) {
47940 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
47941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047942 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047943 printf(" %d", n_cur);
47944 printf(" %d", n_val);
47945 printf("\n");
47946 }
47947 }
47948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047949 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047950#endif
47951
Daniel Veillard42595322004-11-08 10:52:06 +000047952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047953}
47954
47955
47956static int
47957test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047959
Daniel Veillard3d97e662004-11-04 10:49:00 +000047960#ifdef LIBXML_XPTR_ENABLED
47961 int mem_base;
47962 xmlXPathObjectPtr ret_val;
47963 xmlNodePtr start; /* the starting and ending node */
47964 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047965
Daniel Veillard3d97e662004-11-04 10:49:00 +000047966 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47967 mem_base = xmlMemBlocks();
47968 start = gen_xmlNodePtr(n_start, 0);
47969
47970 ret_val = xmlXPtrNewCollapsedRange(start);
47971 desret_xmlXPathObjectPtr(ret_val);
47972 call_tests++;
47973 des_xmlNodePtr(n_start, start, 0);
47974 xmlResetLastError();
47975 if (mem_base != xmlMemBlocks()) {
47976 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
47977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047978 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047979 printf(" %d", n_start);
47980 printf("\n");
47981 }
47982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047983 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047984#endif
47985
Daniel Veillard42595322004-11-08 10:52:06 +000047986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047987}
47988
47989
47990static int
47991test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047993
47994
47995 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047997}
47998
47999
48000static int
48001test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048003
Daniel Veillardce682bc2004-11-05 17:22:25 +000048004#ifdef LIBXML_XPTR_ENABLED
48005 int mem_base;
48006 xmlXPathObjectPtr ret_val;
48007 xmlNodeSetPtr set; /* a node set */
48008 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048009
Daniel Veillardce682bc2004-11-05 17:22:25 +000048010 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48011 mem_base = xmlMemBlocks();
48012 set = gen_xmlNodeSetPtr(n_set, 0);
48013
48014 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48015 desret_xmlXPathObjectPtr(ret_val);
48016 call_tests++;
48017 des_xmlNodeSetPtr(n_set, set, 0);
48018 xmlResetLastError();
48019 if (mem_base != xmlMemBlocks()) {
48020 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048022 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048023 printf(" %d", n_set);
48024 printf("\n");
48025 }
48026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048027 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048028#endif
48029
Daniel Veillard42595322004-11-08 10:52:06 +000048030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048031}
48032
48033
48034static int
48035test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048037
Daniel Veillard3d97e662004-11-04 10:49:00 +000048038#ifdef LIBXML_XPTR_ENABLED
48039 int mem_base;
48040 xmlXPathObjectPtr ret_val;
48041 xmlNodePtr start; /* the start NodePtr value */
48042 int n_start;
48043 xmlNodePtr end; /* the end NodePtr value or NULL */
48044 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048045
Daniel Veillard3d97e662004-11-04 10:49:00 +000048046 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48047 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48048 mem_base = xmlMemBlocks();
48049 start = gen_xmlNodePtr(n_start, 0);
48050 end = gen_xmlNodePtr(n_end, 1);
48051
48052 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48053 desret_xmlXPathObjectPtr(ret_val);
48054 call_tests++;
48055 des_xmlNodePtr(n_start, start, 0);
48056 des_xmlNodePtr(n_end, end, 1);
48057 xmlResetLastError();
48058 if (mem_base != xmlMemBlocks()) {
48059 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048061 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048062 printf(" %d", n_start);
48063 printf(" %d", n_end);
48064 printf("\n");
48065 }
48066 }
48067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048068 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048069#endif
48070
Daniel Veillard42595322004-11-08 10:52:06 +000048071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048072}
48073
48074
48075static int
48076test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048078
Daniel Veillard3d97e662004-11-04 10:49:00 +000048079#ifdef LIBXML_XPTR_ENABLED
48080 int mem_base;
48081 xmlXPathObjectPtr ret_val;
48082 xmlNodePtr start; /* the starting node */
48083 int n_start;
48084 int startindex; /* the start index */
48085 int n_startindex;
48086 xmlNodePtr end; /* the ending point */
48087 int n_end;
48088 int endindex; /* the ending index */
48089 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048090
Daniel Veillard3d97e662004-11-04 10:49:00 +000048091 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48092 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48093 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48094 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48095 mem_base = xmlMemBlocks();
48096 start = gen_xmlNodePtr(n_start, 0);
48097 startindex = gen_int(n_startindex, 1);
48098 end = gen_xmlNodePtr(n_end, 2);
48099 endindex = gen_int(n_endindex, 3);
48100
48101 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48102 desret_xmlXPathObjectPtr(ret_val);
48103 call_tests++;
48104 des_xmlNodePtr(n_start, start, 0);
48105 des_int(n_startindex, startindex, 1);
48106 des_xmlNodePtr(n_end, end, 2);
48107 des_int(n_endindex, endindex, 3);
48108 xmlResetLastError();
48109 if (mem_base != xmlMemBlocks()) {
48110 printf("Leak of %d blocks found in xmlXPtrNewRange",
48111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048112 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048113 printf(" %d", n_start);
48114 printf(" %d", n_startindex);
48115 printf(" %d", n_end);
48116 printf(" %d", n_endindex);
48117 printf("\n");
48118 }
48119 }
48120 }
48121 }
48122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048123 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048124#endif
48125
Daniel Veillard42595322004-11-08 10:52:06 +000048126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048127}
48128
48129
48130static int
48131test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048133
Daniel Veillard3d97e662004-11-04 10:49:00 +000048134#ifdef LIBXML_XPTR_ENABLED
48135 int mem_base;
48136 xmlXPathObjectPtr ret_val;
48137 xmlNodePtr start; /* the starting node */
48138 int n_start;
48139 xmlXPathObjectPtr end; /* the ending object */
48140 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048141
Daniel Veillard3d97e662004-11-04 10:49:00 +000048142 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48143 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48144 mem_base = xmlMemBlocks();
48145 start = gen_xmlNodePtr(n_start, 0);
48146 end = gen_xmlXPathObjectPtr(n_end, 1);
48147
48148 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48149 desret_xmlXPathObjectPtr(ret_val);
48150 call_tests++;
48151 des_xmlNodePtr(n_start, start, 0);
48152 des_xmlXPathObjectPtr(n_end, end, 1);
48153 xmlResetLastError();
48154 if (mem_base != xmlMemBlocks()) {
48155 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048157 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048158 printf(" %d", n_start);
48159 printf(" %d", n_end);
48160 printf("\n");
48161 }
48162 }
48163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048164 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048165#endif
48166
Daniel Veillard42595322004-11-08 10:52:06 +000048167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048168}
48169
48170
48171static int
48172test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048174
Daniel Veillard3d97e662004-11-04 10:49:00 +000048175#ifdef LIBXML_XPTR_ENABLED
48176 int mem_base;
48177 xmlXPathObjectPtr ret_val;
48178 xmlNodePtr start; /* the starting node */
48179 int n_start;
48180 xmlXPathObjectPtr end; /* the ending point */
48181 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048182
Daniel Veillard3d97e662004-11-04 10:49:00 +000048183 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48184 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48185 mem_base = xmlMemBlocks();
48186 start = gen_xmlNodePtr(n_start, 0);
48187 end = gen_xmlXPathObjectPtr(n_end, 1);
48188
48189 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48190 desret_xmlXPathObjectPtr(ret_val);
48191 call_tests++;
48192 des_xmlNodePtr(n_start, start, 0);
48193 des_xmlXPathObjectPtr(n_end, end, 1);
48194 xmlResetLastError();
48195 if (mem_base != xmlMemBlocks()) {
48196 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048198 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048199 printf(" %d", n_start);
48200 printf(" %d", n_end);
48201 printf("\n");
48202 }
48203 }
48204 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048205 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048206#endif
48207
Daniel Veillard42595322004-11-08 10:52:06 +000048208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048209}
48210
48211
48212static int
48213test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048215
Daniel Veillard3d97e662004-11-04 10:49:00 +000048216#ifdef LIBXML_XPTR_ENABLED
48217 int mem_base;
48218 xmlXPathObjectPtr ret_val;
48219 xmlNodePtr start; /* the starting node */
48220 int n_start;
48221 xmlNodePtr end; /* the ending node */
48222 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048223
Daniel Veillard3d97e662004-11-04 10:49:00 +000048224 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48225 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48226 mem_base = xmlMemBlocks();
48227 start = gen_xmlNodePtr(n_start, 0);
48228 end = gen_xmlNodePtr(n_end, 1);
48229
48230 ret_val = xmlXPtrNewRangeNodes(start, end);
48231 desret_xmlXPathObjectPtr(ret_val);
48232 call_tests++;
48233 des_xmlNodePtr(n_start, start, 0);
48234 des_xmlNodePtr(n_end, end, 1);
48235 xmlResetLastError();
48236 if (mem_base != xmlMemBlocks()) {
48237 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048239 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048240 printf(" %d", n_start);
48241 printf(" %d", n_end);
48242 printf("\n");
48243 }
48244 }
48245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048246 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048247#endif
48248
Daniel Veillard42595322004-11-08 10:52:06 +000048249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048250}
48251
48252
48253static int
48254test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048256
Daniel Veillard3d97e662004-11-04 10:49:00 +000048257#ifdef LIBXML_XPTR_ENABLED
48258 int mem_base;
48259 xmlXPathObjectPtr ret_val;
48260 xmlXPathObjectPtr start; /* the starting point */
48261 int n_start;
48262 xmlNodePtr end; /* the ending node */
48263 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048264
Daniel Veillard3d97e662004-11-04 10:49:00 +000048265 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48266 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48267 mem_base = xmlMemBlocks();
48268 start = gen_xmlXPathObjectPtr(n_start, 0);
48269 end = gen_xmlNodePtr(n_end, 1);
48270
48271 ret_val = xmlXPtrNewRangePointNode(start, end);
48272 desret_xmlXPathObjectPtr(ret_val);
48273 call_tests++;
48274 des_xmlXPathObjectPtr(n_start, start, 0);
48275 des_xmlNodePtr(n_end, end, 1);
48276 xmlResetLastError();
48277 if (mem_base != xmlMemBlocks()) {
48278 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048280 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048281 printf(" %d", n_start);
48282 printf(" %d", n_end);
48283 printf("\n");
48284 }
48285 }
48286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048287 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048288#endif
48289
Daniel Veillard42595322004-11-08 10:52:06 +000048290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048291}
48292
48293
48294static int
48295test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048297
Daniel Veillard3d97e662004-11-04 10:49:00 +000048298#ifdef LIBXML_XPTR_ENABLED
48299 int mem_base;
48300 xmlXPathObjectPtr ret_val;
48301 xmlXPathObjectPtr start; /* the starting point */
48302 int n_start;
48303 xmlXPathObjectPtr end; /* the ending point */
48304 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048305
Daniel Veillard3d97e662004-11-04 10:49:00 +000048306 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48307 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48308 mem_base = xmlMemBlocks();
48309 start = gen_xmlXPathObjectPtr(n_start, 0);
48310 end = gen_xmlXPathObjectPtr(n_end, 1);
48311
48312 ret_val = xmlXPtrNewRangePoints(start, end);
48313 desret_xmlXPathObjectPtr(ret_val);
48314 call_tests++;
48315 des_xmlXPathObjectPtr(n_start, start, 0);
48316 des_xmlXPathObjectPtr(n_end, end, 1);
48317 xmlResetLastError();
48318 if (mem_base != xmlMemBlocks()) {
48319 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048321 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048322 printf(" %d", n_start);
48323 printf(" %d", n_end);
48324 printf("\n");
48325 }
48326 }
48327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048328 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048329#endif
48330
Daniel Veillard42595322004-11-08 10:52:06 +000048331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048332}
48333
48334
48335static int
48336test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048338
Daniel Veillardce682bc2004-11-05 17:22:25 +000048339#ifdef LIBXML_XPTR_ENABLED
48340 int mem_base;
48341 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48342 int n_ctxt;
48343 int nargs; /* the number of args */
48344 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048345
Daniel Veillardce682bc2004-11-05 17:22:25 +000048346 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48347 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48348 mem_base = xmlMemBlocks();
48349 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48350 nargs = gen_int(n_nargs, 1);
48351
48352 xmlXPtrRangeToFunction(ctxt, nargs);
48353 call_tests++;
48354 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48355 des_int(n_nargs, nargs, 1);
48356 xmlResetLastError();
48357 if (mem_base != xmlMemBlocks()) {
48358 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048360 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048361 printf(" %d", n_ctxt);
48362 printf(" %d", n_nargs);
48363 printf("\n");
48364 }
48365 }
48366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048367 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048368#endif
48369
Daniel Veillard42595322004-11-08 10:52:06 +000048370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048371}
48372
48373
48374static int
48375test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048377
Daniel Veillardce682bc2004-11-05 17:22:25 +000048378#ifdef LIBXML_XPTR_ENABLED
48379 int mem_base;
48380 xmlXPathObjectPtr ret_val;
48381 xmlLocationSetPtr val; /* the LocationSet value */
48382 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048383
Daniel Veillardce682bc2004-11-05 17:22:25 +000048384 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48385 mem_base = xmlMemBlocks();
48386 val = gen_xmlLocationSetPtr(n_val, 0);
48387
48388 ret_val = xmlXPtrWrapLocationSet(val);
48389 desret_xmlXPathObjectPtr(ret_val);
48390 call_tests++;
48391 des_xmlLocationSetPtr(n_val, val, 0);
48392 xmlResetLastError();
48393 if (mem_base != xmlMemBlocks()) {
48394 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048396 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048397 printf(" %d", n_val);
48398 printf("\n");
48399 }
48400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048401 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048402#endif
48403
Daniel Veillard42595322004-11-08 10:52:06 +000048404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048405}
48406
48407static int
48408test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048410
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048411 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048412 test_ret += test_xmlXPtrBuildNodeList();
48413 test_ret += test_xmlXPtrEval();
48414 test_ret += test_xmlXPtrEvalRangePredicate();
48415 test_ret += test_xmlXPtrLocationSetAdd();
48416 test_ret += test_xmlXPtrLocationSetCreate();
48417 test_ret += test_xmlXPtrLocationSetDel();
48418 test_ret += test_xmlXPtrLocationSetMerge();
48419 test_ret += test_xmlXPtrLocationSetRemove();
48420 test_ret += test_xmlXPtrNewCollapsedRange();
48421 test_ret += test_xmlXPtrNewContext();
48422 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48423 test_ret += test_xmlXPtrNewLocationSetNodes();
48424 test_ret += test_xmlXPtrNewRange();
48425 test_ret += test_xmlXPtrNewRangeNodeObject();
48426 test_ret += test_xmlXPtrNewRangeNodePoint();
48427 test_ret += test_xmlXPtrNewRangeNodes();
48428 test_ret += test_xmlXPtrNewRangePointNode();
48429 test_ret += test_xmlXPtrNewRangePoints();
48430 test_ret += test_xmlXPtrRangeToFunction();
48431 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048432
Daniel Veillard42595322004-11-08 10:52:06 +000048433 if (test_ret != 0)
48434 printf("Module xpointer: %d errors\n", test_ret);
48435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048436}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048437static int
48438test_module(const char *module) {
48439 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48440 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048441 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048442 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048443 if (!strcmp(module, "catalog")) return(test_catalog());
48444 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048445 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048446 if (!strcmp(module, "dict")) return(test_dict());
48447 if (!strcmp(module, "encoding")) return(test_encoding());
48448 if (!strcmp(module, "entities")) return(test_entities());
48449 if (!strcmp(module, "hash")) return(test_hash());
48450 if (!strcmp(module, "list")) return(test_list());
48451 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48452 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48453 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048454 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048455 if (!strcmp(module, "pattern")) return(test_pattern());
48456 if (!strcmp(module, "relaxng")) return(test_relaxng());
48457 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48458 if (!strcmp(module, "tree")) return(test_tree());
48459 if (!strcmp(module, "uri")) return(test_uri());
48460 if (!strcmp(module, "valid")) return(test_valid());
48461 if (!strcmp(module, "xinclude")) return(test_xinclude());
48462 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048463 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048464 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
48465 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048466 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048467 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48468 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48469 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48470 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048471 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048472 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48473 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048474 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048475 if (!strcmp(module, "xpointer")) return(test_xpointer());
48476 return(0);
48477}